octokit 3.1.2 → 3.2.0

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.
@@ -8,7 +8,7 @@ module Octokit
8
8
 
9
9
  # Get an organization
10
10
  #
11
- # @param org [String] Organization GitHub username.
11
+ # @param org [String, Integer] Organization GitHub login or id.
12
12
  # @return [Sawyer::Resource] Hash representing GitHub organization.
13
13
  # @see https://developer.github.com/v3/orgs/#get-an-organization
14
14
  # @example
@@ -16,7 +16,7 @@ module Octokit
16
16
  # @example
17
17
  # Octokit.org('github')
18
18
  def organization(org, options = {})
19
- get "orgs/#{org}", options
19
+ get Organization.path(org), options
20
20
  end
21
21
  alias :org :organization
22
22
 
@@ -24,7 +24,7 @@ module Octokit
24
24
  #
25
25
  # Requires authenticated client with proper organization permissions.
26
26
  #
27
- # @param org [String] Organization GitHub username.
27
+ # @param org [String, Integer] Organization GitHub login or id.
28
28
  # @param values [Hash] The updated organization attributes.
29
29
  # @option values [String] :billing_email Billing email address. This address is not publicized.
30
30
  # @option values [String] :company Company name.
@@ -44,7 +44,7 @@ module Octokit
44
44
  # @example
45
45
  # @client.update_org('github', {:company => 'Unicorns, Inc.'})
46
46
  def update_organization(org, values, options = {})
47
- patch "orgs/#{org}", options.merge({:organization => values})
47
+ patch Organization.path(org), options.merge({:organization => values})
48
48
  end
49
49
  alias :update_org :update_organization
50
50
 
@@ -59,7 +59,8 @@ module Octokit
59
59
  # Calling this method on a `@client` will return that users organizations.
60
60
  # Private organizations are included only if the `@client` is authenticated.
61
61
  #
62
- # @param user [String] Username of the user to get list of organizations.
62
+ # @param user [Integer, String] GitHub user login or id of the user to get
63
+ # list of organizations.
63
64
  # @return [Array<Sawyer::Resource>] Array of hashes representing organizations.
64
65
  # @see https://developer.github.com/v3/orgs/#list-user-organizations
65
66
  # @example
@@ -75,11 +76,7 @@ module Octokit
75
76
  # @example
76
77
  # @client.organizations
77
78
  def organizations(user=nil, options = {})
78
- if user
79
- get "users/#{user}/orgs", options
80
- else
81
- get "user/orgs", options
82
- end
79
+ get "#{User.path user}/orgs", options
83
80
  end
84
81
  alias :list_organizations :organizations
85
82
  alias :list_orgs :organizations
@@ -90,7 +87,8 @@ module Octokit
90
87
  # Public repositories are available without authentication. Private repos
91
88
  # require authenticated organization member.
92
89
  #
93
- # @param org [String] Organization handle for which to list repos
90
+ # @param org [String, Integer] Organization GitHub login or id for which
91
+ # to list repos.
94
92
  # @option options [String] :type ('all') Filter by repository type.
95
93
  # `all`, `public`, `member`, `sources`, `forks`, or `private`.
96
94
  #
@@ -105,7 +103,7 @@ module Octokit
105
103
  # @example
106
104
  # @client.org_repos('github', {:type => 'private'})
107
105
  def organization_repositories(org, options = {})
108
- paginate "orgs/#{org}/repos", options
106
+ paginate "#{Organization.path org}/repos", options
109
107
  end
110
108
  alias :org_repositories :organization_repositories
111
109
  alias :org_repos :organization_repositories
@@ -116,7 +114,7 @@ module Octokit
116
114
  # authenticated client that is a member of the GitHub organization
117
115
  # is required to get private members.
118
116
  #
119
- # @param org [String] Organization GitHub username.
117
+ # @param org [String, Integer] Organization GitHub login or id.
120
118
  # @return [Array<Sawyer::Resource>] Array of hashes representing users.
121
119
  # @see https://developer.github.com/v3/orgs/members/#members-list
122
120
  # @example
@@ -125,7 +123,7 @@ module Octokit
125
123
  # Octokit.org_members('github')
126
124
  def organization_members(org, options = {})
127
125
  path = "public_" if options.delete(:public)
128
- paginate "orgs/#{org}/#{path}members", options
126
+ paginate "#{Organization.path org}/#{path}members", options
129
127
  end
130
128
  alias :org_members :organization_members
131
129
 
@@ -151,7 +149,7 @@ module Octokit
151
149
  # you are a member. If you are not in the organization you are checking,
152
150
  # use .organization_public_member? instead.
153
151
  #
154
- # @param org [String] Organization GitHub username.
152
+ # @param org [String, Integer] Organization GitHub login or id.
155
153
  # @param user [String] GitHub username of the user to check.
156
154
  #
157
155
  # @return [Boolean] Is a member?
@@ -162,7 +160,7 @@ module Octokit
162
160
  # @client.organization_member?('your_organization', 'pengwynn')
163
161
  # => false
164
162
  def organization_member?(org, user, options = {})
165
- result = boolean_from_response(:get, "orgs/#{org}/members/#{user}", options)
163
+ result = boolean_from_response(:get, "#{Organization.path org}/members/#{user}", options)
166
164
  if !result && last_response && last_response.status == 302
167
165
  boolean_from_response :get, last_response.headers['Location']
168
166
  else
@@ -176,7 +174,7 @@ module Octokit
176
174
  # If you are checking for membership of a user of an organization that
177
175
  # you are in, use .organization_member? instead.
178
176
  #
179
- # @param org [String] Organization GitHub username.
177
+ # @param org [String, Integer] Organization GitHub login or id.
180
178
  # @param user [String] GitHub username of the user to check.
181
179
  #
182
180
  # @return [Boolean] Is a public member?
@@ -187,7 +185,7 @@ module Octokit
187
185
  # @client.organization_public_member?('github', 'pengwynn')
188
186
  # => true
189
187
  def organization_public_member?(org, user, options = {})
190
- boolean_from_response :get, "orgs/#{org}/public_members/#{user}", options
188
+ boolean_from_response :get, "#{Organization.path org}/public_members/#{user}", options
191
189
  end
192
190
  alias :org_public_member? :organization_public_member?
193
191
 
@@ -195,7 +193,7 @@ module Octokit
195
193
  #
196
194
  # Requires authenticated organization member.
197
195
  #
198
- # @param org [String] Organization GitHub username.
196
+ # @param org [String, Integer] Organization GitHub login or id.
199
197
  # @return [Array<Sawyer::Resource>] Array of hashes representing teams.
200
198
  # @see https://developer.github.com/v3/orgs/teams/#list-teams
201
199
  # @example
@@ -203,7 +201,7 @@ module Octokit
203
201
  # @example
204
202
  # @client.org_teams('github')
205
203
  def organization_teams(org, options = {})
206
- paginate "orgs/#{org}/teams", options
204
+ paginate "#{Organization.path org}/teams", options
207
205
  end
208
206
  alias :org_teams :organization_teams
209
207
 
@@ -211,7 +209,7 @@ module Octokit
211
209
  #
212
210
  # Requires authenticated organization owner.
213
211
  #
214
- # @param org [String] Organization GitHub username.
212
+ # @param org [String, Integer] Organization GitHub login or id.
215
213
  # @option options [String] :name Team name.
216
214
  # @option options [Array<String>] :repo_names Repositories for the team.
217
215
  # @option options [String, optional] :permission ('pull') Permissions the
@@ -229,7 +227,7 @@ module Octokit
229
227
  # :permission => 'push'
230
228
  # })
231
229
  def create_team(org, options = {})
232
- post "orgs/#{org}/teams", options
230
+ post "#{Organization.path org}/teams", options
233
231
  end
234
232
 
235
233
  # Get team
@@ -422,7 +420,7 @@ module Octokit
422
420
  #
423
421
  # Requires authenticated organization owner or member with team `admin` access.
424
422
  #
425
- # @param org [String] Organization GitHub username.
423
+ # @param org [String, Integer] Organization GitHub login or id.
426
424
  # @param user [String] GitHub username of user to remove.
427
425
  # @return [Boolean] True if removal is successful, false otherwise.
428
426
  # @see https://developer.github.com/v3/orgs/members/#remove-a-member
@@ -433,7 +431,7 @@ module Octokit
433
431
  def remove_organization_member(org, user, options = {})
434
432
  # this is a synonym for: for team in org.teams: remove_team_member(team.id, user)
435
433
  # provided in the GH API v3
436
- boolean_from_response :delete, "orgs/#{org}/members/#{user}", options
434
+ boolean_from_response :delete, "#{Organization.path org}/members/#{user}", options
437
435
  end
438
436
  alias :remove_org_member :remove_organization_member
439
437
 
@@ -441,21 +439,21 @@ module Octokit
441
439
  #
442
440
  # Requires authenticated organization owner.
443
441
  #
444
- # @param org [String] Organization GitHub username.
442
+ # @param org [String, Integer] Organization GitHub login or id.
445
443
  # @param user [String] GitHub username of user to publicize.
446
444
  # @return [Boolean] True if publicization successful, false otherwise.
447
445
  # @see https://developer.github.com/v3/orgs/members/#publicize-a-users-membership
448
446
  # @example
449
447
  # @client.publicize_membership('github', 'pengwynn')
450
448
  def publicize_membership(org, user, options = {})
451
- boolean_from_response :put, "orgs/#{org}/public_members/#{user}", options
449
+ boolean_from_response :put, "#{Organization.path org}/public_members/#{user}", options
452
450
  end
453
451
 
454
452
  # Conceal a user's membership of an organization.
455
453
  #
456
454
  # Requires authenticated organization owner.
457
455
  #
458
- # @param org [String] Organization GitHub username.
456
+ # @param org [String, Integer] Organization GitHub login or id.
459
457
  # @param user [String] GitHub username of user to unpublicize.
460
458
  # @return [Boolean] True of unpublicization successful, false otherwise.
461
459
  # @see https://developer.github.com/v3/orgs/members/#conceal-a-users-membership
@@ -464,7 +462,7 @@ module Octokit
464
462
  # @example
465
463
  # @client.conceal_membership('github', 'pengwynn')
466
464
  def unpublicize_membership(org, user, options = {})
467
- boolean_from_response :delete, "orgs/#{org}/public_members/#{user}", options
465
+ boolean_from_response :delete, "#{Organization.path org}/public_members/#{user}", options
468
466
  end
469
467
  alias :conceal_membership :unpublicize_membership
470
468
 
@@ -8,30 +8,30 @@ module Octokit
8
8
 
9
9
  # List Pages information for a repository
10
10
  #
11
- # @param repo [String, Repository, Hash] A GitHub repository
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
12
  # @return Sawyer::Resource A GitHub Pages resource
13
13
  # @see https://developer.github.com/v3/repos/pages/#get-information-about-a-pages-site
14
14
  def pages(repo, options = {})
15
- get "repos/#{Repository.new(repo)}/pages", options
15
+ get "#{Repository.path repo}/pages", options
16
16
  end
17
17
 
18
18
  # List Pages builds for a repository
19
19
  #
20
- # @param repo [String, Repository, Hash] A GitHub repository
20
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
21
21
  # @return [Array<Sawyer::Resource>] A list of build history for a repository.
22
22
  # @see https://developer.github.com/v3/repos/pages/#list-pages-builds
23
23
  def pages_builds(repo, options = {})
24
- get "repos/#{Repository.new(repo)}/pages/builds", options
24
+ get "#{Repository.path repo}/pages/builds", options
25
25
  end
26
26
  alias :list_pages_builds :pages_builds
27
27
 
28
28
  # List the latest Pages build information for a repository
29
29
  #
30
- # @param repo [String, Repository, Hash] A GitHub repository
30
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
31
31
  # @return Sawyer::Resource A GitHub Pages resource about a build
32
32
  # @see https://developer.github.com/v3/repos/pages/#list-latest-pages-build
33
33
  def latest_pages_build(repo, options = {})
34
- get "repos/#{Repository.new(repo)}/pages/builds/latest", options
34
+ get "#{Repository.path repo}/pages/builds/latest", options
35
35
  end
36
36
  end
37
37
  end
@@ -9,12 +9,12 @@ module Octokit
9
9
  # List pull requests for a repository
10
10
  #
11
11
  # @overload pull_requests(repo, options)
12
- # @param repo [String, Hash, Repository] A GitHub repository
12
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
13
13
  # @param options [Hash] Method options
14
14
  # @option options [String] :state `open` or `closed`.
15
15
  # @overload pull_requests(repo, state, options)
16
16
  # @deprecated
17
- # @param repo [String, Hash, Repository] A GitHub repository
17
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
18
18
  # @param state [String] `open` or `closed`.
19
19
  # @param options [Hash] Method options
20
20
  # @return [Array<Sawyer::Resource>] Array of pulls
@@ -29,25 +29,25 @@ module Octokit
29
29
  octokit_warn "DEPRECATED: Client#pull_requests: Passing state as positional argument is deprecated. Please use :state => '#{state}'"
30
30
  opts[:state] = state if state
31
31
  end
32
- paginate "repos/#{Repository.new(repo)}/pulls", opts
32
+ paginate "#{Repository.path repo}/pulls", opts
33
33
  end
34
34
  alias :pulls :pull_requests
35
35
 
36
36
  # Get a pull request
37
37
  #
38
38
  # @see https://developer.github.com/v3/pulls/#get-a-single-pull-request
39
- # @param repo [String, Hash, Repository] A GitHub repository
39
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
40
40
  # @param number [Integer] Number of the pull request to fetch
41
41
  # @return [Sawyer::Resource] Pull request info
42
42
  def pull_request(repo, number, options = {})
43
- get "repos/#{Repository.new(repo)}/pulls/#{number}", options
43
+ get "#{Repository.path repo}/pulls/#{number}", options
44
44
  end
45
45
  alias :pull :pull_request
46
46
 
47
47
  # Create a pull request
48
48
  #
49
49
  # @see https://developer.github.com/v3/pulls/#create-a-pull-request
50
- # @param repo [String, Hash, Repository] A GitHub repository
50
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
51
51
  # @param base [String] The branch (or git ref) you want your changes
52
52
  # pulled into. This should be an existing branch on the current
53
53
  # repository. You cannot submit a pull request to one repo that requests
@@ -63,13 +63,13 @@ module Octokit
63
63
  :title => title,
64
64
  :body => body,
65
65
  }
66
- post "repos/#{Repository.new(repo)}/pulls", options.merge(pull)
66
+ post "#{Repository.path repo}/pulls", options.merge(pull)
67
67
  end
68
68
 
69
69
  # Create a pull request from existing issue
70
70
  #
71
71
  # @see https://developer.github.com/v3/pulls/#alternative-input
72
- # @param repo [String, Hash, Repository] A GitHub repository
72
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
73
73
  # @param base [String] The branch (or git ref) you want your changes
74
74
  # pulled into. This should be an existing branch on the current
75
75
  # repository. You cannot submit a pull request to one repo that requests
@@ -83,19 +83,19 @@ module Octokit
83
83
  :head => head,
84
84
  :issue => issue
85
85
  }
86
- post "repos/#{Repository.new(repo)}/pulls", options.merge(pull)
86
+ post "#{Repository.path repo}/pulls", options.merge(pull)
87
87
  end
88
88
 
89
89
  # Update a pull request
90
90
  # @overload update_pull_request(repo, id, title=nil, body=nil, state=nil, options = {})
91
91
  # @deprecated
92
- # @param repo [String, Hash, Repository] A GitHub repository.
92
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository.
93
93
  # @param number [Integer] Number of pull request to update.
94
94
  # @param title [String] Title for the pull request.
95
95
  # @param body [String] Body content for pull request. Supports GFM.
96
96
  # @param state [String] State of the pull request. `open` or `closed`.
97
97
  # @overload update_pull_request(repo, id, options = {})
98
- # @param repo [String, Hash, Repository] A GitHub repository.
98
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository.
99
99
  # @param number [Integer] Number of pull request to update.
100
100
  # @option options [String] :title Title for the pull request.
101
101
  # @option options [String] :body Body for the pull request.
@@ -112,12 +112,12 @@ module Octokit
112
112
  arguments = Octokit::Arguments.new(args)
113
113
  repo = arguments.shift
114
114
  number = arguments.shift
115
- patch "repos/#{Repository.new(repo)}/pulls/#{number}", arguments.options
115
+ patch "#{Repository.path repo}/pulls/#{number}", arguments.options
116
116
  end
117
117
 
118
118
  # Close a pull request
119
119
  #
120
- # @param repo [String, Hash, Repository] A GitHub repository.
120
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository.
121
121
  # @param number [Integer] Number of pull request to update.
122
122
  # @return [Sawyer::Resource] Hash representing updated pull request.
123
123
  # @see https://developer.github.com/v3/pulls/#update-a-pull-request
@@ -131,11 +131,11 @@ module Octokit
131
131
  # List commits on a pull request
132
132
  #
133
133
  # @see https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
134
- # @param repo [String, Hash, Repository] A GitHub repository
134
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
135
135
  # @param number [Integer] Number of pull request
136
136
  # @return [Array<Sawyer::Resource>] List of commits
137
137
  def pull_request_commits(repo, number, options = {})
138
- paginate "repos/#{Repository.new(repo)}/pulls/#{number}/commits", options
138
+ paginate "#{Repository.path repo}/pulls/#{number}/commits", options
139
139
  end
140
140
  alias :pull_commits :pull_request_commits
141
141
 
@@ -143,7 +143,7 @@ module Octokit
143
143
  #
144
144
  # By default, Review Comments are ordered by ascending ID.
145
145
  #
146
- # @param repo [String, Repository, Hash] A GitHub repository
146
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
147
147
  # @param options [Hash] Optional parameters
148
148
  # @option options [String] :sort created or updated
149
149
  # @option options [String] :direction asc or desc. Ignored without sort
@@ -165,41 +165,41 @@ module Octokit
165
165
  # :since => '2010-05-04T23:45:02Z'
166
166
  # })
167
167
  def pull_requests_comments(repo, options = {})
168
- get("repos/#{Repository.new(repo)}/pulls/comments", options)
168
+ get("#{Repository.path repo}/pulls/comments", options)
169
169
  end
170
170
  alias :pulls_comments :pull_requests_comments
171
171
  alias :reviews_comments :pull_requests_comments
172
172
 
173
173
  # List comments on a pull request
174
174
  #
175
- # @see https://developer.github.com/v3/pulls/#list-comments-on-a-pull-request
176
- # @param repo [String, Hash, Repository] A GitHub repository
175
+ # @see https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
176
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
177
177
  # @param number [Integer] Number of pull request
178
178
  # @return [Array<Sawyer::Resource>] List of comments
179
179
  def pull_request_comments(repo, number, options = {})
180
180
  # return the comments for a pull request
181
- get "repos/#{Repository.new(repo)}/pulls/#{number}/comments", options
181
+ get "#{Repository.path repo}/pulls/#{number}/comments", options
182
182
  end
183
183
  alias :pull_comments :pull_request_comments
184
184
  alias :review_comments :pull_request_comments
185
185
 
186
186
  # Get a pull request comment
187
187
  #
188
- # @param repo [String, Hash, Repository] A GitHub repository
188
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
189
189
  # @param comment_id [Integer] Id of comment to get
190
190
  # @return [Sawyer::Resource] Hash representing the comment
191
191
  # @see https://developer.github.com/v3/pulls/comments/#get-a-single-comment
192
192
  # @example
193
193
  # @client.pull_request_comment("pengwynn/octkit", 1903950)
194
194
  def pull_request_comment(repo, comment_id, options = {})
195
- get "repos/#{Repository.new(repo)}/pulls/comments/#{comment_id}", options
195
+ get "#{Repository.path repo}/pulls/comments/#{comment_id}", options
196
196
  end
197
197
  alias :pull_comment :pull_request_comment
198
198
  alias :review_comment :pull_request_comment
199
199
 
200
200
  # Create a pull request comment
201
201
  #
202
- # @param repo [String, Hash, Repository] A GitHub repository
202
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
203
203
  # @param pull_id [Integer] Pull request id
204
204
  # @param body [String] Comment content
205
205
  # @param commit_id [String] Sha of the commit to comment on.
@@ -217,14 +217,14 @@ module Octokit
217
217
  :path => path,
218
218
  :position => position
219
219
  })
220
- post "repos/#{Repository.new(repo)}/pulls/#{pull_id}/comments", options
220
+ post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
221
221
  end
222
222
  alias :create_pull_comment :create_pull_request_comment
223
223
  alias :create_view_comment :create_pull_request_comment
224
224
 
225
225
  # Create reply to a pull request comment
226
226
  #
227
- # @param repo [String, Hash, Repository] A GitHub repository
227
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
228
228
  # @param pull_id [Integer] Pull request id
229
229
  # @param body [String] Comment contents
230
230
  # @param comment_id [Integer] Comment id to reply to
@@ -237,14 +237,14 @@ module Octokit
237
237
  :body => body,
238
238
  :in_reply_to => comment_id
239
239
  })
240
- post "repos/#{Repository.new(repo)}/pulls/#{pull_id}/comments", options
240
+ post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
241
241
  end
242
242
  alias :create_pull_reply :create_pull_request_comment_reply
243
243
  alias :create_review_reply :create_pull_request_comment_reply
244
244
 
245
245
  # Update pull request comment
246
246
  #
247
- # @param repo [String, Hash, Repository] A GitHub repository
247
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
248
248
  # @param comment_id [Integer] Id of the comment to update
249
249
  # @param body [String] Updated comment content
250
250
  # @return [Sawyer::Resource] Hash representing the updated comment
@@ -253,21 +253,21 @@ module Octokit
253
253
  # @client.update_pull_request_comment("octokit/octokit.rb", 1903950, ":shipit:")
254
254
  def update_pull_request_comment(repo, comment_id, body, options = {})
255
255
  options.merge! :body => body
256
- patch("repos/#{Repository.new(repo)}/pulls/comments/#{comment_id}", options)
256
+ patch("#{Repository.path repo}/pulls/comments/#{comment_id}", options)
257
257
  end
258
258
  alias :update_pull_comment :update_pull_request_comment
259
259
  alias :update_review_comment :update_pull_request_comment
260
260
 
261
261
  # Delete pull request comment
262
262
  #
263
- # @param repo [String, Hash, Repository] A GitHub repository
263
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
264
264
  # @param comment_id [Integer] Id of the comment to delete
265
265
  # @return [Boolean] True if deleted, false otherwise
266
266
  # @see https://developer.github.com/v3/pulls/comments/#delete-a-comment
267
267
  # @example
268
268
  # @client.delete_pull_request_comment("octokit/octokit.rb", 1902707)
269
269
  def delete_pull_request_comment(repo, comment_id, options = {})
270
- boolean_from_response(:delete, "repos/#{Repository.new(repo)}/pulls/comments/#{comment_id}", options)
270
+ boolean_from_response(:delete, "#{Repository.path repo}/pulls/comments/#{comment_id}", options)
271
271
  end
272
272
  alias :delete_pull_comment :delete_pull_request_comment
273
273
  alias :delete_review_comment :delete_pull_request_comment
@@ -275,33 +275,33 @@ module Octokit
275
275
  # List files on a pull request
276
276
  #
277
277
  # @see https://developer.github.com/v3/pulls/#list-pull-requests-files
278
- # @param repo [String, Hash, Repository] A GitHub repository
278
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
279
279
  # @param number [Integer] Number of pull request
280
280
  # @return [Array<Sawyer::Resource>] List of files
281
281
  def pull_request_files(repo, number, options = {})
282
- paginate "repos/#{Repository.new(repo)}/pulls/#{number}/files", options
282
+ paginate "#{Repository.path repo}/pulls/#{number}/files", options
283
283
  end
284
284
  alias :pull_files :pull_request_files
285
285
 
286
286
  # Merge a pull request
287
287
  #
288
288
  # @see https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
289
- # @param repo [String, Hash, Repository] A GitHub repository
289
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
290
290
  # @param number [Integer] Number of pull request
291
291
  # @param commit_message [String] Optional commit message for the merge commit
292
292
  # @return [Array<Sawyer::Resource>] Merge commit info if successful
293
293
  def merge_pull_request(repo, number, commit_message='', options = {})
294
- put "repos/#{Repository.new(repo)}/pulls/#{number}/merge", options.merge({:commit_message => commit_message})
294
+ put "#{Repository.path repo}/pulls/#{number}/merge", options.merge({:commit_message => commit_message})
295
295
  end
296
296
 
297
297
  # Check pull request merge status
298
298
  #
299
299
  # @see https://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
300
- # @param repo [String, Hash, Repository] A GitHub repository
300
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
301
301
  # @param number [Integer] Number of pull request
302
302
  # @return [Boolean] True if the pull request has been merged
303
303
  def pull_merged?(repo, number, options = {})
304
- boolean_from_response :get, "repos/#{Repository.new(repo)}/pulls/#{number}/merge", options
304
+ boolean_from_response :get, "#{Repository.path repo}/pulls/#{number}/merge", options
305
305
  end
306
306
  alias :pull_request_merged? :pull_merged?
307
307