Skip to content

Commit

Permalink
Update example app to work with new octokit
Browse files Browse the repository at this point in the history
Basically, all fields of a GitHub API response that end in _url have to
be accessed as follows:

Given a field named foo_url, to get its content you write
obj.rels[:foo].href instead of obj.foo_url.
  • Loading branch information
fphilipe committed Sep 17, 2013
1 parent 44c2f76 commit 029c880
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/app/views/organizations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ul>
<%- @orgs.each do |org| -%>
<li>
<%= image_tag org.avatar_url, width: 25, height: 25 %>
<%= image_tag org.rels[:avatar].href, width: 25, height: 25 %>
<%= link_to org.login, org_path(org.login) %>
</li>
<%- end -%>
Expand Down
6 changes: 3 additions & 3 deletions example/app/views/organizations/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2>
<%= image_tag @org.avatar_url, width: 50, height: 50 %>
<%= image_tag @org.rels[:avatar].href, width: 50, height: 50 %>
<%= @org.login %>
</h2>

Expand All @@ -9,7 +9,7 @@
<%- else -%>
<dl>
<%- @repos.each do |repo| -%>
<dt><%= link_to repo.name, repo.html_url %></dt>
<dt><%= link_to repo.name, repo.rels[:html].href %></dt>
<dd><%= repo.description %></dd>
<%- end -%>
</dl>
Expand All @@ -31,7 +31,7 @@
<ul>
<%- @members.each do |member| -%>
<li>
<%= image_tag member.avatar_url, width: 25, height: 25 %>
<%= image_tag member.rels[:avatar].href, width: 25, height: 25 %>
<%= link_to member.login, user_path(member.login) %>
</li>
<%- end -%>
Expand Down
4 changes: 2 additions & 2 deletions example/app/views/teams/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<%- else -%>
<dl>
<%- @repos.each do |repo| -%>
<dt><%= link_to repo.name, repo.html_url %></dt>
<dt><%= link_to repo.name, repo.rels[:html].href %></dt>
<dd><%= repo.description %></dd>
<%- end -%>
</dl>
Expand All @@ -19,7 +19,7 @@
<ul>
<%- @members.each do |member| -%>
<li>
<%= image_tag member.avatar_url, width: 25, height: 25 %>
<%= image_tag member.rels[:avatar].href, width: 25, height: 25 %>
<%= link_to member.login, user_path(member.login) %>
</li>
<%- end -%>
Expand Down
4 changes: 2 additions & 2 deletions example/app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2>
<%= image_tag @user.avatar_url, width: 50, height: 50 %>
<%= image_tag @user.rels[:avatar].href, width: 50, height: 50 %>
<%= @user.login %>
<%- if @user.name.present? %>
(<%= @user.name %>)
Expand All @@ -21,7 +21,7 @@
<%- else -%>
<dl>
<%- @repos.each do |repo| -%>
<dt><%= link_to repo.name, repo.html_url %></dt>
<dt><%= link_to repo.name, repo.rels[:html].href %></dt>
<dd><%= repo.description %></dd>
<%- end -%>
</dl>
Expand Down

0 comments on commit 029c880

Please sign in to comment.