github_api 0.4.11 → 0.5.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. data/README.md +76 -72
  2. data/features/cassettes/gists/starred.yml +48 -0
  3. data/features/cassettes/pagination/repos/commits/list.yml +193 -0
  4. data/features/cassettes/pagination/repos/commits/next.yml +183 -0
  5. data/features/cassettes/pagination/repos/diff/next.yml +45 -0
  6. data/features/cassettes/pagination/repos/list.yml +176 -0
  7. data/features/cassettes/pagination/repos/list/next.yml +222 -0
  8. data/features/cassettes/pagination/repos/per_page/each_page.yml +45 -0
  9. data/features/cassettes/repos/list.yml +92 -0
  10. data/features/error_codes.feature +1 -1
  11. data/features/gists.feature +12 -3
  12. data/features/gists/comments.feature +3 -3
  13. data/features/github_api.feature +13 -2
  14. data/features/pagination.feature +40 -39
  15. data/features/repos.feature +2 -2
  16. data/features/step_definitions/common_steps.rb +12 -0
  17. data/features/step_definitions/github_api_steps.rb +12 -1
  18. data/lib/github_api.rb +1 -1
  19. data/lib/github_api/api.rb +4 -2
  20. data/lib/github_api/api_factory.rb +11 -5
  21. data/lib/github_api/authorizations.rb +23 -32
  22. data/lib/github_api/client.rb +1 -0
  23. data/lib/github_api/events.rb +38 -38
  24. data/lib/github_api/filter.rb +1 -1
  25. data/lib/github_api/gists.rb +47 -42
  26. data/lib/github_api/gists/comments.rb +77 -84
  27. data/lib/github_api/git_data.rb +25 -6
  28. data/lib/github_api/git_data/blobs.rb +48 -45
  29. data/lib/github_api/git_data/commits.rb +76 -73
  30. data/lib/github_api/git_data/references.rb +137 -118
  31. data/lib/github_api/git_data/tags.rb +74 -70
  32. data/lib/github_api/git_data/trees.rb +88 -85
  33. data/lib/github_api/issues.rb +43 -31
  34. data/lib/github_api/issues/comments.rb +116 -119
  35. data/lib/github_api/issues/events.rb +20 -19
  36. data/lib/github_api/issues/labels.rb +200 -197
  37. data/lib/github_api/issues/milestones.rb +137 -134
  38. data/lib/github_api/orgs.rb +27 -23
  39. data/lib/github_api/orgs/members.rb +105 -108
  40. data/lib/github_api/orgs/teams.rb +236 -237
  41. data/lib/github_api/paged_request.rb +1 -1
  42. data/lib/github_api/pull_requests.rb +40 -42
  43. data/lib/github_api/pull_requests/comments.rb +140 -143
  44. data/lib/github_api/repos.rb +101 -67
  45. data/lib/github_api/repos/collaborators.rb +64 -68
  46. data/lib/github_api/repos/commits.rb +50 -39
  47. data/lib/github_api/repos/downloads.rb +107 -110
  48. data/lib/github_api/repos/forks.rb +38 -39
  49. data/lib/github_api/repos/hooks.rb +161 -167
  50. data/lib/github_api/repos/keys.rb +86 -86
  51. data/lib/github_api/repos/pub_sub_hubbub.rb +99 -87
  52. data/lib/github_api/repos/watching.rb +80 -82
  53. data/lib/github_api/request.rb +5 -9
  54. data/lib/github_api/users.rb +26 -16
  55. data/lib/github_api/users/emails.rb +47 -47
  56. data/lib/github_api/users/followers.rb +85 -86
  57. data/lib/github_api/users/keys.rb +73 -75
  58. data/lib/github_api/validations.rb +25 -0
  59. data/lib/github_api/validations/format.rb +23 -0
  60. data/lib/github_api/validations/presence.rb +25 -0
  61. data/lib/github_api/validations/required.rb +21 -0
  62. data/lib/github_api/validations/token.rb +41 -0
  63. data/lib/github_api/version.rb +3 -3
  64. data/spec/fixtures/repos/commit_comparison.json +112 -0
  65. data/spec/github/api_factory_spec.rb +17 -1
  66. data/spec/github/authorizations_spec.rb +36 -34
  67. data/spec/github/gists/comments_spec.rb +39 -45
  68. data/spec/github/gists_spec.rb +50 -53
  69. data/spec/github/git_data/blobs_spec.rb +27 -20
  70. data/spec/github/git_data/commits_spec.rb +20 -19
  71. data/spec/github/git_data/references_spec.rb +83 -46
  72. data/spec/github/git_data/tags_spec.rb +16 -15
  73. data/spec/github/git_data/trees_spec.rb +20 -19
  74. data/spec/github/git_data_spec.rb +10 -1
  75. data/spec/github/issues/comments_spec.rb +78 -68
  76. data/spec/github/issues/events_spec.rb +42 -34
  77. data/spec/github/issues/labels_spec.rb +89 -101
  78. data/spec/github/issues/milestones_spec.rb +76 -54
  79. data/spec/github/issues_spec.rb +53 -57
  80. data/spec/github/orgs/members_spec.rb +64 -49
  81. data/spec/github/orgs/teams_spec.rb +112 -101
  82. data/spec/github/orgs_spec.rb +41 -31
  83. data/spec/github/paged_request_spec.rb +6 -5
  84. data/spec/github/pull_requests/comments_spec.rb +39 -44
  85. data/spec/github/pull_requests_spec.rb +32 -48
  86. data/spec/github/repos/collaborators_spec.rb +40 -29
  87. data/spec/github/repos/commits_spec.rb +108 -64
  88. data/spec/github/repos/downloads_spec.rb +46 -45
  89. data/spec/github/repos/forks_spec.rb +23 -24
  90. data/spec/github/repos/hooks_spec.rb +69 -71
  91. data/spec/github/repos/keys_spec.rb +39 -34
  92. data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -4
  93. data/spec/github/repos/watching_spec.rb +31 -33
  94. data/spec/github/repos_spec.rb +74 -83
  95. data/spec/github/request_spec.rb +31 -2
  96. data/spec/github/users/emails_spec.rb +19 -17
  97. data/spec/github/users/followers_spec.rb +30 -28
  98. data/spec/github/users/keys_spec.rb +37 -33
  99. data/spec/github/users_spec.rb +124 -125
  100. data/spec/github/validations/format_spec.rb +42 -0
  101. data/spec/github/validations/presence_spec.rb +18 -0
  102. data/spec/github/validations/required_spec.rb +28 -0
  103. data/spec/github/validations/token_spec.rb +19 -0
  104. data/spec/github/validations_spec.rb +23 -0
  105. metadata +33 -10
  106. data/features/cassettes/pagination/repos.yml +0 -177
  107. data/features/cassettes/pagination/repos/next.yml +0 -177
  108. data/lib/github_api/validation.rb +0 -53
  109. data/spec/github/validation_spec.rb +0 -62
@@ -15,15 +15,6 @@ module Github
15
15
  :Watching => 'watching',
16
16
  :PubSubHubbub => 'pub_sub_hubbub'
17
17
 
18
- include Github::Repos::Collaborators
19
- include Github::Repos::Commits
20
- include Github::Repos::Downloads
21
- include Github::Repos::Forks
22
- include Github::Repos::Hooks
23
- include Github::Repos::Keys
24
- include Github::Repos::Watching
25
- include Github::Repos::PubSubHubbub
26
-
27
18
  DEFAULT_REPO_OPTIONS = {
28
19
  "homepage" => "https://github.com",
29
20
  "private" => false,
@@ -40,6 +31,7 @@ module Github
40
31
  has_issues
41
32
  has_wiki
42
33
  has_downloads
34
+ team_id
43
35
  ].freeze
44
36
 
45
37
  VALID_REPO_TYPES = %w[ all public private member ].freeze
@@ -49,22 +41,62 @@ module Github
49
41
  super(options)
50
42
  end
51
43
 
44
+ # Access to Repos::Collaborators API
45
+ def collaborators
46
+ @collaborators ||= ApiFactory.new 'Repos::Collaborators'
47
+ end
48
+
49
+ # Access to Repos::Commits API
50
+ def commits
51
+ @commits ||= ApiFactory.new 'Repos::Commits'
52
+ end
53
+
54
+ # Access to Repos::Downloads API
55
+ def downloads
56
+ @downloads ||= ApiFactory.new 'Repos::Downloads'
57
+ end
58
+
59
+ # Access to Repos::Forks API
60
+ def forks
61
+ @forks ||= ApiFactory.new 'Repos::Forks'
62
+ end
63
+
64
+ # Access to Repos::Hooks API
65
+ def hooks
66
+ @hooks ||= ApiFactory.new 'Repos::Hooks'
67
+ end
68
+
69
+ # Access to Repos::Keys API
70
+ def keys
71
+ @keys ||= ApiFactory.new 'Repos::Keys'
72
+ end
73
+
74
+ # Access to Repos::Watchin API
75
+ def watching
76
+ @watching ||= ApiFactory.new 'Repos::Watching'
77
+ end
78
+
79
+ # Access to Repos::Watchin API
80
+ def pubsubhubbub
81
+ @pubsubhubbub ||= ApiFactory.new 'Repos::PubSubHubbub'
82
+ end
83
+
52
84
  # List branches
53
85
  #
54
86
  # = Examples
55
87
  #
56
- # @github = Github.new
57
- # @github.repos.branches 'user-name', 'repo-name'
88
+ # github = Github.new
89
+ # github.repos.branches 'user-name', 'repo-name'
58
90
  #
59
- # @repos = Github::Repos.new
60
- # @repos.branches 'user-name', 'repo-name'
91
+ # repos = Github::Repos.new
92
+ # repos.branches 'user-name', 'repo-name'
61
93
  #
62
94
  def branches(user_name, repo_name, params={})
63
95
  _update_user_repo_params(user_name, repo_name)
64
96
  _validate_user_repo_params(user, repo) unless (user? && repo?)
65
97
  _normalize_params_keys(params)
66
98
 
67
- response = get("/repos/#{user}/#{repo}/branches", params)
99
+ response = get_request("/repos/#{user}/#{repo}/branches", params)
68
100
  return response unless block_given?
69
101
  response.each { |el| yield el }
70
102
  end
@@ -80,10 +112,12 @@ module Github
80
112
  # <tt>:has_issues</tt> - Optional boolean - <tt>true</tt> to enable issues for this repository, <tt>false</tt> to disable them
81
113
  # <tt>:has_wiki</tt> - Optional boolean - <tt>true</tt> to enable the wiki for this repository, <tt>false</tt> to disable it. Default is <tt>true</tt>
82
114
  # <tt>:has_downloads</tt> Optional boolean - <tt>true</tt> to enable downloads for this repository
115
+ # <tt>:org</tt> Optional string - The organisation in which this repository will be created
116
+ # <tt>:team_id</tt> Optional number - The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization
83
117
  #
84
118
  # = Examples
85
- # @github = Github.new
86
- # @github.repos.create_repo "name" => 'repo-name'
119
+ # github = Github.new
120
+ # github.repos.create "name" => 'repo-name'
87
121
  # "description": "This is your first repo",
88
122
  # "homepage": "https://github.com",
89
123
  # "private": false,
@@ -95,10 +129,10 @@ module Github
95
129
  # must be a member of this organisation
96
130
  #
97
131
  # Examples:
98
- # @github = Github.new :oauth_token => '...'
99
- # @github.repos.create_repo :name => 'repo-name', :org => 'organisation-name'
132
+ # github = Github.new :oauth_token => '...'
133
+ # github.repos.create :name => 'repo-name', :org => 'organisation-name'
100
134
  #
101
- def create_repo(*args)
135
+ def create(*args)
102
136
  params = args.last.is_a?(Hash) ? args.pop : {}
103
137
  _normalize_params_keys(params)
104
138
  _filter_params_keys(VALID_REPO_OPTIONS + %w[ org ], params)
@@ -111,12 +145,11 @@ module Github
111
145
 
112
146
  # Requires authenticated user
113
147
  if (org = params.delete("org"))
114
- post("/orgs/#{org}/repos", DEFAULT_REPO_OPTIONS.merge(params))
148
+ post_request("/orgs/#{org}/repos", DEFAULT_REPO_OPTIONS.merge(params))
115
149
  else
116
- post("/user/repos", DEFAULT_REPO_OPTIONS.merge(params))
150
+ post_request("/user/repos", DEFAULT_REPO_OPTIONS.merge(params))
117
151
  end
118
152
  end
119
- alias :create_repository :create_repo
120
153
 
121
154
  # List contributors
122
155
  #
@@ -125,17 +158,17 @@ module Github
125
158
  #
126
159
  # = Examples
127
160
  #
128
- # @github = Github.new
129
- # @github.repos.contributors 'user-name','repo-name'
130
- # @github.repos.contributors 'user-name','repo-name' { |cont| ... }
161
+ # github = Github.new
162
+ # github.repos.contributors 'user-name','repo-name'
163
+ # github.repos.contributors 'user-name','repo-name' { |cont| ... }
131
164
  #
132
- def contributors(user_name=nil, repo_name=nil, params={})
165
+ def contributors(user_name, repo_name, params={})
133
166
  _update_user_repo_params(user_name, repo_name)
134
167
  _validate_user_repo_params(user, repo) unless user? && repo?
135
168
  _normalize_params_keys(params)
136
169
  _filter_params_keys(['anon'], params)
137
170
 
138
- response = get("/repos/#{user}/#{repo}/contributors", params)
171
+ response = get_request("/repos/#{user}/#{repo}/contributors", params)
139
172
  return response unless block_given?
140
173
  response.each { |el| yield el }
141
174
  end
@@ -155,10 +188,14 @@ module Github
155
188
  #
156
189
  # = Examples
157
190
  #
158
- # @github = Github.new
159
- # @github.repos.edit_repo('user-name', 'repo-name', { :name => 'hello-world', :description => 'This is your first repo', :homepage => "https://github.com", :private => false, :has_issues => true })
191
+ # github = Github.new
192
+ # github.repos.edit 'user-name', 'repo-name',
193
+ # :name => 'hello-world',
194
+ # :description => 'This is your first repo',
195
+ # :homepage => "https://github.com",
196
+ # :public => true, :has_issues => true
160
197
  #
161
- def edit_repo(user_name=nil, repo_name=nil, params={})
198
+ def edit(user_name, repo_name, params={})
162
199
  _update_user_repo_params(user_name, repo_name)
163
200
  _validate_user_repo_params(user, repo) unless user? && repo?
164
201
 
@@ -169,39 +206,37 @@ module Github
169
206
  raise ArgumentError, "Required params are: #{%w[ :name ] }"
170
207
  end
171
208
 
172
- patch("/repos/#{user}/#{repo}", DEFAULT_REPO_OPTIONS.merge(params))
209
+ patch_request("/repos/#{user}/#{repo}", DEFAULT_REPO_OPTIONS.merge(params))
173
210
  end
174
- alias :edit_repository :edit_repo
175
211
 
176
212
  # Get a repository
177
213
  #
178
214
  # = Examples
179
- # @github = Github.new
180
- # @github.repos.get_repo('user-name', 'repo-name')
215
+ # github = Github.new
216
+ # github.repos.get 'user-name', 'repo-name'
181
217
  #
182
- def get_repo(user_name=nil, repo_name=nil, params={})
218
+ def get(user_name, repo_name, params={})
183
219
  _update_user_repo_params(user_name, repo_name)
184
220
  _validate_user_repo_params(user, repo) unless user? && repo?
185
221
  _normalize_params_keys(params)
186
222
 
187
- get("/repos/#{user}/#{repo}", params)
223
+ get_request("/repos/#{user}/#{repo}", params)
188
224
  end
189
- alias :get_repository :get_repo
190
-
225
+ alias :find :get
191
226
 
192
227
  # List languages
193
228
  #
194
229
  # = Examples
195
- # @github = Github.new
196
- # @github.repos.languages('user-name', 'repo-name')
197
- # @github.repos.languages('user-name', 'repo-name') { |lang| ... }
230
+ # github = Github.new
231
+ # github.repos.languages 'user-name', 'repo-name'
232
+ # github.repos.languages 'user-name', 'repo-name' { |lang| ... }
198
233
  #
199
- def languages(user_name=nil, repo_name=nil, params={})
234
+ def languages(user_name, repo_name, params={})
200
235
  _update_user_repo_params(user_name, repo_name)
201
236
  _validate_user_repo_params(user, repo) unless user? && repo?
202
237
  _normalize_params_keys(params)
203
238
 
204
- response = get("/repos/#{user}/#{repo}/languages", params)
239
+ response = get_request("/repos/#{user}/#{repo}/languages", params)
205
240
  return response unless block_given?
206
241
  response.each { |el| yield el }
207
242
  end
@@ -210,57 +245,56 @@ module Github
210
245
  # List repositories for the authenticated user
211
246
  #
212
247
  # = Examples
213
- # @github = Github.new :oauth_token => '...'
214
- # @github.repos.list_repos
215
- # @github.repos.list_repos { |repo| ... }
248
+ # github = Github.new :oauth_token => '...'
249
+ # github.repos.list
250
+ # github.repos.list { |repo| ... }
216
251
  #
217
252
  # List public repositories for the specified user.
218
253
  #
219
254
  # = Examples
220
255
  # github = Github.new
221
- # github.repos.list_repos :user => 'user-name'
222
- # github.repos.list_repos :user => 'user-name', { |repo| ... }
256
+ # github.repos.list :user => 'user-name'
257
+ # github.repos.list :user => 'user-name', { |repo| ... }
223
258
  #
224
259
  # List repositories for the specified organisation.
225
260
  #
226
261
  # = Examples
227
- # @github = Github.new
228
- # @github.repos.list_repos :org => 'org-name'
229
- # @github.repos.list_repos :org => 'org-name', { |repo| ... }
262
+ # github = Github.new
263
+ # github.repos.list :org => 'org-name'
264
+ # github.repos.list :org => 'org-name', { |repo| ... }
230
265
  #
231
- def repos(*args)
266
+ def list(*args)
232
267
  params = args.last.is_a?(Hash) ? args.pop : {}
233
268
  _normalize_params_keys(params)
234
269
  _merge_user_into_params!(params) unless params.has_key?('user')
235
270
  _filter_params_keys(%w[ org user type ], params)
236
271
 
237
272
  response = if (user_name = params.delete("user"))
238
- get("/users/#{user_name}/repos", params)
273
+ get_request("/users/#{user_name}/repos", params)
239
274
  elsif (org_name = params.delete("org"))
240
- get("/orgs/#{org_name}/repos", params)
275
+ get_request("/orgs/#{org_name}/repos", params)
241
276
  else
242
277
  # For authenticated user
243
- get("/user/repos", params)
278
+ get_request("/user/repos", params)
244
279
  end
245
280
  return response unless block_given?
246
281
  response.each { |el| yield el }
247
282
  end
248
- alias :list_repos :repos
249
- alias :list_repositories :repos
283
+ alias :all :list
250
284
 
251
285
  # List tags
252
286
  #
253
287
  # = Examples
254
- # @github = Github.new
255
- # @github.repos.tags('user-name', 'repo-name')
256
- # @github.repos.tags('user-name', 'repo-name') { |tag| ... }
288
+ # github = Github.new
289
+ # github.repos.tags 'user-name', 'repo-name'
290
+ # github.repos.tags 'user-name', 'repo-name' { |tag| ... }
257
291
  #
258
- def tags(user_name=nil, repo_name=nil, params={})
292
+ def tags(user_name, repo_name, params={})
259
293
  _update_user_repo_params(user_name, repo_name)
260
294
  _validate_user_repo_params(user, repo) unless user? && repo?
261
295
  _normalize_params_keys(params)
262
296
 
263
- response = get("/repos/#{user}/#{repo}/tags", params)
297
+ response = get_request("/repos/#{user}/#{repo}/tags", params)
264
298
  return response unless block_given?
265
299
  response.each { |el| yield el }
266
300
  end
@@ -271,16 +305,16 @@ module Github
271
305
  # List teams
272
306
  #
273
307
  # == Examples
274
- # @github = Github.new
275
- # @github.repos.teams('user-name', 'repo-name')
276
- # @github.repos.teams('user-name', 'repo-name') { |team| ... }
308
+ # github = Github.new
309
+ # github.repos.teams 'user-name', 'repo-name'
310
+ # github.repos.teams 'user-name', 'repo-name' { |team| ... }
277
311
  #
278
- def teams(user_name=nil, repo_name=nil, params={})
312
+ def teams(user_name, repo_name, params={})
279
313
  _update_user_repo_params(user_name, repo_name)
280
314
  _validate_user_repo_params(user, repo) unless user? && repo?
281
315
  _normalize_params_keys(params)
282
316
 
283
- response = get("/repos/#{user}/#{repo}/teams", params)
317
+ response = get_request("/repos/#{user}/#{repo}/teams", params)
284
318
  return response unless block_given?
285
319
  response.each { |el| yield el }
286
320
  end
@@ -1,81 +1,77 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Github
4
- class Repos
5
- module Collaborators
4
+ class Repos::Collaborators < API
6
5
 
7
- # Add collaborator
8
- #
9
- # Examples:
10
- # @github = Github.new
11
- # @github.collaborators.add_collaborator 'user', 'repo', 'collaborator'
12
- #
13
- # @repos = Github::Repos.new
14
- # @repos.add_collaborator 'user', 'repo', 'collaborator'
15
- #
16
- def add_collaborator(user_name, repo_name, collaborator, params={})
17
- _update_user_repo_params(user_name, repo_name)
18
- _validate_user_repo_params(user, repo) unless user? && repo?
19
- _validate_presence_of collaborator
20
- _normalize_params_keys(params)
6
+ # Add collaborator
7
+ #
8
+ # Examples:
9
+ # github = Github.new
10
+ # github.collaborators.add 'user', 'repo', 'collaborator'
11
+ #
12
+ # collaborators = Github::Repos::Collaborators.new
13
+ # collaborators.add 'user', 'repo', 'collaborator'
14
+ #
15
+ def add(user_name, repo_name, collaborator, params={})
16
+ _update_user_repo_params(user_name, repo_name)
17
+ _validate_user_repo_params(user, repo) unless user? && repo?
18
+ _validate_presence_of collaborator
19
+ _normalize_params_keys(params)
21
20
 
22
- put("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
23
- end
24
- alias :add_collab :add_collaborator
21
+ put_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
22
+ end
23
+ alias :<< :add
25
24
 
26
- # Checks if user is a collaborator for a given repository
27
- #
28
- # Examples:
29
- # @github = Github.new
30
- # @github.collaborators.collaborator?('user', 'repo', 'collaborator')
31
- #
32
- def collaborator?(user_name, repo_name, collaborator, params={})
33
- _update_user_repo_params(user_name, repo_name)
34
- _validate_user_repo_params(user, repo) unless user? && repo?
35
- _validate_presence_of collaborator
36
- _normalize_params_keys(params)
25
+ # Checks if user is a collaborator for a given repository
26
+ #
27
+ # Examples:
28
+ # github = Github.new
29
+ # github.collaborators.collaborator?('user', 'repo', 'collaborator')
30
+ #
31
+ def collaborator?(user_name, repo_name, collaborator, params={})
32
+ _update_user_repo_params(user_name, repo_name)
33
+ _validate_user_repo_params(user, repo) unless user? && repo?
34
+ _validate_presence_of collaborator
35
+ _normalize_params_keys(params)
37
36
 
38
- get("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
39
- true
40
- rescue Github::Error::NotFound
41
- false
42
- end
37
+ get_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
38
+ true
39
+ rescue Github::Error::NotFound
40
+ false
41
+ end
43
42
 
44
- # List collaborators
45
- #
46
- # Examples:
47
- # @github = Github.new
48
- # @github.repos.collaborators 'user-name', 'repo-name'
49
- # @github.repos.collaborators 'user-name', 'repo-name' { |cbr| .. }
50
- #
51
- def collaborators(user_name, repo_name, params={})
52
- _update_user_repo_params(user_name, repo_name)
53
- _validate_user_repo_params(user, repo) unless (user? && repo?)
54
- _normalize_params_keys(params)
43
+ # List collaborators
44
+ #
45
+ # Examples:
46
+ # github = Github.new
47
+ # github.repos.collaborators.list 'user-name', 'repo-name'
48
+ # github.repos.collaborators.list 'user-name', 'repo-name' { |cbr| .. }
49
+ #
50
+ def list(user_name, repo_name, params={})
51
+ _update_user_repo_params(user_name, repo_name)
52
+ _validate_user_repo_params(user, repo) unless (user? && repo?)
53
+ _normalize_params_keys(params)
55
54
 
56
- response = get("/repos/#{user}/#{repo}/collaborators", params)
57
- return response unless block_given?
58
- response.each { |el| yield el }
59
- end
60
- alias :list_collaborators :collaborators
61
- alias :collabs :collaborators
55
+ response = get_request("/repos/#{user}/#{repo}/collaborators", params)
56
+ return response unless block_given?
57
+ response.each { |el| yield el }
58
+ end
59
+ alias :all :list
62
60
 
63
- # Removes collaborator
64
- #
65
- # Examples:
66
- # @github = Github.new
67
- # @github.repos.remove_collaborator 'user', 'repo', 'collaborator'
68
- #
69
- def remove_collaborator(user_name, repo_name, collaborator, params={})
70
- _update_user_repo_params(user_name, repo_name)
71
- _validate_user_repo_params(user, repo) unless user? && repo?
72
- _validate_presence_of collaborator
73
- _normalize_params_keys(params)
61
+ # Removes collaborator
62
+ #
63
+ # Examples:
64
+ # github = Github.new
65
+ # github.repos.collaborators.remove 'user', 'repo', 'collaborator'
66
+ #
67
+ def remove(user_name, repo_name, collaborator, params={})
68
+ _update_user_repo_params(user_name, repo_name)
69
+ _validate_user_repo_params(user, repo) unless user? && repo?
70
+ _validate_presence_of collaborator
71
+ _normalize_params_keys(params)
74
72
 
75
- delete("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
76
- end
77
- alias :remove_collab :remove_collaborator
73
+ delete_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
74
+ end
78
75
 
79
- end # Collaborators
80
- end # Repos
76
+ end # Repos::Collaborators
81
77
  end # Github