octokit 1.19.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.travis.yml +2 -0
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +35 -1
  4. data/lib/faraday/response/raise_octokit_error.rb +15 -22
  5. data/lib/octokit.rb +2 -1
  6. data/lib/octokit/authentication.rb +15 -0
  7. data/lib/octokit/client.rb +4 -0
  8. data/lib/octokit/client/authorizations.rb +1 -1
  9. data/lib/octokit/client/commits.rb +15 -14
  10. data/lib/octokit/client/contents.rb +42 -42
  11. data/lib/octokit/client/downloads.rb +5 -1
  12. data/lib/octokit/client/gists.rb +6 -12
  13. data/lib/octokit/client/gitignore.rb +41 -0
  14. data/lib/octokit/client/issues.rb +30 -1
  15. data/lib/octokit/client/labels.rb +2 -2
  16. data/lib/octokit/client/milestones.rb +1 -1
  17. data/lib/octokit/client/notifications.rb +1 -5
  18. data/lib/octokit/client/organizations.rb +11 -15
  19. data/lib/octokit/client/pulls.rb +33 -7
  20. data/lib/octokit/client/refs.rb +1 -1
  21. data/lib/octokit/client/repositories.rb +27 -40
  22. data/lib/octokit/client/users.rb +25 -13
  23. data/lib/octokit/configuration.rb +4 -2
  24. data/lib/octokit/connection.rb +6 -4
  25. data/lib/octokit/request.rb +9 -0
  26. data/lib/octokit/version.rb +1 -1
  27. data/octokit.gemspec +2 -1
  28. data/spec/fixtures/.netrc +2 -0
  29. data/spec/fixtures/all_repositories.json +122 -0
  30. data/spec/fixtures/all_users.json +34 -0
  31. data/spec/fixtures/gitignore_template_ruby.json +4 -0
  32. data/spec/fixtures/gitignore_templates.json +78 -0
  33. data/spec/fixtures/pull_requests_comments.json +82 -0
  34. data/spec/fixtures/repository_issues_comments.json +52 -0
  35. data/spec/octokit/client/authorizations_spec.rb +1 -1
  36. data/spec/octokit/client/commits_spec.rb +1 -1
  37. data/spec/octokit/client/downloads_spec.rb +1 -1
  38. data/spec/octokit/client/gists_spec.rb +6 -6
  39. data/spec/octokit/client/gitignore_spec.rb +29 -0
  40. data/spec/octokit/client/issues_spec.rb +12 -1
  41. data/spec/octokit/client/labels_spec.rb +2 -2
  42. data/spec/octokit/client/milestones_spec.rb +1 -1
  43. data/spec/octokit/client/notifications_spec.rb +10 -10
  44. data/spec/octokit/client/organizations_spec.rb +10 -10
  45. data/spec/octokit/client/pulls_spec.rb +13 -2
  46. data/spec/octokit/client/refs_spec.rb +1 -1
  47. data/spec/octokit/client/repositories_spec.rb +25 -14
  48. data/spec/octokit/client/users_spec.rb +17 -6
  49. data/spec/octokit/client_spec.rb +47 -1
  50. data/spec/octokit_spec.rb +1 -1
  51. metadata +36 -3
@@ -113,6 +113,35 @@ module Octokit
113
113
  post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:title => title, :body => body}))
114
114
  end
115
115
 
116
+ # Get all comments attached to issues for the repository
117
+ #
118
+ # By default, Issue Comments are ordered by ascending ID.
119
+ #
120
+ # @param repo [String, Repository, Hash] A GitHub repository
121
+ # @param options [Hash] Optional parameters
122
+ # @option options [String] :sort created or updated
123
+ # @option options [String] :direction asc or desc. Ignored without sort
124
+ # parameter.
125
+ # @option options [String] :since Timestamp in ISO 8601
126
+ # format: YYYY-MM-DDTHH:MM:SSZ
127
+ #
128
+ # @return [Array] List of issues comments.
129
+ #
130
+ # @see http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
131
+ #
132
+ # @example Get the comments for issues in the octokit repository
133
+ # @client.issues_comments("pengwynn/octokit")
134
+ #
135
+ # @example Get issues comments, sort by updated descending since a time
136
+ # @client.issues_comments("pengwynn/octokit", {
137
+ # :sort => 'desc',
138
+ # :direction => 'down',
139
+ # :since => '2010-05-04T23:45:02Z'
140
+ # })
141
+ def issues_comments(repo, options={})
142
+ get "/repos/#{Repository.new repo}/issues/comments", options
143
+ end
144
+
116
145
  # Get all comments attached to an issue
117
146
  #
118
147
  # @param repo [String, Repository, Hash] A GitHub repository
@@ -172,7 +201,7 @@ module Octokit
172
201
  # @example Delete the comment "I've started this on my 25-issue-comments-v3 fork" on Issue #25 on pengwynn/octokit
173
202
  # Octokit.delete_comment("pengwynn/octokit", 1194549)
174
203
  def delete_comment(repo, number, options={})
175
- request(:delete, "repos/#{Repository.new(repo)}/issues/comments/#{number}", options).status == 204
204
+ boolean_from_response(:delete, "repos/#{Repository.new(repo)}/issues/comments/#{number}", options)
176
205
  end
177
206
 
178
207
 
@@ -67,7 +67,7 @@ module Octokit
67
67
  # @example Delete the label "Version 1.0" from the repository.
68
68
  # Octokit.delete_label!("pengwynn/octokit", "Version 1.0")
69
69
  def delete_label!(repo, label, options={})
70
- request(:delete, "repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", options).status == 204
70
+ boolean_from_response(:delete, "repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", options)
71
71
  end
72
72
 
73
73
  # Remove a label from an Issue
@@ -97,7 +97,7 @@ module Octokit
97
97
  # @example Remove all labels from Issue #23
98
98
  # Octokit.remove_all_labels("pengwynn/octokit", 23)
99
99
  def remove_all_labels(repo, number, options={})
100
- request(:delete, "repos/#{Repository.new(repo)}/issues/#{number}/labels", options).status == 204
100
+ boolean_from_response(:delete, "repos/#{Repository.new(repo)}/issues/#{number}/labels", options)
101
101
  end
102
102
 
103
103
  # List labels for a given issue
@@ -79,7 +79,7 @@ module Octokit
79
79
  # @example Delete a single milestone from a repository
80
80
  # Octokit.delete_milestone("pengwynn/octokit", 1)
81
81
  def delete_milestone(repository, number, options={})
82
- request(:delete, "repos/#{Repository.new(repository)}/milestones/#{number}", options).status == 204
82
+ boolean_from_response(:delete, "repos/#{Repository.new(repository)}/milestones/#{number}", options)
83
83
  end
84
84
 
85
85
  end
@@ -210,11 +210,7 @@ module Octokit
210
210
  # @example
211
211
  # @client.delete_thread_subscription(1)
212
212
  def delete_thread_subscription(thread_id, options={})
213
- begin
214
- request(:delete, "notifications/threads/#{thread_id}", options).status == 204
215
- rescue
216
- false
217
- end
213
+ boolean_from_response(:delete, "notifications/threads/#{thread_id}", options)
218
214
  end
219
215
 
220
216
  end
@@ -89,7 +89,7 @@ module Octokit
89
89
  #
90
90
  # @param org [String] Organization handle for which to list repos
91
91
  # @option options [String] :type ('all') Filter by repository type.
92
- # `all`, `public`, `member` or `private`.
92
+ # `all`, `public`, `member`, `sources`, `forks`, or `private`.
93
93
  #
94
94
  # @return [Array<Hashie::Mash>] List of repositories
95
95
  # @see Octokit::Client
@@ -146,9 +146,7 @@ module Octokit
146
146
  # @client.organization_member?('your_organization', 'pengwynn')
147
147
  # => false
148
148
  def organization_member?(org, user, options={})
149
- request(:get, "orgs/#{org}/members/#{user}", options).status == 204
150
- rescue Octokit::NotFound
151
- false
149
+ boolean_from_response(:get, "orgs/#{org}/members/#{user}", options)
152
150
  end
153
151
  alias :org_member? :organization_member?
154
152
 
@@ -168,9 +166,7 @@ module Octokit
168
166
  # @client.organization_public_member?('github', 'pengwynn')
169
167
  # => true
170
168
  def organization_public_member?(org, user, options={})
171
- request(:get, "orgs/#{org}/public_members/#{user}", options).status == 204
172
- rescue Octokit::NotFound
173
- false
169
+ boolean_from_response(:get, "orgs/#{org}/public_members/#{user}", options)
174
170
  end
175
171
  alias :org_public_member? :organization_public_member?
176
172
 
@@ -265,7 +261,7 @@ module Octokit
265
261
  # @example
266
262
  # @client.delete_team(100000)
267
263
  def delete_team(team_id, options={})
268
- request(:delete, "teams/#{team_id}", options).status == 204
264
+ boolean_from_response(:delete, "teams/#{team_id}", options)
269
265
  end
270
266
 
271
267
  # List team members
@@ -298,7 +294,7 @@ module Octokit
298
294
  # There's a bug in this API call. The docs say to leave the body blank,
299
295
  # but it fails if the body is both blank and the content-length header
300
296
  # is not 0.
301
- request(:put, "teams/#{team_id}/members/#{user}", options.merge({:name => user})).status == 204
297
+ boolean_from_response(:put, "teams/#{team_id}/members/#{user}", options.merge({:name => user}))
302
298
  end
303
299
 
304
300
  # Remove team member
@@ -314,7 +310,7 @@ module Octokit
314
310
  # @example
315
311
  # @client.remove_team_member(100000, 'pengwynn')
316
312
  def remove_team_member(team_id, user, options={})
317
- request(:delete, "teams/#{team_id}/members/#{user}", options).status == 204
313
+ boolean_from_response(:delete, "teams/#{team_id}/members/#{user}", options)
318
314
  end
319
315
 
320
316
  # List team repositories
@@ -351,7 +347,7 @@ module Octokit
351
347
  # @example
352
348
  # @client.add_team_repo(100000, 'github/developer.github.com')
353
349
  def add_team_repository(team_id, repo, options={})
354
- request(:put, "teams/#{team_id}/repos/#{Repository.new(repo)}", options.merge(:name => Repository.new(repo))).status == 204
350
+ boolean_from_response(:put, "teams/#{team_id}/repos/#{Repository.new(repo)}", options.merge(:name => Repository.new(repo)))
355
351
  end
356
352
  alias :add_team_repo :add_team_repository
357
353
 
@@ -372,7 +368,7 @@ module Octokit
372
368
  # @example
373
369
  # @client.remove_team_repo(100000, 'github/developer.github.com')
374
370
  def remove_team_repository(team_id, repo, options={})
375
- request(:delete, "teams/#{team_id}/repos/#{Repository.new(repo)}").status == 204
371
+ boolean_from_response(:delete, "teams/#{team_id}/repos/#{Repository.new(repo)}")
376
372
  end
377
373
  alias :remove_team_repo :remove_team_repository
378
374
 
@@ -392,7 +388,7 @@ module Octokit
392
388
  def remove_organization_member(org, user, options={})
393
389
  # this is a synonym for: for team in org.teams: remove_team_member(team.id, user)
394
390
  # provided in the GH API v3
395
- request(:delete, "orgs/#{org}/members/#{user}", options).status == 204
391
+ boolean_from_response(:delete, "orgs/#{org}/members/#{user}", options)
396
392
  end
397
393
  alias :remove_org_member :remove_organization_member
398
394
 
@@ -408,7 +404,7 @@ module Octokit
408
404
  # @example
409
405
  # @client.publicize_membership('github', 'pengwynn')
410
406
  def publicize_membership(org, user, options={})
411
- request(:put, "orgs/#{org}/public_members/#{user}", options).status == 204
407
+ boolean_from_response(:put, "orgs/#{org}/public_members/#{user}", options)
412
408
  end
413
409
 
414
410
  # Conceal a user's membership of an organization.
@@ -425,7 +421,7 @@ module Octokit
425
421
  # @example
426
422
  # @client.conceal_membership('github', 'pengwynn')
427
423
  def unpublicize_membership(org, user, options={})
428
- request(:delete, "orgs/#{org}/public_members/#{user}", options).status == 204
424
+ boolean_from_response(:delete, "orgs/#{org}/public_members/#{user}", options)
429
425
  end
430
426
  alias :conceal_membership :unpublicize_membership
431
427
 
@@ -105,6 +105,37 @@ module Octokit
105
105
  end
106
106
  alias :pull_commits :pull_request_commits
107
107
 
108
+ # List pull request comments for a repository
109
+ #
110
+ # By default, Review Comments are ordered by ascending ID.
111
+ #
112
+ # @param repo [String, Repository, Hash] A GitHub repository
113
+ # @param options [Hash] Optional parameters
114
+ # @option options [String] :sort created or updated
115
+ # @option options [String] :direction asc or desc. Ignored without sort
116
+ # parameter.
117
+ # @option options [String] :since Timestamp in ISO 8601
118
+ # format: YYYY-MM-DDTHH:MM:SSZ
119
+ #
120
+ # @return [Array] List of pull request review comments.
121
+ #
122
+ # @see http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
123
+ #
124
+ # @example Get the pull request review comments in the octokit repository
125
+ # @client.issues_comments("pengwynn/octokit")
126
+ #
127
+ # @example Get review comments, sort by updated asc since a time
128
+ # @client.pull_requests_comments("pengwynn/octokit", {
129
+ # :sort => 'asc',
130
+ # :direction => 'down',
131
+ # :since => '2010-05-04T23:45:02Z'
132
+ # })
133
+ def pull_requests_comments(repo, options={})
134
+ get("repos/#{Repository.new repo}/pulls/comments")
135
+ end
136
+ alias :pulls_comments :pull_requests_comments
137
+ alias :reviews_comments :pull_requests_comments
138
+
108
139
  # List comments on a pull request
109
140
  #
110
141
  # @see http://developer.github.com/v3/pulls/#list-comments-on-a-pull-request
@@ -201,7 +232,7 @@ module Octokit
201
232
  # @example
202
233
  # @client.delete_pull_request_comment("pengwynn/octokit", 1902707)
203
234
  def delete_pull_request_comment(repo, comment_id, options={})
204
- request(:delete, "repos/#{Repository.new repo}/pulls/comments/#{comment_id}", options).status == 204
235
+ boolean_from_response(:delete, "repos/#{Repository.new repo}/pulls/comments/#{comment_id}", options)
205
236
  end
206
237
  alias :delete_pull_comment :delete_pull_request_comment
207
238
  alias :delete_review_comment :delete_pull_request_comment
@@ -235,12 +266,7 @@ module Octokit
235
266
  # @param number [Integer] Number of pull request
236
267
  # @return [Boolean] True if the pull request has been merged
237
268
  def pull_merged?(repo, number, options={})
238
- begin
239
- get("repos/#{Repository.new(repo)}/pulls/#{number}/merge", options)
240
- return true
241
- rescue Octokit::NotFound
242
- return false
243
- end
269
+ boolean_from_response(:get, "repos/#{Repository.new(repo)}/pulls/#{number}/merge", options)
244
270
  end
245
271
  alias :pull_request_merged? :pull_merged?
246
272
 
@@ -76,7 +76,7 @@ module Octokit
76
76
  # @example Delete tags/v0.0.3 for sferik/rails_admin
77
77
  # Octokit.delete_ref("sferik/rails_admin","tags/v0.0.3")
78
78
  def delete_ref(repo, ref, options={})
79
- request(:delete, "repos/#{Repository.new(repo)}/git/refs/#{ref}", options).status == 204
79
+ boolean_from_response(:delete, "repos/#{Repository.new(repo)}/git/refs/#{ref}", options)
80
80
  end
81
81
  alias :delete_reference :delete_ref
82
82
 
@@ -62,17 +62,28 @@ module Octokit
62
62
  alias :list_repos :repositories
63
63
  alias :repos :repositories
64
64
 
65
+ # List all repositories
66
+ #
67
+ # This provides a dump of every repository, in the order that they were
68
+ # created.
69
+ #
70
+ # @see http://developer.github.com/v3/repos/#list-all-repositories
71
+ #
72
+ # @param options [Hash] Optional options
73
+ # @option options [Integer] :since The integer ID of the last Repository
74
+ # that you’ve seen.
75
+ #
76
+ # @return [Array] List of repositories.
77
+ def all_repositories(options={})
78
+ get '/repositories', options
79
+ end
80
+
65
81
  # Star a repository
66
82
  #
67
83
  # @param repo [String, Hash, Repository] A GitHub repository
68
84
  # @return [Boolean] `true` if successfully starred
69
85
  def star(repo, options={})
70
- begin
71
- put "user/starred/#{Repository.new repo}", options
72
- return true
73
- rescue Octokit::NotFound
74
- return false
75
- end
86
+ boolean_from_response(:put, "user/starred/#{Repository.new repo}", options)
76
87
  end
77
88
 
78
89
  # Unstar a repository
@@ -80,12 +91,7 @@ module Octokit
80
91
  # @param repo [String, Hash, Repository] A GitHub repository
81
92
  # @return [Boolean] `true` if successfully unstarred
82
93
  def unstar(repo, options={})
83
- begin
84
- request :delete, "user/starred/#{Repository.new repo}", options
85
- return true
86
- rescue Octokit::NotFound
87
- return false
88
- end
94
+ boolean_from_response(:delete, "user/starred/#{Repository.new repo}", options)
89
95
  end
90
96
 
91
97
  # Watch a repository
@@ -94,12 +100,7 @@ module Octokit
94
100
  # @return [Boolean] `true` if successfully watched
95
101
  # @deprecated Use #star instead
96
102
  def watch(repo, options={})
97
- begin
98
- put "user/watched/#{Repository.new repo}", options
99
- return true
100
- rescue Octokit::NotFound
101
- return false
102
- end
103
+ boolean_from_response(:put, "user/watched/#{Repository.new repo}", options)
103
104
  end
104
105
 
105
106
  # Unwatch a repository
@@ -108,12 +109,7 @@ module Octokit
108
109
  # @return [Boolean] `true` if successfully unwatched
109
110
  # @deprecated Use #unstar instead
110
111
  def unwatch(repo, options={})
111
- begin
112
- request :delete, "user/watched/#{Repository.new repo}", options
113
- return true
114
- rescue Octokit::NotFound
115
- return false
116
- end
112
+ boolean_from_response(:delete, "user/watched/#{Repository.new repo}", options)
117
113
  end
118
114
 
119
115
  # Fork a repository
@@ -160,12 +156,7 @@ module Octokit
160
156
  # @param repo [String, Hash, Repository] A GitHub repository
161
157
  # @return [Boolean] `true` if repository was deleted
162
158
  def delete_repository(repo, options={})
163
- begin
164
- request :delete, "repos/#{Repository.new repo}", options
165
- return true
166
- rescue Octokit::NotFound
167
- return false
168
- end
159
+ boolean_from_response(:delete, "repos/#{Repository.new repo}", options)
169
160
  end
170
161
  alias :delete_repo :delete_repository
171
162
 
@@ -232,7 +223,7 @@ module Octokit
232
223
  # @example
233
224
  # @client.remove_deploy_key('pengwynn/octokit', 100000)
234
225
  def remove_deploy_key(repo, id, options={})
235
- request(:delete, "repos/#{Repository.new repo}/keys/#{id}", options).status == 204
226
+ boolean_from_response(:delete, "repos/#{Repository.new repo}/keys/#{id}", options)
236
227
  end
237
228
 
238
229
  # List collaborators
@@ -268,7 +259,7 @@ module Octokit
268
259
  # @example
269
260
  # @client.add_collab('pengwynn/octokit', 'holman')
270
261
  def add_collaborator(repo, collaborator, options={})
271
- request(:put, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options).status == 204
262
+ boolean_from_response(:put, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options)
272
263
  end
273
264
  alias :add_collab :add_collaborator
274
265
 
@@ -286,7 +277,7 @@ module Octokit
286
277
  # @example
287
278
  # @client.remove_collab('pengwynn/octokit', 'holman')
288
279
  def remove_collaborator(repo, collaborator, options={})
289
- request :delete, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options
280
+ boolean_from_response(:delete, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options)
290
281
  end
291
282
  alias :remove_collab :remove_collaborator
292
283
 
@@ -564,7 +555,7 @@ module Octokit
564
555
  # @example
565
556
  # @client.remove_hook('pengwynn/octokit', 1000000)
566
557
  def remove_hook(repo, id, options={})
567
- request(:delete, "repos/#{Repository.new repo}/hooks/#{id}", options).status == 204
558
+ boolean_from_response(:delete, "repos/#{Repository.new repo}/hooks/#{id}", options)
568
559
  end
569
560
 
570
561
  # Test hook
@@ -579,7 +570,7 @@ module Octokit
579
570
  # @example
580
571
  # @client.test_hook('pengwynn/octokit', 1000000)
581
572
  def test_hook(repo, id, options={})
582
- request(:post, "repos/#{Repository.new repo}/hooks/#{id}/test", options).status == 204
573
+ boolean_from_response(:post, "repos/#{Repository.new repo}/hooks/#{id}/tests", options)
583
574
  end
584
575
 
585
576
  # Get all Issue Events for a given Repository
@@ -674,11 +665,7 @@ module Octokit
674
665
  # @example
675
666
  # @client.delete_subscription("pengwynn/octokit")
676
667
  def delete_subscription(repo, options={})
677
- begin
678
- request(:delete, "repos/#{Repository.new repo}/subscription", options).status == 204
679
- rescue
680
- false
681
- end
668
+ boolean_from_response(:delete, "repos/#{Repository.new repo}/subscription", options)
682
669
  end
683
670
 
684
671
  end
@@ -13,6 +13,22 @@ module Octokit
13
13
  get("legacy/user/search/#{search}", options)['users']
14
14
  end
15
15
 
16
+ # List all GitHub users
17
+ #
18
+ # This provides a dump of every user, in the order that they signed up
19
+ # for GitHub.
20
+ #
21
+ # @param options [Hash] Optional options.
22
+ # @option options [Integer] :since The integer ID of the last User that
23
+ # you’ve seen.
24
+ #
25
+ # @see http://developer.github.com/v3/users/#get-all-users
26
+ #
27
+ # @return [Array] List of GitHub users.
28
+ def all_users(options={})
29
+ get "users", options
30
+ end
31
+
16
32
  # Get a single user
17
33
  #
18
34
  # @param user [String] A GitHub user name.
@@ -22,9 +38,9 @@ module Octokit
22
38
  # Octokit.user("sferik")
23
39
  def user(user=nil)
24
40
  if user
25
- get "users/#{user}", {}
41
+ get "users/#{user}"
26
42
  else
27
- get "user", {}
43
+ get "user"
28
44
  end
29
45
  end
30
46
 
@@ -96,9 +112,7 @@ module Octokit
96
112
  user = args.first
97
113
  user ||= login
98
114
  return if user.nil?
99
- request(:get, "user/following/#{target}").status == 204
100
- rescue Octokit::NotFound
101
- false
115
+ boolean_from_response(:get, "user/following/#{target}")
102
116
  end
103
117
 
104
118
  # Follow a user.
@@ -112,7 +126,7 @@ module Octokit
112
126
  # @example
113
127
  # @client.follow('holman')
114
128
  def follow(user, options={})
115
- request(:put, "user/following/#{user}", options).status == 204
129
+ boolean_from_response(:put, "user/following/#{user}", options)
116
130
  end
117
131
 
118
132
  # Unfollow a user.
@@ -126,7 +140,7 @@ module Octokit
126
140
  # @example
127
141
  # @client.unfollow('holman')
128
142
  def unfollow(user, options={})
129
- request(:delete, "user/following/#{user}", options).status == 204
143
+ boolean_from_response(:delete, "user/following/#{user}", options)
130
144
  end
131
145
 
132
146
  # Get list of repos starred by a user.
@@ -152,9 +166,7 @@ module Octokit
152
166
  # @example
153
167
  # @client.starred?('pengwynn', 'octokit')
154
168
  def starred?(user, repo, options={})
155
- request(:get, "user/starred/#{user}/#{repo}", options).status == 204
156
- rescue Octokit::NotFound
157
- false
169
+ boolean_from_response(:get, "user/starred/#{user}/#{repo}", options)
158
170
  end
159
171
 
160
172
  # Get list of repos watched by a user.
@@ -180,7 +192,7 @@ module Octokit
180
192
  # Requires authenticated client.
181
193
  #
182
194
  # @param key_id [Integer] Key to retreive.
183
- # @param [Hashie::Mash] Hash representing the key.
195
+ # @return [Hashie::Mash] Hash representing the key.
184
196
  # @see http://developer.github.com/v3/users/keys/#get-a-single-public-key
185
197
  # @example
186
198
  # @client.key(1)
@@ -253,7 +265,7 @@ module Octokit
253
265
  # @example
254
266
  # @client.remove_key(1)
255
267
  def remove_key(id, options={})
256
- request(:delete, "user/keys/#{id}", options).status == 204
268
+ boolean_from_response(:delete, "user/keys/#{id}", options)
257
269
  end
258
270
 
259
271
  # List email addresses for a user.
@@ -294,7 +306,7 @@ module Octokit
294
306
  # @example
295
307
  # @client.remove_email('old_email@user.com')
296
308
  def remove_email(email, options={})
297
- request(:delete, "user/emails", options.merge({:email => email})).status == 204
309
+ boolean_from_response(:delete, "user/emails", options.merge({:email => email}))
298
310
  end
299
311
 
300
312
  # List repositories being watched by a user.