octokit 2.7.2 → 3.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +3 -2
- data/LICENSE.md +1 -1
- data/README.md +26 -5
- data/lib/octokit/client.rb +8 -4
- data/lib/octokit/client/authorizations.rb +7 -13
- data/lib/octokit/client/commit_comments.rb +10 -10
- data/lib/octokit/client/commits.rb +0 -87
- data/lib/octokit/client/contents.rb +7 -7
- data/lib/octokit/client/deployments.rb +83 -0
- data/lib/octokit/client/downloads.rb +0 -43
- data/lib/octokit/client/events.rb +2 -2
- data/lib/octokit/client/feeds.rb +1 -1
- data/lib/octokit/client/gists.rb +7 -7
- data/lib/octokit/client/issues.rb +7 -7
- data/lib/octokit/client/notifications.rb +2 -2
- data/lib/octokit/client/objects.rb +2 -2
- data/lib/octokit/client/organizations.rb +1 -1
- data/lib/octokit/client/pages.rb +38 -0
- data/lib/octokit/client/pub_sub_hubbub.rb +9 -4
- data/lib/octokit/client/pull_requests.rb +27 -18
- data/lib/octokit/client/releases.rb +1 -1
- data/lib/octokit/client/repositories.rb +39 -38
- data/lib/octokit/client/stats.rb +5 -5
- data/lib/octokit/client/users.rb +13 -13
- data/lib/octokit/default.rb +2 -2
- data/lib/octokit/error.rb +1 -1
- data/lib/octokit/rate_limit.rb +4 -4
- data/lib/octokit/response/raise_error.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -1
- metadata +9 -7
data/lib/octokit/client/stats.rb
CHANGED
@@ -10,7 +10,7 @@ module Octokit
|
|
10
10
|
#
|
11
11
|
# @param repo [String, Hash, Repository] A GitHub repository
|
12
12
|
# @return [Array<Sawyer::Resource>] Array of contributor stats
|
13
|
-
# @see http://developer.github.com/v3/repos/statistics/#
|
13
|
+
# @see http://developer.github.com/v3/repos/statistics/#contributors
|
14
14
|
# @example Get contributor stats for octokit
|
15
15
|
# @client.contributors_stats('octokit/octokit.rb')
|
16
16
|
def contributors_stats(repo, options = {})
|
@@ -35,7 +35,7 @@ module Octokit
|
|
35
35
|
# @param repo [String, Hash, Repository] A GitHub repository
|
36
36
|
# @return [Array<Sawyer::Resource>] Weekly aggregate of the number of additions
|
37
37
|
# and deletions pushed to a repository.
|
38
|
-
# @see http://developer.github.com/v3/repos/statistics/#
|
38
|
+
# @see http://developer.github.com/v3/repos/statistics/#code-frequency
|
39
39
|
# @example Get code frequency stats for octokit
|
40
40
|
# @client.code_frequency_stats('octokit/octokit.rb')
|
41
41
|
def code_frequency_stats(repo, options = {})
|
@@ -49,7 +49,7 @@ module Octokit
|
|
49
49
|
# counts in all. all is everyone combined, including the owner in the last
|
50
50
|
# 52 weeks. If you’d like to get the commit counts for non-owners, you can
|
51
51
|
# subtract all from owner.
|
52
|
-
# @see http://developer.github.com/v3/repos/statistics/#
|
52
|
+
# @see http://developer.github.com/v3/repos/statistics/#participation
|
53
53
|
# @example Get weekly commit counts for octokit
|
54
54
|
# @client.participation_stats("octokit/octokit.rb")
|
55
55
|
def participation_stats(repo, options = {})
|
@@ -61,7 +61,7 @@ module Octokit
|
|
61
61
|
# @param repo [String, Hash, Repository] A GitHub repository
|
62
62
|
# @return [Array<Array>] Arrays containing the day number, hour number, and
|
63
63
|
# number of commits
|
64
|
-
# @see http://developer.github.com/v3/repos/statistics/#
|
64
|
+
# @see http://developer.github.com/v3/repos/statistics/#punch-card
|
65
65
|
# @example Get octokit punch card
|
66
66
|
# @octokit.punch_card_stats
|
67
67
|
def punch_card_stats(repo, options = {})
|
@@ -77,7 +77,7 @@ module Octokit
|
|
77
77
|
# @param metric [String] The metrics you are looking for
|
78
78
|
# @return [Array<Sawyer::Resource>] Magical unicorn stats
|
79
79
|
def get_stats(repo, metric, options = {})
|
80
|
-
data = get("repos/#{Repository.new
|
80
|
+
data = get("repos/#{Repository.new(repo)}/stats/#{metric}", options)
|
81
81
|
|
82
82
|
last_response.status == 202 ? nil : data
|
83
83
|
end
|
data/lib/octokit/client/users.rb
CHANGED
@@ -177,7 +177,11 @@ module Octokit
|
|
177
177
|
# @example
|
178
178
|
# Octokit.starred('pengwynn')
|
179
179
|
def starred(user=login, options = {})
|
180
|
-
|
180
|
+
if user == login && user_authenticated?
|
181
|
+
path = "user/starred"
|
182
|
+
else
|
183
|
+
path = "users/#{user}/starred"
|
184
|
+
end
|
181
185
|
paginate path, options
|
182
186
|
end
|
183
187
|
|
@@ -185,21 +189,13 @@ module Octokit
|
|
185
189
|
#
|
186
190
|
# Requires authenticated client.
|
187
191
|
#
|
188
|
-
# @param
|
192
|
+
# @param repo [String, Hash, Repository] A GitHub repository
|
189
193
|
# @return [Boolean] True if you are following the repo, false otherwise.
|
190
194
|
# @see http://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository
|
191
195
|
# @example
|
192
196
|
# @client.starred?('pengwynn/octokit')
|
193
|
-
|
194
|
-
|
195
|
-
arguments = Octokit::Arguments.new(args)
|
196
|
-
options = arguments.options
|
197
|
-
name = name_with_owner = arguments.shift
|
198
|
-
if repo = arguments.shift
|
199
|
-
name_with_owner = "#{name}/#{repo}"
|
200
|
-
warn "`.starred?('#{name}', '#{repo}')` is deprecated. Please use `.starred?('#{name_with_owner}')` instead."
|
201
|
-
end
|
202
|
-
boolean_from_response :get, "user/starred/#{Repository.new name_with_owner}", options
|
197
|
+
def starred?(repo, options = {})
|
198
|
+
boolean_from_response :get, "user/starred/#{Repository.new(repo)}", options
|
203
199
|
end
|
204
200
|
|
205
201
|
# Get a public key.
|
@@ -348,7 +344,11 @@ module Octokit
|
|
348
344
|
# @example
|
349
345
|
# @client.subscriptions("pengwynn")
|
350
346
|
def subscriptions(user=login, options = {})
|
351
|
-
|
347
|
+
if user == login && user_authenticated?
|
348
|
+
path = "user/subscriptions"
|
349
|
+
else
|
350
|
+
path = "users/#{user}/subscriptions"
|
351
|
+
end
|
352
352
|
paginate path, options
|
353
353
|
end
|
354
354
|
alias :watched :subscriptions
|
data/lib/octokit/default.rb
CHANGED
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
USER_AGENT = "Octokit Ruby Gem #{Octokit::VERSION}".freeze
|
15
15
|
|
16
16
|
# Default media type
|
17
|
-
MEDIA_TYPE = "application/vnd.github.
|
17
|
+
MEDIA_TYPE = "application/vnd.github.v3+json"
|
18
18
|
|
19
19
|
# Default WEB endpoint
|
20
20
|
WEB_ENDPOINT = "https://github.com".freeze
|
@@ -22,7 +22,7 @@ module Octokit
|
|
22
22
|
# In Faraday 0.9, Faraday::Builder was renamed to Faraday::RackBuilder
|
23
23
|
RACK_BUILDER_CLASS = defined?(Faraday::RackBuilder) ? Faraday::RackBuilder : Faraday::Builder
|
24
24
|
|
25
|
-
# Default Faraday middleware stack
|
25
|
+
# Default Faraday middleware stack
|
26
26
|
MIDDLEWARE = RACK_BUILDER_CLASS.new do |builder|
|
27
27
|
builder.use Octokit::Response::RaiseError
|
28
28
|
builder.use Octokit::Response::FeedParser
|
data/lib/octokit/error.rb
CHANGED
@@ -132,7 +132,7 @@ module Octokit
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def redact_url(url_string)
|
135
|
-
%w[client_secret access_token].each do |token|
|
135
|
+
%w[client_secret access_token].each do |token|
|
136
136
|
url_string.gsub!(/#{token}=\S+/, "#{token}=(redacted)") if url_string.include? token
|
137
137
|
end
|
138
138
|
url_string
|
data/lib/octokit/rate_limit.rb
CHANGED
@@ -12,7 +12,7 @@ module Octokit
|
|
12
12
|
# @return [Fixnum] Number of seconds when rate limit resets
|
13
13
|
#
|
14
14
|
# @see http://developer.github.com/v3/#rate-limiting
|
15
|
-
class RateLimit < Struct.new
|
15
|
+
class RateLimit < Struct.new(:limit, :remaining, :resets_at, :resets_in)
|
16
16
|
|
17
17
|
# Get rate limit info from HTTP response
|
18
18
|
#
|
@@ -21,9 +21,9 @@ module Octokit
|
|
21
21
|
def self.from_response(response)
|
22
22
|
info = new
|
23
23
|
if response && !response.headers.nil?
|
24
|
-
info.limit = response.headers['X-RateLimit-Limit'].to_i
|
25
|
-
info.remaining = response.headers['X-RateLimit-Remaining'].to_i
|
26
|
-
info.resets_at = Time.at(response.headers['X-RateLimit-Reset'].to_i)
|
24
|
+
info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
|
25
|
+
info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
|
26
|
+
info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
|
27
27
|
info.resets_in = (info.resets_at - Time.now).to_i
|
28
28
|
end
|
29
29
|
|
@@ -5,7 +5,7 @@ module Octokit
|
|
5
5
|
# Faraday response middleware
|
6
6
|
module Response
|
7
7
|
|
8
|
-
# This class raises an Octokit-flavored exception based
|
8
|
+
# This class raises an Octokit-flavored exception based
|
9
9
|
# HTTP status codes returned by the API
|
10
10
|
class RaiseError < Faraday::Response::Middleware
|
11
11
|
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'octokit/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
8
|
-
spec.add_dependency 'sawyer', '~> 0.5.
|
8
|
+
spec.add_dependency 'sawyer', '~> 0.5.3'
|
9
9
|
spec.authors = ["Wynn Netherland", "Erik Michaels-Ober", "Clint Shryock"]
|
10
10
|
spec.description = %q{Simple wrapper for the GitHub API}
|
11
11
|
spec.email = ['wynn.netherland@gmail.com', 'sferik@gmail.com', 'clint@ctshryock.com']
|
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.licenses = ['MIT']
|
16
16
|
spec.name = 'octokit'
|
17
17
|
spec.require_paths = ['lib']
|
18
|
+
spec.required_ruby_version = '>= 1.9.2'
|
18
19
|
spec.required_rubygems_version = '>= 1.3.5'
|
19
20
|
spec.summary = "Ruby toolkit for working with the GitHub API"
|
20
21
|
spec.version = Octokit::VERSION.dup
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
13
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.5.
|
35
|
+
version: 0.5.3
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.5.
|
42
|
+
version: 0.5.3
|
43
43
|
description: Simple wrapper for the GitHub API
|
44
44
|
email:
|
45
45
|
- wynn.netherland@gmail.com
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/octokit/client/commit_comments.rb
|
63
63
|
- lib/octokit/client/commits.rb
|
64
64
|
- lib/octokit/client/contents.rb
|
65
|
+
- lib/octokit/client/deployments.rb
|
65
66
|
- lib/octokit/client/downloads.rb
|
66
67
|
- lib/octokit/client/emojis.rb
|
67
68
|
- lib/octokit/client/events.rb
|
@@ -78,6 +79,7 @@ files:
|
|
78
79
|
- lib/octokit/client/notifications.rb
|
79
80
|
- lib/octokit/client/objects.rb
|
80
81
|
- lib/octokit/client/organizations.rb
|
82
|
+
- lib/octokit/client/pages.rb
|
81
83
|
- lib/octokit/client/pub_sub_hubbub.rb
|
82
84
|
- lib/octokit/client/pull_requests.rb
|
83
85
|
- lib/octokit/client/rate_limit.rb
|
@@ -114,12 +116,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
116
|
requirements:
|
115
117
|
- - '>='
|
116
118
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
119
|
+
version: 1.9.2
|
118
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
121
|
requirements:
|
120
|
-
- - '
|
122
|
+
- - '>'
|
121
123
|
- !ruby/object:Gem::Version
|
122
|
-
version: 1.3.
|
124
|
+
version: 1.3.1
|
123
125
|
requirements: []
|
124
126
|
rubyforge_project:
|
125
127
|
rubygems_version: 2.0.3
|