Skip to content

Commit d7f834c

Browse files
committed
Merge pull request github#119 from github/get_branch
document the new branches/:branch endpoint
2 parents f2246e8 + 3164fd1 commit d7f834c

File tree

2 files changed

+65
-7
lines changed

2 files changed

+65
-7
lines changed

content/v3/repos.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,16 @@ in results.
222222
### Response
223223

224224
<%= headers 200 %>
225-
<%= json(:branch) { |h| [h] }%>
225+
<%= json(:branches) %>
226+
227+
## Get Branch
228+
229+
GET /repos/:user/:repo/branches/:branch
230+
231+
### Response
232+
233+
<%= headers 200 %>
234+
<%= json(:branch) %>
226235

227236
## Delete a Repository
228237

lib/resources.rb

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,62 @@ def text_html(response, status, head = {})
159159
"tarball_url" => "https://github.com/octocat/Hello-World/tarball/v0.1",
160160
}
161161

162-
BRANCH = {
163-
"name" => "master",
164-
"commit" => {
165-
"sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
166-
"url" => "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
162+
BRANCHES = [
163+
{
164+
"name" => "master",
165+
"commit" => {
166+
"sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
167+
"url" => "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
168+
}
167169
}
168-
}
170+
]
171+
172+
BRANCH = {"name"=>"master",
173+
"commit"=>
174+
{"sha"=>"7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
175+
"commit"=>
176+
{"author"=>
177+
{"name"=>"The Octocat",
178+
"date"=>"2012-03-06T15:06:50-08:00",
179+
"email"=>"[email protected]"},
180+
"url"=>
181+
"https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
182+
"message"=>
183+
"Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
184+
"tree"=>
185+
{"sha"=>"b4eecafa9be2f2006ce1b709d6857b07069b4608",
186+
"url"=>
187+
"https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"},
188+
"committer"=>
189+
{"name"=>"The Octocat",
190+
"date"=>"2012-03-06T15:06:50-08:00",
191+
"email"=>"[email protected]"}},
192+
"author"=>
193+
{"gravatar_id"=>"7ad39074b0584bc555d0417ae3e7d974",
194+
"avatar_url"=>
195+
"https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
196+
"url"=>"https://api.github.com/users/octocat",
197+
"id"=>583231,
198+
"login"=>"octocat"},
199+
"parents"=>
200+
[{"sha"=>"553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
201+
"url"=>
202+
"https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"},
203+
{"sha"=>"762941318ee16e59dabbacb1b4049eec22f0d303",
204+
"url"=>
205+
"https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"}],
206+
"url"=>
207+
"https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
208+
"committer"=>
209+
{"gravatar_id"=>"7ad39074b0584bc555d0417ae3e7d974",
210+
"avatar_url"=>
211+
"https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
212+
"url"=>"https://api.github.com/users/octocat",
213+
"id"=>583231,
214+
"login"=>"octocat"}},
215+
"_links"=>
216+
{"html"=>"https://github.com/octocat/Hello-World/tree/master",
217+
"self"=>"https://api.github.com/repos/octocat/Hello-World/branches/master"}}
169218

170219
MILESTONE = {
171220
"url" => "https://api.github.com/repos/octocat/Hello-World/milestones/1",

0 commit comments

Comments
 (0)