octokit 1.22.0 → 1.23.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.
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +18 -0
- data/README.md +0 -19
- data/lib/octokit/client.rb +2 -0
- data/lib/octokit/client/events.rb +4 -4
- data/lib/octokit/client/github.rb +19 -0
- data/lib/octokit/client/organizations.rb +19 -0
- data/lib/octokit/client/statuses.rb +25 -0
- data/lib/octokit/client/users.rb +16 -1
- data/lib/octokit/configuration.rb +23 -20
- data/lib/octokit/connection.rb +1 -1
- data/lib/octokit/error.rb +3 -1
- data/lib/octokit/request.rb +4 -1
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +10 -12
- data/spec/fixtures/github_meta.json +9 -0
- data/spec/fixtures/github_status.json +4 -0
- data/spec/fixtures/github_status_last_message.json +5 -0
- data/spec/fixtures/github_status_messages.json +12 -0
- data/spec/fixtures/user_token.json +4 -0
- data/spec/octokit/client/github_spec.rb +19 -0
- data/spec/octokit/client/organizations_spec.rb +26 -0
- data/spec/octokit/client/statuses_spec.rb +33 -0
- data/spec/octokit/client/users_spec.rb +15 -0
- data/spec/octokit/client_spec.rb +18 -0
- metadata +36 -125
- data/.gemtest +0 -0
- data/.gitignore +0 -23
- data/.rspec +0 -3
- data/.travis.yml +0 -11
- data/Gemfile +0 -5
- data/spec/fixtures/.netrc +0 -2
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
# 1.23.0
|
4
|
+
|
5
|
+
* [Meta API][]
|
6
|
+
* [Status API][]
|
7
|
+
|
8
|
+
View [the full changelog][1.23.0].
|
9
|
+
[1.23.0]: https://github.com/pengwynn/octokit/compare/v1.22.0...v1.23.0
|
10
|
+
|
11
|
+
|
12
|
+
[Meta API]: http://developer.github.com/v3/meta/
|
13
|
+
[Status API]: https://status.github.com/api
|
14
|
+
|
3
15
|
# 1.22.0
|
4
16
|
|
5
17
|
* Patch from @[gonzoyumo][] to fix service hooks
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## Submitting a Pull Request
|
2
|
+
1. [Fork the repository.][fork]
|
3
|
+
2. [Create a topic branch.][branch]
|
4
|
+
3. Add specs for your unimplemented feature or bug fix.
|
5
|
+
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
6
|
+
5. Implement your feature or bug fix.
|
7
|
+
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
|
8
|
+
7. Run `open coverage/index.html`. If your changes are not completely covered
|
9
|
+
by your tests, return to step 3.
|
10
|
+
8. Add documentation for your feature or bug fix.
|
11
|
+
9. Run `bundle exec rake doc:yard`. If your changes are not 100% documented, go
|
12
|
+
back to step 8.
|
13
|
+
10. Add, commit, and push your changes.
|
14
|
+
11. [Submit a pull request.][pr]
|
15
|
+
|
16
|
+
[fork]: http://help.github.com/fork-a-repo/
|
17
|
+
[branch]: http://learn.github.com/p/branching.html
|
18
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/README.md
CHANGED
@@ -108,25 +108,6 @@ end
|
|
108
108
|
@client = Octokit::Client.new(:login => 'USERNAME', :password => 'PASSWORD')
|
109
109
|
```
|
110
110
|
|
111
|
-
## Submitting a Pull Request
|
112
|
-
1. [Fork the repository.][fork]
|
113
|
-
2. [Create a topic branch.][branch]
|
114
|
-
3. Add specs for your unimplemented feature or bug fix.
|
115
|
-
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
116
|
-
5. Implement your feature or bug fix.
|
117
|
-
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
|
118
|
-
7. Run `open coverage/index.html`. If your changes are not completely covered
|
119
|
-
by your tests, return to step 3.
|
120
|
-
8. Add documentation for your feature or bug fix.
|
121
|
-
9. Run `bundle exec rake doc:yard`. If your changes are not 100% documented, go
|
122
|
-
back to step 8.
|
123
|
-
10. Add, commit, and push your changes.
|
124
|
-
11. [Submit a pull request.][pr]
|
125
|
-
|
126
|
-
[fork]: http://help.github.com/fork-a-repo/
|
127
|
-
[branch]: http://learn.github.com/p/branching.html
|
128
|
-
[pr]: http://help.github.com/send-pull-requests/
|
129
|
-
|
130
111
|
## Supported Ruby Versions
|
131
112
|
|
132
113
|
This library aims to support and is [tested against][travis] the following Ruby
|
data/lib/octokit/client.rb
CHANGED
@@ -28,6 +28,7 @@ require 'octokit/client/statuses'
|
|
28
28
|
require 'octokit/client/say'
|
29
29
|
require 'octokit/client/rate_limit'
|
30
30
|
require 'octokit/client/gitignore'
|
31
|
+
require 'octokit/client/github'
|
31
32
|
|
32
33
|
module Octokit
|
33
34
|
class Client
|
@@ -70,5 +71,6 @@ module Octokit
|
|
70
71
|
include Octokit::Client::Say
|
71
72
|
include Octokit::Client::RateLimit
|
72
73
|
include Octokit::Client::Gitignore
|
74
|
+
include Octokit::Client::GitHub
|
73
75
|
end
|
74
76
|
end
|
@@ -4,7 +4,7 @@ module Octokit
|
|
4
4
|
# List all public events for GitHub
|
5
5
|
#
|
6
6
|
# @return [Array] A list of all public events from GitHub
|
7
|
-
# @see http://developer.github.com/v3/events
|
7
|
+
# @see http://developer.github.com/v3/activity/events/#list-public-events
|
8
8
|
# @example List all pubilc events
|
9
9
|
# Octokit.public_events
|
10
10
|
def public_events(options={})
|
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
# List all user events
|
15
15
|
#
|
16
16
|
# @return [Array] A list of all user events
|
17
|
-
# @see http://developer.github.com/v3/events
|
17
|
+
# @see http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
|
18
18
|
# @example List all user events
|
19
19
|
# Octokit.user_events("sferik")
|
20
20
|
def user_events(user, options={})
|
@@ -35,7 +35,7 @@ module Octokit
|
|
35
35
|
# List events that a user has received
|
36
36
|
#
|
37
37
|
# @return [Array] A list of all user received events
|
38
|
-
# @see http://developer.github.com/v3/
|
38
|
+
# @see http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
|
39
39
|
# @example List all user received events
|
40
40
|
# Octokit.received_events("sferik")
|
41
41
|
def received_events(user, options={})
|
@@ -56,7 +56,7 @@ module Octokit
|
|
56
56
|
#
|
57
57
|
# @param repo [String, Repository, Hash] A GitHub repository
|
58
58
|
# @return [Array] A list of events for a repository
|
59
|
-
# @see http://developer.github.com/v3/events
|
59
|
+
# @see http://developer.github.com/v3/activity/events/#list-repository-events
|
60
60
|
# @example List events for a repository
|
61
61
|
# Octokit.repository_events("sferik/rails_admin")
|
62
62
|
def repository_events(repo, options={})
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
module GitHub
|
4
|
+
|
5
|
+
# Get meta information about GitHub.com, the service.
|
6
|
+
#
|
7
|
+
# @see http://developer.github.com/v3/meta/
|
8
|
+
#
|
9
|
+
# @return [Hash] Hash with meta information.
|
10
|
+
#
|
11
|
+
# @example Get GitHub meta information
|
12
|
+
# @client.github_meta
|
13
|
+
def github_meta(options={})
|
14
|
+
get "/meta", options
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -313,6 +313,25 @@ module Octokit
|
|
313
313
|
boolean_from_response(:delete, "teams/#{team_id}/members/#{user}", options)
|
314
314
|
end
|
315
315
|
|
316
|
+
# Check if a user is a member of a team.
|
317
|
+
#
|
318
|
+
# Use this to check if another user is a member of a team that
|
319
|
+
# you are a member.
|
320
|
+
#
|
321
|
+
# @param team_id [Integer] Team id.
|
322
|
+
# @param user [String] GitHub username of the user to check.
|
323
|
+
#
|
324
|
+
# @return [Boolean] Is a member?
|
325
|
+
#
|
326
|
+
# @see http://developer.github.com/v3/orgs/teams/#get-team-member
|
327
|
+
#
|
328
|
+
# @example Check if a user is in your team
|
329
|
+
# @client.team_member?('your_team', 'pengwynn')
|
330
|
+
# => false
|
331
|
+
def team_member?(team_id, user, options={})
|
332
|
+
boolean_from_response(:get, "teams/#{team_id}/members/#{user}", options)
|
333
|
+
end
|
334
|
+
|
316
335
|
# List team repositories
|
317
336
|
#
|
318
337
|
# Requires authenticated organization member.
|
@@ -24,6 +24,31 @@ module Octokit
|
|
24
24
|
options.merge!(:state => state)
|
25
25
|
post("repos/#{Repository.new(repo)}/statuses/#{sha}", options)
|
26
26
|
end
|
27
|
+
|
28
|
+
# Returns the current system status
|
29
|
+
#
|
30
|
+
# @return [Hash] GitHub status
|
31
|
+
# @see https://status.github.com/api#api-current-status
|
32
|
+
def github_status
|
33
|
+
get('status.json', {:endpoint => Octokit.status_api_endpoint})
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the last human communication, status, and timestamp.
|
37
|
+
#
|
38
|
+
# @return [Hash] GitHub status last message
|
39
|
+
# @see https://status.github.com/api#api-last-message
|
40
|
+
def github_status_last_message
|
41
|
+
get('last-message.json', {:endpoint => Octokit.status_api_endpoint})
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns the most recent human communications with status and timestamp.
|
45
|
+
#
|
46
|
+
# @return [Array<Hash>] GitHub status messages
|
47
|
+
# @see https://status.github.com/api#api-recent-messages
|
48
|
+
def github_status_messages
|
49
|
+
get('messages.json', {:endpoint => Octokit.status_api_endpoint})
|
50
|
+
end
|
51
|
+
|
27
52
|
end
|
28
53
|
end
|
29
54
|
end
|
data/lib/octokit/client/users.rb
CHANGED
@@ -40,10 +40,25 @@ module Octokit
|
|
40
40
|
if user
|
41
41
|
get "users/#{user}"
|
42
42
|
else
|
43
|
-
get
|
43
|
+
get 'user'
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
# Retrieve the access_token.
|
48
|
+
#
|
49
|
+
# @param code [String] Authorization code generated by GitHub.
|
50
|
+
# @param app_id [String] Client Id we received when our application was registered with GitHub.
|
51
|
+
# @param app_secret [String] Client Secret we received when our application was registered with GitHub.
|
52
|
+
# @return [Hashie::Mash] Hash holding the access token.
|
53
|
+
# @see Octokit::Client
|
54
|
+
# @see http://developer.github.com/v3/oauth/#web-application-flow
|
55
|
+
# @example
|
56
|
+
# @client.access_token('aaaa', 'xxxx', 'yyyy', {:accept => 'application/json'})
|
57
|
+
def access_token(code, app_id, app_secret, options = {})
|
58
|
+
post("login/oauth/access_token", options.merge({:endpoint => Octokit.web_endpoint, :code => code,
|
59
|
+
:client_id => app_id, :client_secret => app_secret}))
|
60
|
+
end
|
61
|
+
|
47
62
|
# Validate user username and password
|
48
63
|
#
|
49
64
|
# @param options [Hash] User credentials
|
@@ -9,6 +9,7 @@ module Octokit
|
|
9
9
|
:api_version,
|
10
10
|
:api_endpoint,
|
11
11
|
:web_endpoint,
|
12
|
+
:status_api_endpoint,
|
12
13
|
:login,
|
13
14
|
:password,
|
14
15
|
:proxy,
|
@@ -21,12 +22,13 @@ module Octokit
|
|
21
22
|
:auto_traversal,
|
22
23
|
:per_page].freeze
|
23
24
|
|
24
|
-
DEFAULT_ADAPTER
|
25
|
-
DEFAULT_API_VERSION
|
26
|
-
DEFAULT_API_ENDPOINT
|
27
|
-
DEFAULT_WEB_ENDPOINT
|
28
|
-
|
29
|
-
|
25
|
+
DEFAULT_ADAPTER = Faraday.default_adapter
|
26
|
+
DEFAULT_API_VERSION = 3
|
27
|
+
DEFAULT_API_ENDPOINT = ENV['OCTOKIT_API_ENDPOINT'] || 'https://api.github.com/'
|
28
|
+
DEFAULT_WEB_ENDPOINT = ENV['OCTOKIT_WEB_ENDPOINT'] || 'https://github.com/'
|
29
|
+
DEFAULT_STATUS_API_ENDPOINT = ENV['OCTOKIT_STATUS_API_ENDPOINT'] || 'https://status.github.com/api/'
|
30
|
+
DEFAULT_USER_AGENT = "Octokit Ruby Gem #{Octokit::VERSION}".freeze
|
31
|
+
DEFAULT_AUTO_TRAVERSAL = false
|
30
32
|
|
31
33
|
attr_accessor(*VALID_OPTIONS_KEYS)
|
32
34
|
|
@@ -55,20 +57,21 @@ module Octokit
|
|
55
57
|
end
|
56
58
|
|
57
59
|
def reset
|
58
|
-
self.adapter
|
59
|
-
self.api_version
|
60
|
-
self.api_endpoint
|
61
|
-
self.web_endpoint
|
62
|
-
self.
|
63
|
-
self.
|
64
|
-
self.
|
65
|
-
self.
|
66
|
-
self.
|
67
|
-
self.
|
68
|
-
self.
|
69
|
-
self.
|
70
|
-
self.
|
71
|
-
self.
|
60
|
+
self.adapter = DEFAULT_ADAPTER
|
61
|
+
self.api_version = DEFAULT_API_VERSION
|
62
|
+
self.api_endpoint = DEFAULT_API_ENDPOINT
|
63
|
+
self.web_endpoint = DEFAULT_WEB_ENDPOINT
|
64
|
+
self.status_api_endpoint = DEFAULT_STATUS_API_ENDPOINT
|
65
|
+
self.login = nil
|
66
|
+
self.password = nil
|
67
|
+
self.proxy = nil
|
68
|
+
self.oauth_token = nil
|
69
|
+
self.client_id = nil
|
70
|
+
self.client_secret = nil
|
71
|
+
self.request_host = nil
|
72
|
+
self.netrc = false
|
73
|
+
self.user_agent = DEFAULT_USER_AGENT
|
74
|
+
self.auto_traversal = DEFAULT_AUTO_TRAVERSAL
|
72
75
|
end
|
73
76
|
end
|
74
77
|
end
|
data/lib/octokit/connection.rb
CHANGED
data/lib/octokit/error.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Octokit
|
2
2
|
# Custom error class for rescuing from all GitHub errors
|
3
3
|
class Error < StandardError
|
4
|
-
def initialize(response)
|
4
|
+
def initialize(response=nil)
|
5
5
|
@response = response
|
6
6
|
super(build_error_message)
|
7
7
|
end
|
@@ -22,6 +22,8 @@ module Octokit
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def build_error_message
|
25
|
+
return nil if @response.nil?
|
26
|
+
|
25
27
|
message = if response_body
|
26
28
|
": #{response_body[:error] || response_body[:message] || ''}"
|
27
29
|
else
|
data/lib/octokit/request.rb
CHANGED
@@ -53,9 +53,12 @@ module Octokit
|
|
53
53
|
|
54
54
|
force_urlencoded = options.delete(:force_urlencoded) || false
|
55
55
|
|
56
|
+
url = options.delete(:endpoint) || api_endpoint
|
57
|
+
|
56
58
|
conn_options = {
|
57
59
|
:authenticate => token.nil?,
|
58
|
-
:force_urlencoded => force_urlencoded
|
60
|
+
:force_urlencoded => force_urlencoded,
|
61
|
+
:url => url
|
59
62
|
}
|
60
63
|
|
61
64
|
response = connection(conn_options).send(method) do |request|
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -1,30 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'octokit/version'
|
3
5
|
|
4
6
|
Gem::Specification.new do |spec|
|
7
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
5
8
|
spec.add_dependency 'addressable', '~> 2.2'
|
6
9
|
spec.add_dependency 'faraday', '~> 0.8'
|
7
10
|
spec.add_dependency 'faraday_middleware', '~> 0.9'
|
8
11
|
spec.add_dependency 'hashie', '~> 1.2'
|
9
12
|
spec.add_dependency 'multi_json', '~> 1.3'
|
10
13
|
spec.add_dependency 'netrc', '~> 0.7.7'
|
11
|
-
spec.add_development_dependency 'json', '~> 1.7'
|
12
|
-
spec.add_development_dependency 'kramdown'
|
13
|
-
spec.add_development_dependency 'rake'
|
14
|
-
spec.add_development_dependency 'rspec'
|
15
|
-
spec.add_development_dependency 'simplecov'
|
16
|
-
spec.add_development_dependency 'webmock'
|
17
|
-
spec.add_development_dependency 'yard'
|
18
14
|
spec.authors = ["Wynn Netherland", "Erik Michaels-Ober", "Clint Shryock"]
|
19
15
|
spec.description = %q{Simple wrapper for the GitHub v3 API}
|
20
16
|
spec.email = ['wynn.netherland@gmail.com', 'sferik@gmail.com', 'clint@ctshryock.com']
|
21
|
-
spec.files =
|
17
|
+
spec.files = %w(.document CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md Rakefile octokit.gemspec)
|
18
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
19
|
+
spec.files += Dir.glob("spec/**/*")
|
22
20
|
spec.homepage = 'https://github.com/pengwynn/octokit'
|
23
21
|
spec.licenses = ['MIT']
|
24
22
|
spec.name = 'octokit'
|
25
23
|
spec.require_paths = ['lib']
|
26
|
-
spec.required_rubygems_version =
|
24
|
+
spec.required_rubygems_version = '>= 1.3.6'
|
27
25
|
spec.summary = spec.description
|
28
|
-
spec.test_files =
|
26
|
+
spec.test_files = Dir.glob("spec/**/*")
|
29
27
|
spec.version = Octokit::VERSION
|
30
28
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe Octokit::Client::GitHub do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@client = Octokit::Client.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".github_meta" do
|
11
|
+
it "returns meta information about github" do
|
12
|
+
stub_get("/meta").
|
13
|
+
to_return(json_response("github_meta.json"))
|
14
|
+
github_meta = @client.github_meta
|
15
|
+
expect(github_meta.git.first).to eq("127.0.0.1/32")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -222,6 +222,32 @@ describe Octokit::Client::Organizations do
|
|
222
222
|
|
223
223
|
end
|
224
224
|
|
225
|
+
describe ".team_member?" do
|
226
|
+
|
227
|
+
context "user is actually a member of the team" do
|
228
|
+
|
229
|
+
it "returns true" do
|
230
|
+
stub_get("https://api.github.com/teams/32598/members/pengwynn").
|
231
|
+
to_return(:status => 204)
|
232
|
+
is_team_member = @client.team_member?(32598, 'pengwynn')
|
233
|
+
expect(is_team_member).to eq(true)
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
context "user is not actually a member of the team" do
|
239
|
+
|
240
|
+
it "returns false" do
|
241
|
+
stub_get("https://api.github.com/teams/32598/members/joeyw").
|
242
|
+
to_return(:status => 404)
|
243
|
+
is_team_member = @client.team_member?(32598, 'joeyw')
|
244
|
+
expect(is_team_member).to be_false
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
225
251
|
describe ".remove_organization_member" do
|
226
252
|
it "removes a member from an organization" do
|
227
253
|
stub_delete("https://api.github.com/orgs/codeforamerica/members/glow-mdsol").
|
@@ -32,4 +32,37 @@ describe Octokit::Client::Statuses do
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
+
describe ".github_status" do
|
36
|
+
|
37
|
+
it "returns the current system status" do
|
38
|
+
stub_get('https://status.github.com/api/status.json').
|
39
|
+
to_return(json_response('github_status.json'))
|
40
|
+
github_status = @client.github_status
|
41
|
+
expect(github_status.status).to eq('good')
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
describe ".github_status_last_message" do
|
47
|
+
|
48
|
+
it "returns the last human communication, status, and timestamp" do
|
49
|
+
stub_get('https://status.github.com/api/last-message.json').
|
50
|
+
to_return(json_response('github_status_last_message.json'))
|
51
|
+
last_message = @client.github_status_last_message
|
52
|
+
expect(last_message.body).to eq('Everything operating normally.')
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
describe ".github_status_messages" do
|
58
|
+
|
59
|
+
it "returns the most recent human communications" do
|
60
|
+
stub_get('https://status.github.com/api/messages.json').
|
61
|
+
to_return(json_response('github_status_messages.json'))
|
62
|
+
status_messages = @client.github_status_messages
|
63
|
+
expect(status_messages.first.body).to eq("I'm seeing, like, unicorns man.")
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
35
68
|
end
|
@@ -59,6 +59,21 @@ describe Octokit::Client::Users do
|
|
59
59
|
|
60
60
|
end
|
61
61
|
|
62
|
+
describe '.access_token' do
|
63
|
+
|
64
|
+
context 'with authorization code, client id, and client secret' do
|
65
|
+
|
66
|
+
it 'returns the access_token' do
|
67
|
+
stub_post("https://github.com/login/oauth/access_token").
|
68
|
+
to_return(json_response("user_token.json"))
|
69
|
+
resp = @client.access_token('code', 'id_here', 'secret_here')
|
70
|
+
expect(resp.access_token).to eq('this_be_ye_token/use_it_wisely')
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
62
77
|
describe ".validate_credentials" do
|
63
78
|
it "validates username and password" do
|
64
79
|
stub_get("https://sferik:foobar@api.github.com/user").
|
data/spec/octokit/client_spec.rb
CHANGED
@@ -212,6 +212,24 @@ describe Octokit::Client do
|
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
+
describe "endpoint url" do
|
216
|
+
|
217
|
+
it "defaults to api.github.com" do
|
218
|
+
stub_request(:get, 'https://api.github.com').
|
219
|
+
to_return(:body => 'octocat')
|
220
|
+
response = Octokit.get '/'
|
221
|
+
expect(response).to eq('octocat')
|
222
|
+
end
|
223
|
+
|
224
|
+
it "can be set in the options" do
|
225
|
+
stub_request(:get, 'http://wynnnetherland.com').
|
226
|
+
to_return(:body => 'pengwynn')
|
227
|
+
response = Octokit.get '/', {:endpoint => 'http://wynnnetherland.com'}
|
228
|
+
expect(response).to eq('pengwynn')
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
|
215
233
|
describe "error handling" do
|
216
234
|
|
217
235
|
it "displays validation errors" do
|
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: 1.
|
4
|
+
version: 1.23.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,8 +11,24 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '1.0'
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '1.0'
|
16
32
|
- !ruby/object:Gem::Dependency
|
17
33
|
name: addressable
|
18
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,118 +125,6 @@ dependencies:
|
|
109
125
|
- - ~>
|
110
126
|
- !ruby/object:Gem::Version
|
111
127
|
version: 0.7.7
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: json
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
|
-
requirements:
|
117
|
-
- - ~>
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '1.7'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
|
-
requirements:
|
125
|
-
- - ~>
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: '1.7'
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
name: kramdown
|
130
|
-
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
|
-
requirements:
|
133
|
-
- - ! '>='
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version: '0'
|
136
|
-
type: :development
|
137
|
-
prerelease: false
|
138
|
-
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
|
-
requirements:
|
141
|
-
- - ! '>='
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: '0'
|
144
|
-
- !ruby/object:Gem::Dependency
|
145
|
-
name: rake
|
146
|
-
requirement: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
|
-
requirements:
|
149
|
-
- - ! '>='
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '0'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
|
-
requirements:
|
157
|
-
- - ! '>='
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
- !ruby/object:Gem::Dependency
|
161
|
-
name: rspec
|
162
|
-
requirement: !ruby/object:Gem::Requirement
|
163
|
-
none: false
|
164
|
-
requirements:
|
165
|
-
- - ! '>='
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
|
-
type: :development
|
169
|
-
prerelease: false
|
170
|
-
version_requirements: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
|
-
requirements:
|
173
|
-
- - ! '>='
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
version: '0'
|
176
|
-
- !ruby/object:Gem::Dependency
|
177
|
-
name: simplecov
|
178
|
-
requirement: !ruby/object:Gem::Requirement
|
179
|
-
none: false
|
180
|
-
requirements:
|
181
|
-
- - ! '>='
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: '0'
|
184
|
-
type: :development
|
185
|
-
prerelease: false
|
186
|
-
version_requirements: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
|
-
requirements:
|
189
|
-
- - ! '>='
|
190
|
-
- !ruby/object:Gem::Version
|
191
|
-
version: '0'
|
192
|
-
- !ruby/object:Gem::Dependency
|
193
|
-
name: webmock
|
194
|
-
requirement: !ruby/object:Gem::Requirement
|
195
|
-
none: false
|
196
|
-
requirements:
|
197
|
-
- - ! '>='
|
198
|
-
- !ruby/object:Gem::Version
|
199
|
-
version: '0'
|
200
|
-
type: :development
|
201
|
-
prerelease: false
|
202
|
-
version_requirements: !ruby/object:Gem::Requirement
|
203
|
-
none: false
|
204
|
-
requirements:
|
205
|
-
- - ! '>='
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
version: '0'
|
208
|
-
- !ruby/object:Gem::Dependency
|
209
|
-
name: yard
|
210
|
-
requirement: !ruby/object:Gem::Requirement
|
211
|
-
none: false
|
212
|
-
requirements:
|
213
|
-
- - ! '>='
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
none: false
|
220
|
-
requirements:
|
221
|
-
- - ! '>='
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
version: '0'
|
224
128
|
description: Simple wrapper for the GitHub v3 API
|
225
129
|
email:
|
226
130
|
- wynn.netherland@gmail.com
|
@@ -231,19 +135,14 @@ extensions: []
|
|
231
135
|
extra_rdoc_files: []
|
232
136
|
files:
|
233
137
|
- .document
|
234
|
-
- .gemtest
|
235
|
-
- .gitignore
|
236
|
-
- .rspec
|
237
|
-
- .travis.yml
|
238
138
|
- CHANGELOG.md
|
239
|
-
-
|
139
|
+
- CONTRIBUTING.md
|
240
140
|
- LICENSE.md
|
241
141
|
- README.md
|
242
142
|
- Rakefile
|
143
|
+
- octokit.gemspec
|
243
144
|
- lib/faraday/response/raise_octokit_error.rb
|
244
|
-
- lib/octokit.rb
|
245
145
|
- lib/octokit/authentication.rb
|
246
|
-
- lib/octokit/client.rb
|
247
146
|
- lib/octokit/client/authorizations.rb
|
248
147
|
- lib/octokit/client/commits.rb
|
249
148
|
- lib/octokit/client/contents.rb
|
@@ -251,6 +150,7 @@ files:
|
|
251
150
|
- lib/octokit/client/emojis.rb
|
252
151
|
- lib/octokit/client/events.rb
|
253
152
|
- lib/octokit/client/gists.rb
|
153
|
+
- lib/octokit/client/github.rb
|
254
154
|
- lib/octokit/client/gitignore.rb
|
255
155
|
- lib/octokit/client/issues.rb
|
256
156
|
- lib/octokit/client/labels.rb
|
@@ -259,8 +159,8 @@ files:
|
|
259
159
|
- lib/octokit/client/notifications.rb
|
260
160
|
- lib/octokit/client/objects.rb
|
261
161
|
- lib/octokit/client/organizations.rb
|
262
|
-
- lib/octokit/client/pub_sub_hubbub.rb
|
263
162
|
- lib/octokit/client/pub_sub_hubbub/service_hooks.rb
|
163
|
+
- lib/octokit/client/pub_sub_hubbub.rb
|
264
164
|
- lib/octokit/client/pulls.rb
|
265
165
|
- lib/octokit/client/rate_limit.rb
|
266
166
|
- lib/octokit/client/refs.rb
|
@@ -268,6 +168,7 @@ files:
|
|
268
168
|
- lib/octokit/client/say.rb
|
269
169
|
- lib/octokit/client/statuses.rb
|
270
170
|
- lib/octokit/client/users.rb
|
171
|
+
- lib/octokit/client.rb
|
271
172
|
- lib/octokit/configuration.rb
|
272
173
|
- lib/octokit/connection.rb
|
273
174
|
- lib/octokit/error.rb
|
@@ -275,9 +176,8 @@ files:
|
|
275
176
|
- lib/octokit/repository.rb
|
276
177
|
- lib/octokit/request.rb
|
277
178
|
- lib/octokit/version.rb
|
278
|
-
- octokit.
|
179
|
+
- lib/octokit.rb
|
279
180
|
- spec/faraday/response_spec.rb
|
280
|
-
- spec/fixtures/.netrc
|
281
181
|
- spec/fixtures/all_repositories.json
|
282
182
|
- spec/fixtures/all_users.json
|
283
183
|
- spec/fixtures/authorization.json
|
@@ -312,6 +212,10 @@ files:
|
|
312
212
|
- spec/fixtures/gist_comment_update.json
|
313
213
|
- spec/fixtures/gist_comments.json
|
314
214
|
- spec/fixtures/gists.json
|
215
|
+
- spec/fixtures/github_meta.json
|
216
|
+
- spec/fixtures/github_status.json
|
217
|
+
- spec/fixtures/github_status_last_message.json
|
218
|
+
- spec/fixtures/github_status_messages.json
|
315
219
|
- spec/fixtures/gitignore_template_ruby.json
|
316
220
|
- spec/fixtures/gitignore_templates.json
|
317
221
|
- spec/fixtures/hook.json
|
@@ -401,6 +305,7 @@ files:
|
|
401
305
|
- spec/fixtures/user_events.json
|
402
306
|
- spec/fixtures/user_performed_public_events.json
|
403
307
|
- spec/fixtures/user_public_events.json
|
308
|
+
- spec/fixtures/user_token.json
|
404
309
|
- spec/fixtures/validation_failed.json
|
405
310
|
- spec/fixtures/watched.json
|
406
311
|
- spec/fixtures/watchers.json
|
@@ -412,6 +317,7 @@ files:
|
|
412
317
|
- spec/octokit/client/emojis_spec.rb
|
413
318
|
- spec/octokit/client/events_spec.rb
|
414
319
|
- spec/octokit/client/gists_spec.rb
|
320
|
+
- spec/octokit/client/github_spec.rb
|
415
321
|
- spec/octokit/client/gitignore_spec.rb
|
416
322
|
- spec/octokit/client/issue_events_spec.rb
|
417
323
|
- spec/octokit/client/issues_spec.rb
|
@@ -460,7 +366,6 @@ specification_version: 3
|
|
460
366
|
summary: Simple wrapper for the GitHub v3 API
|
461
367
|
test_files:
|
462
368
|
- spec/faraday/response_spec.rb
|
463
|
-
- spec/fixtures/.netrc
|
464
369
|
- spec/fixtures/all_repositories.json
|
465
370
|
- spec/fixtures/all_users.json
|
466
371
|
- spec/fixtures/authorization.json
|
@@ -495,6 +400,10 @@ test_files:
|
|
495
400
|
- spec/fixtures/gist_comment_update.json
|
496
401
|
- spec/fixtures/gist_comments.json
|
497
402
|
- spec/fixtures/gists.json
|
403
|
+
- spec/fixtures/github_meta.json
|
404
|
+
- spec/fixtures/github_status.json
|
405
|
+
- spec/fixtures/github_status_last_message.json
|
406
|
+
- spec/fixtures/github_status_messages.json
|
498
407
|
- spec/fixtures/gitignore_template_ruby.json
|
499
408
|
- spec/fixtures/gitignore_templates.json
|
500
409
|
- spec/fixtures/hook.json
|
@@ -584,6 +493,7 @@ test_files:
|
|
584
493
|
- spec/fixtures/user_events.json
|
585
494
|
- spec/fixtures/user_performed_public_events.json
|
586
495
|
- spec/fixtures/user_public_events.json
|
496
|
+
- spec/fixtures/user_token.json
|
587
497
|
- spec/fixtures/validation_failed.json
|
588
498
|
- spec/fixtures/watched.json
|
589
499
|
- spec/fixtures/watchers.json
|
@@ -595,6 +505,7 @@ test_files:
|
|
595
505
|
- spec/octokit/client/emojis_spec.rb
|
596
506
|
- spec/octokit/client/events_spec.rb
|
597
507
|
- spec/octokit/client/gists_spec.rb
|
508
|
+
- spec/octokit/client/github_spec.rb
|
598
509
|
- spec/octokit/client/gitignore_spec.rb
|
599
510
|
- spec/octokit/client/issue_events_spec.rb
|
600
511
|
- spec/octokit/client/issues_spec.rb
|
data/.gemtest
DELETED
File without changes
|
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
*.swp
|
4
|
-
*.tmproj
|
5
|
-
*~
|
6
|
-
.\#*
|
7
|
-
.bundle
|
8
|
-
.config
|
9
|
-
.yardoc
|
10
|
-
Gemfile.lock
|
11
|
-
InstalledFiles
|
12
|
-
\#*
|
13
|
-
_yardoc
|
14
|
-
coverage
|
15
|
-
doc/
|
16
|
-
lib/bundler/man
|
17
|
-
pkg
|
18
|
-
rdoc
|
19
|
-
spec/reports
|
20
|
-
test/tmp
|
21
|
-
test/version_tmp
|
22
|
-
tmp
|
23
|
-
tmtags
|
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/spec/fixtures/.netrc
DELETED