github_api 0.4.11 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +76 -72
- data/features/cassettes/gists/starred.yml +48 -0
- data/features/cassettes/pagination/repos/commits/list.yml +193 -0
- data/features/cassettes/pagination/repos/commits/next.yml +183 -0
- data/features/cassettes/pagination/repos/diff/next.yml +45 -0
- data/features/cassettes/pagination/repos/list.yml +176 -0
- data/features/cassettes/pagination/repos/list/next.yml +222 -0
- data/features/cassettes/pagination/repos/per_page/each_page.yml +45 -0
- data/features/cassettes/repos/list.yml +92 -0
- data/features/error_codes.feature +1 -1
- data/features/gists.feature +12 -3
- data/features/gists/comments.feature +3 -3
- data/features/github_api.feature +13 -2
- data/features/pagination.feature +40 -39
- data/features/repos.feature +2 -2
- data/features/step_definitions/common_steps.rb +12 -0
- data/features/step_definitions/github_api_steps.rb +12 -1
- data/lib/github_api.rb +1 -1
- data/lib/github_api/api.rb +4 -2
- data/lib/github_api/api_factory.rb +11 -5
- data/lib/github_api/authorizations.rb +23 -32
- data/lib/github_api/client.rb +1 -0
- data/lib/github_api/events.rb +38 -38
- data/lib/github_api/filter.rb +1 -1
- data/lib/github_api/gists.rb +47 -42
- data/lib/github_api/gists/comments.rb +77 -84
- data/lib/github_api/git_data.rb +25 -6
- data/lib/github_api/git_data/blobs.rb +48 -45
- data/lib/github_api/git_data/commits.rb +76 -73
- data/lib/github_api/git_data/references.rb +137 -118
- data/lib/github_api/git_data/tags.rb +74 -70
- data/lib/github_api/git_data/trees.rb +88 -85
- data/lib/github_api/issues.rb +43 -31
- data/lib/github_api/issues/comments.rb +116 -119
- data/lib/github_api/issues/events.rb +20 -19
- data/lib/github_api/issues/labels.rb +200 -197
- data/lib/github_api/issues/milestones.rb +137 -134
- data/lib/github_api/orgs.rb +27 -23
- data/lib/github_api/orgs/members.rb +105 -108
- data/lib/github_api/orgs/teams.rb +236 -237
- data/lib/github_api/paged_request.rb +1 -1
- data/lib/github_api/pull_requests.rb +40 -42
- data/lib/github_api/pull_requests/comments.rb +140 -143
- data/lib/github_api/repos.rb +101 -67
- data/lib/github_api/repos/collaborators.rb +64 -68
- data/lib/github_api/repos/commits.rb +50 -39
- data/lib/github_api/repos/downloads.rb +107 -110
- data/lib/github_api/repos/forks.rb +38 -39
- data/lib/github_api/repos/hooks.rb +161 -167
- data/lib/github_api/repos/keys.rb +86 -86
- data/lib/github_api/repos/pub_sub_hubbub.rb +99 -87
- data/lib/github_api/repos/watching.rb +80 -82
- data/lib/github_api/request.rb +5 -9
- data/lib/github_api/users.rb +26 -16
- data/lib/github_api/users/emails.rb +47 -47
- data/lib/github_api/users/followers.rb +85 -86
- data/lib/github_api/users/keys.rb +73 -75
- data/lib/github_api/validations.rb +25 -0
- data/lib/github_api/validations/format.rb +23 -0
- data/lib/github_api/validations/presence.rb +25 -0
- data/lib/github_api/validations/required.rb +21 -0
- data/lib/github_api/validations/token.rb +41 -0
- data/lib/github_api/version.rb +3 -3
- data/spec/fixtures/repos/commit_comparison.json +112 -0
- data/spec/github/api_factory_spec.rb +17 -1
- data/spec/github/authorizations_spec.rb +36 -34
- data/spec/github/gists/comments_spec.rb +39 -45
- data/spec/github/gists_spec.rb +50 -53
- data/spec/github/git_data/blobs_spec.rb +27 -20
- data/spec/github/git_data/commits_spec.rb +20 -19
- data/spec/github/git_data/references_spec.rb +83 -46
- data/spec/github/git_data/tags_spec.rb +16 -15
- data/spec/github/git_data/trees_spec.rb +20 -19
- data/spec/github/git_data_spec.rb +10 -1
- data/spec/github/issues/comments_spec.rb +78 -68
- data/spec/github/issues/events_spec.rb +42 -34
- data/spec/github/issues/labels_spec.rb +89 -101
- data/spec/github/issues/milestones_spec.rb +76 -54
- data/spec/github/issues_spec.rb +53 -57
- data/spec/github/orgs/members_spec.rb +64 -49
- data/spec/github/orgs/teams_spec.rb +112 -101
- data/spec/github/orgs_spec.rb +41 -31
- data/spec/github/paged_request_spec.rb +6 -5
- data/spec/github/pull_requests/comments_spec.rb +39 -44
- data/spec/github/pull_requests_spec.rb +32 -48
- data/spec/github/repos/collaborators_spec.rb +40 -29
- data/spec/github/repos/commits_spec.rb +108 -64
- data/spec/github/repos/downloads_spec.rb +46 -45
- data/spec/github/repos/forks_spec.rb +23 -24
- data/spec/github/repos/hooks_spec.rb +69 -71
- data/spec/github/repos/keys_spec.rb +39 -34
- data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -4
- data/spec/github/repos/watching_spec.rb +31 -33
- data/spec/github/repos_spec.rb +74 -83
- data/spec/github/request_spec.rb +31 -2
- data/spec/github/users/emails_spec.rb +19 -17
- data/spec/github/users/followers_spec.rb +30 -28
- data/spec/github/users/keys_spec.rb +37 -33
- data/spec/github/users_spec.rb +124 -125
- data/spec/github/validations/format_spec.rb +42 -0
- data/spec/github/validations/presence_spec.rb +18 -0
- data/spec/github/validations/required_spec.rb +28 -0
- data/spec/github/validations/token_spec.rb +19 -0
- data/spec/github/validations_spec.rb +23 -0
- metadata +33 -10
- data/features/cassettes/pagination/repos.yml +0 -177
- data/features/cassettes/pagination/repos/next.yml +0 -177
- data/lib/github_api/validation.rb +0 -53
- data/spec/github/validation_spec.rb +0 -62
data/lib/github_api/repos.rb
CHANGED
@@ -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
|
-
#
|
57
|
-
#
|
88
|
+
# github = Github.new
|
89
|
+
# github.repos.branches 'user-name', 'repo-name'
|
58
90
|
#
|
59
|
-
#
|
60
|
-
#
|
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 =
|
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
|
-
#
|
86
|
-
#
|
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
|
-
#
|
99
|
-
#
|
132
|
+
# github = Github.new :oauth_token => '...'
|
133
|
+
# github.repos.create :name => 'repo-name', :org => 'organisation-name'
|
100
134
|
#
|
101
|
-
def
|
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
|
-
|
148
|
+
post_request("/orgs/#{org}/repos", DEFAULT_REPO_OPTIONS.merge(params))
|
115
149
|
else
|
116
|
-
|
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
|
-
#
|
129
|
-
#
|
130
|
-
#
|
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
|
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 =
|
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
|
-
#
|
159
|
-
#
|
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
|
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
|
-
|
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
|
-
#
|
180
|
-
#
|
215
|
+
# github = Github.new
|
216
|
+
# github.repos.get 'user-name', 'repo-name'
|
181
217
|
#
|
182
|
-
def
|
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
|
-
|
223
|
+
get_request("/repos/#{user}/#{repo}", params)
|
188
224
|
end
|
189
|
-
alias :
|
190
|
-
|
225
|
+
alias :find :get
|
191
226
|
|
192
227
|
# List languages
|
193
228
|
#
|
194
229
|
# = Examples
|
195
|
-
#
|
196
|
-
#
|
197
|
-
#
|
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
|
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 =
|
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
|
-
#
|
214
|
-
#
|
215
|
-
#
|
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.
|
222
|
-
# github.repos.
|
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
|
-
#
|
228
|
-
#
|
229
|
-
#
|
262
|
+
# github = Github.new
|
263
|
+
# github.repos.list :org => 'org-name'
|
264
|
+
# github.repos.list :org => 'org-name', { |repo| ... }
|
230
265
|
#
|
231
|
-
def
|
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
|
-
|
273
|
+
get_request("/users/#{user_name}/repos", params)
|
239
274
|
elsif (org_name = params.delete("org"))
|
240
|
-
|
275
|
+
get_request("/orgs/#{org_name}/repos", params)
|
241
276
|
else
|
242
277
|
# For authenticated user
|
243
|
-
|
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 :
|
249
|
-
alias :list_repositories :repos
|
283
|
+
alias :all :list
|
250
284
|
|
251
285
|
# List tags
|
252
286
|
#
|
253
287
|
# = Examples
|
254
|
-
#
|
255
|
-
#
|
256
|
-
#
|
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
|
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 =
|
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
|
-
#
|
275
|
-
#
|
276
|
-
#
|
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
|
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 =
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
21
|
+
put_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
|
22
|
+
end
|
23
|
+
alias :<< :add
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
get_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
|
38
|
+
true
|
39
|
+
rescue Github::Error::NotFound
|
40
|
+
false
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
76
|
-
|
77
|
-
alias :remove_collab :remove_collaborator
|
73
|
+
delete_request("/repos/#{user}/#{repo}/collaborators/#{collaborator}", params)
|
74
|
+
end
|
78
75
|
|
79
|
-
|
80
|
-
end # Repos
|
76
|
+
end # Repos::Collaborators
|
81
77
|
end # Github
|