octokit 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f72cdeb9fbffb817b2077f5bfde2c2c58e1dcbb
4
- data.tar.gz: a3d4f0d9868bf8b4d7fbcd9474165e1c20b6a549
3
+ metadata.gz: b3223500f5c72b31326d1cf845c6b7a17b6358da
4
+ data.tar.gz: e71c06f9715dacf80ee5b733a2b43a5d592fa76f
5
5
  SHA512:
6
- metadata.gz: 5c307f0ae66aab040bb0a404f358dc7f49ae948c3f1a07a463870f62c9bd182fec340bffeb534e2e5c6ea680887456d7395e5e93349f975e1ce8906961b77401
7
- data.tar.gz: 2b6e8309bb74397136462e0d3528d05485c672389cda723ac19de02fa6797817ed582e6d48d10dbdc3e010ac23c830175bcf16a8806187b6d15c981d27f6aa21
6
+ metadata.gz: 1af6f44b0cfa14e334246c6ea2584018c6e82abd559d76fe2a51bb046745fd523379fc62fc9a1fe83f5c00410d5f7267df03edef34ce097616dc26331a76719f
7
+ data.tar.gz: 6c08989ec80a29df2f5bd79fe093c85a8245d97e6bd716cf3fc6480ee1f783b848cbb7ed2560a7d4b3c221bd6f3d7375b58f766a1e4c777f2969999c9d9eff58
@@ -6,6 +6,8 @@ require 'octokit/authentication'
6
6
  require 'octokit/gist'
7
7
  require 'octokit/rate_limit'
8
8
  require 'octokit/repository'
9
+ require 'octokit/user'
10
+ require 'octokit/organization'
9
11
  require 'octokit/client/authorizations'
10
12
  require 'octokit/client/commits'
11
13
  require 'octokit/client/commit_comments'
@@ -8,36 +8,36 @@ module Octokit
8
8
 
9
9
  # List all commit comments
10
10
  #
11
- # @param repo [String, Hash, Repository] A GitHub repository
11
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
12
12
  # @return [Array] List of commit comments
13
13
  # @see https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
14
14
  def list_commit_comments(repo, options = {})
15
- get "repos/#{Repository.new(repo)}/comments", options
15
+ get "#{Repository.path repo}/comments", options
16
16
  end
17
17
 
18
18
  # List comments for a single commit
19
19
  #
20
- # @param repo [String, Hash, Repository] A GitHub repository
20
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
21
21
  # @param sha [String] The SHA of the commit whose comments will be fetched
22
22
  # @return [Array] List of commit comments
23
23
  # @see https://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
24
24
  def commit_comments(repo, sha, options = {})
25
- get "repos/#{Repository.new(repo)}/commits/#{sha}/comments", options
25
+ get "#{Repository.path repo}/commits/#{sha}/comments", options
26
26
  end
27
27
 
28
28
  # Get a single commit comment
29
29
  #
30
- # @param repo [String, Hash, Repository] A GitHub repository
30
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
31
31
  # @param id [String] The ID of the comment to fetch
32
32
  # @return [Sawyer::Resource] Commit comment
33
33
  # @see https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
34
34
  def commit_comment(repo, id, options = {})
35
- get "repos/#{Repository.new(repo)}/comments/#{id}", options
35
+ get "#{Repository.path repo}/comments/#{id}", options
36
36
  end
37
37
 
38
38
  # Create a commit comment
39
39
  #
40
- # @param repo [String, Hash, Repository] A GitHub repository
40
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
41
41
  # @param sha [String] Sha of the commit to comment on
42
42
  # @param body [String] Message
43
43
  # @param path [String] Relative path of file to comment on
@@ -60,12 +60,12 @@ module Octokit
60
60
  :line => line,
61
61
  :position => position
62
62
  }
63
- post "repos/#{Repository.new(repo)}/commits/#{sha}/comments", options.merge(params)
63
+ post "#{Repository.path repo}/commits/#{sha}/comments", options.merge(params)
64
64
  end
65
65
 
66
66
  # Update a commit comment
67
67
  #
68
- # @param repo [String, Hash, Repository] A GitHub repository
68
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
69
69
  # @param id [String] The ID of the comment to update
70
70
  # @param body [String] Message
71
71
  # @return [Sawyer::Resource] Updated commit comment
@@ -78,17 +78,17 @@ module Octokit
78
78
  params = {
79
79
  :body => body
80
80
  }
81
- patch "repos/#{Repository.new(repo)}/comments/#{id}", options.merge(params)
81
+ patch "#{Repository.path repo}/comments/#{id}", options.merge(params)
82
82
  end
83
83
 
84
84
  # Delete a commit comment
85
85
  #
86
- # @param repo [String, Hash, Repository] A GitHub repository
86
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
87
87
  # @param id [String] The ID of the comment to delete
88
88
  # @return [Boolean] Success
89
89
  # @see https://developer.github.com/v3/repos/comments/#delete-a-commit-comment
90
90
  def delete_commit_comment(repo, id, options = {})
91
- boolean_from_response :delete, "repos/#{Repository.new(repo)}/comments/#{id}", options
91
+ boolean_from_response :delete, "#{Repository.path repo}/comments/#{id}", options
92
92
  end
93
93
  end
94
94
  end
@@ -12,11 +12,11 @@ module Octokit
12
12
  #
13
13
  # @overload commits(repo, sha_or_branch, options = {})
14
14
  # @deprecated
15
- # @param repo [String, Hash, Repository] A GitHub repository
15
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
16
16
  # @param sha_or_branch [String] A commit SHA or branch name
17
17
  # @param options [String] :sha Commit SHA or branch name from which to start the list
18
18
  # @overload commits(repo, options = {})
19
- # @param repo [String, Hash, Repository] A GitHub repository
19
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
20
20
  # @param options [String] :sha Commit SHA or branch name from which to start the list
21
21
  # @return [Array<Sawyer::Resource>] An array of hashes representing commits
22
22
  # @see https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
@@ -26,19 +26,19 @@ module Octokit
26
26
  if sha_or_branch
27
27
  arguments.options[:sha] = sha_or_branch
28
28
  end
29
- paginate "repos/#{Repository.new(arguments.repo)}/commits", arguments.options
29
+ paginate "#{Repository.new(arguments.repo).path}/commits", arguments.options
30
30
  end
31
31
  alias :list_commits :commits
32
32
 
33
33
  # Get commits after a specified date
34
34
  #
35
35
  # @overload commits_since(repo, date, options = {})
36
- # @param repo [String, Hash, Repository] A GitHub repository
36
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
37
37
  # @param date [String] Date on which we want to compare
38
38
  # @param options [String] :sha Commit SHA or branch name from which to start the list
39
39
  # @overload commits_since(repo, date, sha_or_branch, options = {})
40
40
  # @deprecated
41
- # @param repo [String, Hash, Repository] A GitHub repository
41
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
42
42
  # @param date [String] Date on which we want to compare
43
43
  # @param sha_or_branch [String] A commit SHA or branch name
44
44
  # @param options [String] :sha Commit SHA or branch name from which to start the list
@@ -61,11 +61,11 @@ module Octokit
61
61
  # Get commits before a specified date
62
62
  #
63
63
  # @overload commits_before(repo, date, options = {})
64
- # @param repo [String, Hash, Repository] A GitHub repository
64
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
65
65
  # @param date [String] Date on which we want to compare
66
66
  # @overload commits_before(repo, date, sha_or_branch, options = {})
67
67
  # @deprecated
68
- # @param repo [String, Hash, Repository] A GitHub repository
68
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
69
69
  # @param date [String] Date on which we want to compare
70
70
  # @param sha_or_branch [String] Commit SHA or branch name from which to start the list
71
71
  # @return [Array<Sawyer::Resource>] An array of hashes representing commits
@@ -87,11 +87,11 @@ module Octokit
87
87
  # Get commits on a specified date
88
88
  #
89
89
  # @overload commits_on(repo, date, options = {})
90
- # @param repo [String, Hash, Repository] A GitHub repository
90
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
91
91
  # @param date [String] Date on which we want to compare
92
92
  # @overload commits_on(repo, date, sha_or_branch, options = {})
93
93
  # @deprecated
94
- # @param repo [String, Hash, Repository] A GitHub repository
94
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
95
95
  # @param date [String] Date on which we want to compare
96
96
  # @param sha_or_branch [String] Commit SHA or branch name from which to start the list
97
97
  # @return [Array<Sawyer::Resource>] An array of hashes representing commits
@@ -114,12 +114,12 @@ module Octokit
114
114
  # Get commits made between two nominated dates
115
115
  #
116
116
  # @overload commits_between(repo, start_date, end_date, options = {})
117
- # @param repo [String, Hash, Repository] A GitHub repository
117
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
118
118
  # @param start_date [String] Start Date on which we want to compare
119
119
  # @param end_date [String] End Date on which we want to compare
120
120
  # @overload commits_between(repo, start_date, end_date, sha_or_branch, options = {})
121
121
  # @deprecated
122
- # @param repo [String, Hash, Repository] A GitHub repository
122
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
123
123
  # @param start_date [String] Start Date on which we want to compare
124
124
  # @param end_date [String] End Date on which we want to compare
125
125
  # @param sha_or_branch [String] Commit SHA or branch name from which to start the list
@@ -144,22 +144,22 @@ module Octokit
144
144
 
145
145
  # Get a single commit
146
146
  #
147
- # @param repo [String, Hash, Repository] A GitHub repository
147
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
148
148
  # @param sha [String] The SHA of the commit to fetch
149
149
  # @return [Sawyer::Resource] A hash representing the commit
150
150
  # @see https://developer.github.com/v3/repos/commits/#get-a-single-commit
151
151
  def commit(repo, sha, options = {})
152
- get "repos/#{Repository.new(repo)}/commits/#{sha}", options
152
+ get "#{Repository.path repo}/commits/#{sha}", options
153
153
  end
154
154
 
155
155
  # Get a detailed git commit
156
156
  #
157
- # @param repo [String, Hash, Repository] A GitHub repository
157
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
158
158
  # @param sha [String] The SHA of the commit to fetch
159
159
  # @return [Sawyer::Resource] A hash representing the commit
160
160
  # @see https://developer.github.com/v3/git/commits/#get-a-commit
161
161
  def git_commit(repo, sha, options = {})
162
- get "repos/#{Repository.new(repo)}/git/commits/#{sha}", options
162
+ get "#{Repository.path repo}/git/commits/#{sha}", options
163
163
  end
164
164
 
165
165
  # Create a commit
@@ -169,7 +169,7 @@ module Octokit
169
169
  # inferred from the authenticated user. See <a href="http://developer.github.com/v3/git/commits/">GitHub's documentation</a>
170
170
  # for details about how to format committer identities.
171
171
  #
172
- # @param repo [String, Hash, Repository] A GitHub repository
172
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
173
173
  # @param message [String] The commit message
174
174
  # @param tree [String] The SHA of the tree object the new commit will point to
175
175
  # @param parents [String, Array] One SHA (for a normal commit) or an array of SHAs (for a merge) of the new commit's parent commits. If ommitted or empty, a root commit will be created
@@ -184,23 +184,23 @@ module Octokit
184
184
  def create_commit(repo, message, tree, parents=nil, options = {})
185
185
  params = { :message => message, :tree => tree }
186
186
  params[:parents] = [parents].flatten if parents
187
- post "repos/#{Repository.new(repo)}/git/commits", options.merge(params)
187
+ post "#{Repository.path repo}/git/commits", options.merge(params)
188
188
  end
189
189
 
190
190
  # Compare two commits
191
191
  #
192
- # @param repo [String, Hash, Repository] A GitHub repository
192
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
193
193
  # @param start [String] The sha of the starting commit
194
194
  # @param endd [String] The sha of the ending commit
195
195
  # @return [Sawyer::Resource] A hash representing the comparison
196
196
  # @see https://developer.github.com/v3/repos/commits/#compare-two-commits
197
197
  def compare(repo, start, endd, options = {})
198
- get "repos/#{Repository.new(repo)}/compare/#{start}...#{endd}", options
198
+ get "#{Repository.path repo}/compare/#{start}...#{endd}", options
199
199
  end
200
200
 
201
201
  # Merge a branch or sha
202
202
  #
203
- # @param repo [String, Hash, Repository] A GitHub repository
203
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
204
204
  # @param base [String] The name of the base branch to merge into
205
205
  # @param head [String] The branch or SHA1 to merge
206
206
  # @option options [String] :commit_message The commit message for the merge
@@ -211,7 +211,7 @@ module Octokit
211
211
  :base => base,
212
212
  :head => head
213
213
  }.merge(options)
214
- post "repos/#{Repository.new(repo)}/merges", params
214
+ post "#{Repository.path repo}/merges", params
215
215
  end
216
216
 
217
217
  protected
@@ -10,19 +10,19 @@ module Octokit
10
10
 
11
11
  # Receive the default Readme for a repository
12
12
  #
13
- # @param repo [String, Repository, Hash] A GitHub repository
13
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
14
14
  # @option options [String] :ref name of the Commit/Branch/Tag. Defaults to “master”.
15
15
  # @return [Sawyer::Resource] The detail of the readme
16
16
  # @see https://developer.github.com/v3/repos/contents/#get-the-readme
17
17
  # @example Get the readme file for a repo
18
18
  # Octokit.readme("octokit/octokit.rb")
19
19
  def readme(repo, options={})
20
- get "repos/#{Repository.new(repo)}/readme", options
20
+ get "#{Repository.path repo}/readme", options
21
21
  end
22
22
 
23
23
  # Receive a listing of a repository folder or the contents of a file
24
24
  #
25
- # @param repo [String, Repository, Hash] A GitHub repository
25
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
26
26
  # @option options [String] :path A folder or file path
27
27
  # @option options [String] :ref name of the Commit/Branch/Tag. Defaults to “master”.
28
28
  # @return [Sawyer::Resource] The contents of a file or list of the files in the folder
@@ -31,7 +31,7 @@ module Octokit
31
31
  # Octokit.contents("octokit/octokit.rb", :path => 'lib/octokit.rb')
32
32
  def contents(repo, options={})
33
33
  repo_path = options.delete :path
34
- url = "repos/#{Repository.new(repo)}/contents/#{repo_path}"
34
+ url = "#{Repository.path repo}/contents/#{repo_path}"
35
35
  get url, options
36
36
  end
37
37
  alias :content :contents
@@ -39,7 +39,7 @@ module Octokit
39
39
  # Add content to a repository
40
40
  #
41
41
  # @overload create_contents(repo, path, message, content = nil, options = {})
42
- # @param repo [String, Repository, Hash] A GitHub repository
42
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
43
43
  # @param path [String] A path for the new content
44
44
  # @param message [String] A commit message for adding the content
45
45
  # @param optional content [String] The content for the file
@@ -77,7 +77,7 @@ module Octokit
77
77
  Base64.strict_encode64(content) :
78
78
  Base64.encode64(content).delete("\n") # Ruby 1.9.2
79
79
  options[:message] = message
80
- url = "repos/#{Repository.new(repo)}/contents/#{path}"
80
+ url = "#{Repository.path repo}/contents/#{path}"
81
81
  put url, options
82
82
  end
83
83
  alias :create_content :create_contents
@@ -87,7 +87,7 @@ module Octokit
87
87
  # Update content in a repository
88
88
  #
89
89
  # @overload update_contents(repo, path, message, sha, content = nil, options = {})
90
- # @param repo [String, Repository, Hash] A GitHub repository
90
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
91
91
  # @param path [String] A path for the content to update
92
92
  # @param message [String] A commit message for updating the content
93
93
  # @param sha [String] The _blob sha_ of the content to update
@@ -117,7 +117,7 @@ module Octokit
117
117
 
118
118
  # Delete content in a repository
119
119
  #
120
- # @param repo [String, Repository, Hash] A GitHub repository
120
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
121
121
  # @param path [String] A path for the content to delete
122
122
  # @param message [String] A commit message for deleting the content
123
123
  # @param sha [String] The _blob sha_ of the content to delete
@@ -133,7 +133,7 @@ module Octokit
133
133
  def delete_contents(repo, path, message, sha, options = {})
134
134
  options[:message] = message
135
135
  options[:sha] = sha
136
- url = "repos/#{Repository.new(repo)}/contents/#{path}"
136
+ url = "#{Repository.path repo}/contents/#{path}"
137
137
  delete url, options
138
138
  end
139
139
  alias :delete_content :delete_contents
@@ -142,7 +142,7 @@ module Octokit
142
142
 
143
143
  # This method will provide a URL to download a tarball or zipball archive for a repository.
144
144
  #
145
- # @param repo [String, Repository, Hash] A GitHub repository.
145
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository.
146
146
  # @option options format [String] Either tarball (default) or zipball.
147
147
  # @option options [String] :ref Optional valid Git reference, defaults to master.
148
148
  # @return [String] Location of the download
@@ -152,7 +152,7 @@ module Octokit
152
152
  def archive_link(repo, options={})
153
153
  repo_ref = options.delete :ref
154
154
  format = (options.delete :format) || 'tarball'
155
- url = "repos/#{Repository.new(repo)}/#{format}/#{repo_ref}"
155
+ url = "#{Repository.path repo}/#{format}/#{repo_ref}"
156
156
  request :head, url, options
157
157
 
158
158
  last_response.headers['Location']
@@ -10,18 +10,18 @@ module Octokit
10
10
 
11
11
  # List all deployments for a repository
12
12
  #
13
- # @param repo [String, Repository, Hash] A GitHub repository
13
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
14
14
  # @return [Array<Sawyer::Resource>] A list of deployments
15
15
  # @see https://developer.github.com/v3/repos/deployments/#list-deployments
16
16
  def deployments(repo, options = {})
17
17
  options = ensure_deployments_api_media_type(options)
18
- get("repos/#{Repository.new(repo)}/deployments", options)
18
+ get("#{Repository.path repo}/deployments", options)
19
19
  end
20
20
  alias :list_deployments :deployments
21
21
 
22
22
  # Create a deployment for a ref
23
23
  #
24
- # @param repo [String, Repository, Hash] A GitHub repository
24
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
25
25
  # @param ref [String] The ref to deploy
26
26
  # @option options [String] :payload Meta info about the deployment
27
27
  # @option options [String] :force Optional parameter to bypass any ahead/behind checks or commit status checks. Default: false
@@ -32,7 +32,7 @@ module Octokit
32
32
  def create_deployment(repo, ref, options = {})
33
33
  options = ensure_deployments_api_media_type(options)
34
34
  options[:ref] = ref
35
- post("repos/#{Repository.new(repo)}/deployments", options)
35
+ post("#{Repository.path repo}/deployments", options)
36
36
  end
37
37
 
38
38
  # List all statuses for a Deployment
@@ -8,20 +8,20 @@ module Octokit
8
8
 
9
9
  # List available downloads 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 [Array] A list of available downloads
13
13
  # @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
14
14
  # @see https://developer.github.com/v3/repos/downloads/#list-downloads-for-a-repository
15
15
  # @example List all downloads for Github/Hubot
16
16
  # Octokit.downloads("github/hubot")
17
17
  def downloads(repo, options={})
18
- paginate "repos/#{Repository.new(repo)}/downloads", options
18
+ paginate "#{Repository.path repo}/downloads", options
19
19
  end
20
20
  alias :list_downloads :downloads
21
21
 
22
22
  # Get single download for a repository
23
23
  #
24
- # @param repo [String, Repository, Hash] A GitHub repository
24
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
25
25
  # @param id [Integer] ID of the download
26
26
  # @return [Sawyer::Resource] A single download from the repository
27
27
  # @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
@@ -29,12 +29,12 @@ module Octokit
29
29
  # @example Get the "Robawt" download from Github/Hubot
30
30
  # Octokit.download("github/hubot")
31
31
  def download(repo, id, options={})
32
- get "repos/#{Repository.new(repo)}/downloads/#{id}", options
32
+ get "#{Repository.path repo}/downloads/#{id}", options
33
33
  end
34
34
 
35
35
  # Delete a single download for a repository
36
36
  #
37
- # @param repo [String, Repository, Hash] A GitHub repository
37
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
38
38
  # @param id [Integer] ID of the download
39
39
  # @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
40
40
  # @see https://developer.github.com/v3/repos/downloads/#delete-a-download
@@ -42,7 +42,7 @@ module Octokit
42
42
  # @example Get the "Robawt" download from Github/Hubot
43
43
  # Octokit.delete_download("github/hubot", 1234)
44
44
  def delete_download(repo, id, options = {})
45
- boolean_from_response :delete, "repos/#{Repository.new(repo)}/downloads/#{id}", options
45
+ boolean_from_response :delete, "#{Repository.path repo}/downloads/#{id}", options
46
46
  end
47
47
 
48
48
  end
@@ -19,54 +19,57 @@ module Octokit
19
19
 
20
20
  # List all user events
21
21
  #
22
+ # @param user [Integer, String] GitHub user login or id.
22
23
  # @return [Array<Sawyer::Resource>] A list of all user events
23
24
  # @see https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
24
25
  # @example List all user events
25
26
  # Octokit.user_events("sferik")
26
27
  def user_events(user, options = {})
27
- paginate "users/#{user}/events", options
28
+ paginate "#{User.path user}/events", options
28
29
  end
29
30
 
30
31
  # List public user events
31
32
  #
32
- # @param user [String] GitHub username
33
+ # @param user [Integer, String] GitHub user login or id
33
34
  # @return [Array<Sawyer::Resource>] A list of public user events
34
35
  # @see https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
35
36
  # @example List public user events
36
37
  # Octokit.user_events("sferik")
37
38
  def user_public_events(user, options = {})
38
- paginate "users/#{user}/events/public", options
39
+ paginate "#{User.path user}/events/public", options
39
40
  end
40
41
 
41
42
  # List events that a user has received
42
43
  #
44
+ # @param user [Integer, String] GitHub user login or id
43
45
  # @return [Array<Sawyer::Resource>] A list of all user received events
44
46
  # @see https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
45
47
  # @example List all user received events
46
48
  # Octokit.received_events("sferik")
47
49
  def received_events(user, options = {})
48
- paginate "users/#{user}/received_events", options
50
+ paginate "#{User.path user}/received_events", options
49
51
  end
50
52
 
51
53
  # List public events a user has received
52
54
  #
55
+ # @param user [Integer, String] GitHub user login or id
53
56
  # @return [Array<Sawyer::Resource>] A list of public user received events
54
57
  # @see https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
55
58
  # @example List public user received events
56
59
  # Octokit.received_public_events("sferik")
57
60
  def received_public_events(user, options = {})
58
- paginate "users/#{user}/received_events/public", options
61
+ paginate "#{User.path user}/received_events/public", options
59
62
  end
60
63
 
61
64
  # List events for a repository
62
65
  #
63
- # @param repo [String, Repository, Hash] A GitHub repository
66
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
64
67
  # @return [Array<Sawyer::Resource>] A list of events for a repository
65
68
  # @see https://developer.github.com/v3/activity/events/#list-repository-events
66
69
  # @example List events for a repository
67
70
  # Octokit.repository_events("sferik/rails_admin")
68
71
  def repository_events(repo, options = {})
69
- paginate "repos/#{Repository.new(repo)}/events", options
72
+ paginate "#{Repository.path repo}/events", options
70
73
  end
71
74
 
72
75
  # List public events for a repository's network
@@ -95,18 +98,18 @@ module Octokit
95
98
 
96
99
  # List an organization's public events
97
100
  #
98
- # @param org [String] Organization GitHub username
101
+ # @param org [String, Integer] Organization GitHub login or id.
99
102
  # @return [Array<Sawyer::Resource>] List of public events from a GitHub organization
100
103
  # @see https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
101
104
  # @example List public events for GitHub
102
105
  # Octokit.organization_public_events("GitHub")
103
106
  def organization_public_events(org, options = {})
104
- paginate "orgs/#{org}/events", options
107
+ paginate "#{Organization.path org}/events", options
105
108
  end
106
109
 
107
110
  # Get all Issue Events for a given Repository
108
111
  #
109
- # @param repo [String, Repository, Hash] A GitHub repository
112
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
110
113
  #
111
114
  # @return [Array<Sawyer::Resource>] Array of all Issue Events for this Repository
112
115
  # @see https://developer.github.com/v3/issues/events/#list-events-for-a-repository
@@ -114,13 +117,13 @@ module Octokit
114
117
  # @example Get all Issue Events for Octokit
115
118
  # Octokit.repository_issue_events("octokit/octokit.rb")
116
119
  def repository_issue_events(repo, options = {})
117
- paginate "repos/#{Repository.new(repo)}/issues/events", options
120
+ paginate "#{Repository.path repo}/issues/events", options
118
121
  end
119
122
  alias :repo_issue_events :repository_issue_events
120
123
 
121
124
  # List events for an Issue
122
125
  #
123
- # @param repo [String, Repository, Hash] A GitHub repository
126
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
124
127
  # @param number [Integer] Issue number
125
128
  #
126
129
  # @return [Array<Sawyer::Resource>] Array of events for that issue
@@ -128,12 +131,12 @@ module Octokit
128
131
  # @example List all issues events for issue #38 on octokit/octokit.rb
129
132
  # Octokit.issue_events("octokit/octokit.rb", 38)
130
133
  def issue_events(repo, number, options = {})
131
- paginate "repos/#{Repository.new(repo)}/issues/#{number}/events", options
134
+ paginate "#{Repository.path repo}/issues/#{number}/events", options
132
135
  end
133
136
 
134
137
  # Get information on a single Issue Event
135
138
  #
136
- # @param repo [String, Repository, Hash] A GitHub repository
139
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
137
140
  # @param number [Integer] Event number
138
141
  #
139
142
  # @return [Sawyer::Resource] A single Event for an Issue
@@ -141,7 +144,7 @@ module Octokit
141
144
  # @example Get Event information for ID 3094334 (a pull request was closed)
142
145
  # Octokit.issue_event("octokit/octokit.rb", 3094334)
143
146
  def issue_event(repo, number, options = {})
144
- paginate "repos/#{Repository.new(repo)}/issues/events/#{number}", options
147
+ paginate "#{Repository.path repo}/issues/events/#{number}", options
145
148
  end
146
149
  end
147
150
  end