github_api 0.12.2 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +56 -37
- data/lib/github_api/client/repos.rb +1 -1
- data/lib/github_api/connection.rb +7 -1
- data/lib/github_api/constants.rb +2 -0
- data/lib/github_api/params_hash.rb +39 -25
- data/lib/github_api/request.rb +3 -3
- data/lib/github_api/request/jsonize.rb +8 -3
- data/lib/github_api/response/header.rb +6 -0
- data/lib/github_api/version.rb +1 -1
- data/spec/github/client/authorizations/two_factor_spec.rb +22 -0
- data/spec/github/params_hash_spec.rb +46 -24
- data/spec/github/response_wrapper/headers_spec.rb +3 -0
- metadata +68 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2d26348e58869906a79e2dfc0c48dfa954108eac
|
4
|
+
data.tar.gz: 825111954c6cd0c7d9a54fd3b266f095abdddec3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 108dfe9e60966232c63e19b23dff3fdd9b2309ef8118bc28fe115625f8593bdbaf1838fa288a0a88846069d8249894775a3a0e1230424c40de5966606a26d451
|
7
|
+
data.tar.gz: f82977eb6dfd356e52b946435eca533b6896668181cb1a804f69c6db8546bebd03cebd9bce2a25a25f757071950823a9f19fe5763a48d49a8458e2ff52407100
|
data/README.md
CHANGED
@@ -67,9 +67,10 @@ gem "github_api"
|
|
67
67
|
* [2.4 Caching](#24-caching)
|
68
68
|
* [3. Authentication](#3-authentication)
|
69
69
|
* [3.1 Basic](#31-basic)
|
70
|
-
* [3.2
|
71
|
-
* [3.3
|
72
|
-
* [3.4
|
70
|
+
* [3.2 Authorizations API](#32-authorizations-api)
|
71
|
+
* [3.3 Scopes](#33-scopes)
|
72
|
+
* [3.4 Application OAuth](#34-application-oauth)
|
73
|
+
* [3.5 Two-Factor](#35-two-factor)
|
73
74
|
* [4. Pagination](#4-pagination)
|
74
75
|
* [4.1 Auto pagination](#41-auto-pagination)
|
75
76
|
* [5. Error Handling](#5-error-handling)
|
@@ -251,12 +252,10 @@ For example, to set `etag` and `X-Poll_Interval` headers, use the `:headers` has
|
|
251
252
|
|
252
253
|
```ruby
|
253
254
|
events = Github::Client::Activity::Events.new
|
254
|
-
events.public
|
255
|
-
headers: {
|
255
|
+
events.public headers: {
|
256
256
|
'X-Poll-Interval': 60,
|
257
257
|
'ETag': "a18c3bded88eb5dbb5c849a489412bf3"
|
258
258
|
}
|
259
|
-
}
|
260
259
|
```
|
261
260
|
|
262
261
|
#### 1.5.1 Media Types
|
@@ -401,35 +400,9 @@ Github.new basic_auth: 'login:password'
|
|
401
400
|
|
402
401
|
Though this method is convenient you should strongly consider using `OAuth` for improved security reasons.
|
403
402
|
|
404
|
-
### 3.2
|
405
|
-
|
406
|
-
In order to authenticate your app through OAuth2 on GitHub you need to
|
407
|
-
|
408
|
-
* Visit https://github.com/settings/applications/new and register your app.
|
409
|
-
You will need to be logged in to initially register the application.
|
410
|
-
|
411
|
-
* Authorize your credentials https://github.com/login/oauth/authorize
|
412
|
-
|
413
|
-
You can use convenience methods to help you achieve this using **GithubAPI** gem:
|
403
|
+
### 3.2 Authorizations API
|
414
404
|
|
415
|
-
|
416
|
-
github = Github.new client_id: '...', client_secret: '...'
|
417
|
-
github.authorize_url redirect_uri: 'http://localhost', scope: 'repo'
|
418
|
-
# => "https://github.com/login/oauth/authorize?scope=repo&response_type=code&client_id='...'&redirect_uri=http%3A%2F%2Flocalhost"
|
419
|
-
```
|
420
|
-
After you get your authorization code, call to receive your access_token
|
421
|
-
|
422
|
-
```ruby
|
423
|
-
token = github.get_token( authorization_code )
|
424
|
-
```
|
425
|
-
|
426
|
-
Once you have your access token, configure your github instance following instructions under Configuration.
|
427
|
-
|
428
|
-
**Note**: If you are working locally (i.e. your app URL and callback URL are localhost), do not specify a ```:redirect_uri``` otherwise you will get a ```redirect_uri_mismatch``` error.
|
429
|
-
|
430
|
-
### 3.3 Authorizations API
|
431
|
-
|
432
|
-
#### 3.3.1 For an User
|
405
|
+
#### 3.2.1 For an User
|
433
406
|
|
434
407
|
To create an access token through the GitHub Authrizations API, you are required to pass your basic credentials and scopes you wish to have for the authentication token.
|
435
408
|
|
@@ -440,7 +413,7 @@ github.oauth.create scopes: ['repo']
|
|
440
413
|
|
441
414
|
You can add more than one scope from the `user`, `public_repo`, `repo`, `gist` or leave the scopes parameter out, in which case, the default read-only access will be assumed (includes public user profile info, public repo info, and gists).
|
442
415
|
|
443
|
-
#### 3.
|
416
|
+
#### 3.2.2 For an App
|
444
417
|
|
445
418
|
Furthermore, to create auth token for an application you need to pass `:app` argument together with `:client_id` and `:client_secret` parameters.
|
446
419
|
|
@@ -462,12 +435,12 @@ Revoke a specific app token.
|
|
462
435
|
github.oauth.app.delete 'client-id', 'access-token'
|
463
436
|
```
|
464
437
|
|
465
|
-
### 3.
|
438
|
+
### 3.3 Scopes
|
466
439
|
|
467
440
|
You can check OAuth scopes you have by:
|
468
441
|
|
469
442
|
```ruby
|
470
|
-
github = Github.new :
|
443
|
+
github = Github.new oauth_token: 'token'
|
471
444
|
github.scopes.list # => ['repo']
|
472
445
|
```
|
473
446
|
|
@@ -481,6 +454,52 @@ response.headers.accepted_oauth_scopes # => ['delete_repo', 'repo', 'public_rep
|
|
481
454
|
|
482
455
|
To understand what each scope means refer to [documentation](http://developer.github.com/v3/oauth/#scopes)
|
483
456
|
|
457
|
+
### 3.4 Application OAuth
|
458
|
+
|
459
|
+
In order to authenticate your app through OAuth2 on GitHub you need to
|
460
|
+
|
461
|
+
* Visit https://github.com/settings/applications/new and register your app.
|
462
|
+
You will need to be logged in to initially register the application.
|
463
|
+
|
464
|
+
* Authorize your credentials https://github.com/login/oauth/authorize
|
465
|
+
|
466
|
+
You can use convenience methods to help you achieve this using **GithubAPI** gem:
|
467
|
+
|
468
|
+
```ruby
|
469
|
+
github = Github.new client_id: '...', client_secret: '...'
|
470
|
+
github.authorize_url redirect_uri: 'http://localhost', scope: 'repo'
|
471
|
+
# => "https://github.com/login/oauth/authorize?scope=repo&response_type=code&client_id='...'&redirect_uri=http%3A%2F%2Flocalhost"
|
472
|
+
```
|
473
|
+
After you get your authorization code, call to receive your access_token
|
474
|
+
|
475
|
+
```ruby
|
476
|
+
token = github.get_token( authorization_code )
|
477
|
+
```
|
478
|
+
|
479
|
+
Once you have your access token, configure your github instance following instructions under Configuration.
|
480
|
+
|
481
|
+
**Note**: If you are working locally (i.e. your app URL and callback URL are localhost), do not specify a ```:redirect_uri``` otherwise you will get a ```redirect_uri_mismatch``` error.
|
482
|
+
|
483
|
+
### 3.5 Two-Factor
|
484
|
+
|
485
|
+
In order to use [Two-Factor](https://help.github.com/articles/about-two-factor-authentication) authentication you need provide `X-GitHub-OTP: required; :2fa-type` header.
|
486
|
+
|
487
|
+
You can add headers during initialization:
|
488
|
+
|
489
|
+
```ruby
|
490
|
+
Github.new do |config|
|
491
|
+
config.basic_auth = "user:password"
|
492
|
+
config.connection_options = {headers: {"X-GitHub-OTP" => '2fa token'}}
|
493
|
+
end
|
494
|
+
```
|
495
|
+
|
496
|
+
or per request:
|
497
|
+
|
498
|
+
```ruby
|
499
|
+
github = Github.new basic_auth: 'login:password'
|
500
|
+
github.oauth.create scopes: ["public_repo"],
|
501
|
+
headers: {"X-GitHub-OTP" => "2fa token"}
|
502
|
+
```
|
484
503
|
|
485
504
|
## 4 Pagination
|
486
505
|
|
@@ -284,7 +284,7 @@ module Github
|
|
284
284
|
# @option params [String] :homepage
|
285
285
|
# Optional string
|
286
286
|
# @option params [Boolean] :private
|
287
|
-
# Optional boolean,
|
287
|
+
# Optional boolean, true to make this a private repository, false to make it a public one
|
288
288
|
# @option params [Boolean] :has_issues
|
289
289
|
# Optional boolean - true to enable issues for this repository,
|
290
290
|
# false to disable them
|
@@ -26,7 +26,12 @@ module Github
|
|
26
26
|
},
|
27
27
|
ssl: options[:ssl],
|
28
28
|
url: options[:endpoint]
|
29
|
-
}
|
29
|
+
}.tap do |h|
|
30
|
+
if type = options[:headers] && options[:headers][CONTENT_TYPE]
|
31
|
+
h[:headers][CONTENT_TYPE] = type
|
32
|
+
end
|
33
|
+
h
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
def clear_cache
|
@@ -56,6 +61,7 @@ module Github
|
|
56
61
|
clear_cache unless options.empty?
|
57
62
|
builder = api.stack ? api.stack : stack(options.merge!(api: api))
|
58
63
|
connection_options.merge!(builder: builder)
|
64
|
+
connection_options.deep_merge!(options[:connection_options]) if options[:connection_options]
|
59
65
|
if ENV['DEBUG']
|
60
66
|
p "Connection options : \n"
|
61
67
|
pp connection_options
|
data/lib/github_api/constants.rb
CHANGED
@@ -4,18 +4,20 @@ require 'delegate'
|
|
4
4
|
require 'base64'
|
5
5
|
|
6
6
|
module Github
|
7
|
-
|
8
7
|
# Class responsible for holding request parameters
|
9
8
|
class ParamsHash < DelegateClass(Hash)
|
10
9
|
include Normalizer
|
11
10
|
include MimeType
|
12
11
|
|
12
|
+
REQUEST_PARAMS = [:accept, :media, :data, :raw, :content_type, :headers]
|
13
|
+
|
13
14
|
def initialize(hash)
|
14
15
|
super(normalize!(Hash[hash]))
|
15
16
|
end
|
16
17
|
|
17
18
|
# Create empty hash
|
18
19
|
#
|
20
|
+
# @api public
|
19
21
|
def self.empty
|
20
22
|
new({})
|
21
23
|
end
|
@@ -24,52 +26,55 @@ module Github
|
|
24
26
|
#
|
25
27
|
# [.version].param[+json]
|
26
28
|
#
|
29
|
+
# @api public
|
27
30
|
def media
|
28
31
|
parse(delete('media'))
|
29
32
|
end
|
30
33
|
|
31
|
-
#
|
34
|
+
# Get accept header
|
32
35
|
#
|
36
|
+
# @api public
|
33
37
|
def accept
|
34
|
-
if
|
35
|
-
|
36
|
-
|
37
|
-
media
|
38
|
-
else
|
39
|
-
nil
|
38
|
+
if key?('accept') then self['accept']
|
39
|
+
elsif key?('media') then media
|
40
|
+
else nil
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
# Extract request data from parameters
|
44
45
|
#
|
46
|
+
# @api public
|
45
47
|
def data
|
46
|
-
if
|
47
|
-
|
48
|
+
if key?('data') && !self['data'].nil?
|
49
|
+
self['data']
|
48
50
|
else
|
49
|
-
|
51
|
+
request_params
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
55
|
def encoder
|
54
|
-
if
|
55
|
-
|
56
|
+
if key?('encoder') && self['encoder']
|
57
|
+
self['encoder']
|
56
58
|
else
|
57
|
-
|
59
|
+
{}
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
61
|
-
#
|
63
|
+
# Configuration options from request
|
62
64
|
#
|
65
|
+
# @return [Hash]
|
66
|
+
#
|
67
|
+
# @api public
|
63
68
|
def options
|
64
|
-
opts
|
65
|
-
headers =
|
69
|
+
opts = fetch('options', {})
|
70
|
+
headers = fetch('headers', {})
|
66
71
|
if value = accept
|
67
72
|
headers[:accept] = value
|
68
73
|
end
|
69
|
-
if
|
70
|
-
headers[:content_type] =
|
74
|
+
if self['content_type']
|
75
|
+
headers[:content_type] = self['content_type']
|
71
76
|
end
|
72
|
-
opts[:raw]
|
77
|
+
opts[:raw] = key?('raw') ? self['raw'] : false
|
73
78
|
opts[:headers] = headers unless headers.empty?
|
74
79
|
opts
|
75
80
|
end
|
@@ -79,7 +84,7 @@ module Github
|
|
79
84
|
def merge_default(defaults)
|
80
85
|
if defaults && !defaults.empty?
|
81
86
|
defaults.each do |key, value|
|
82
|
-
self[key] = value unless self.
|
87
|
+
self[key] = value unless self.key?(key)
|
83
88
|
end
|
84
89
|
end
|
85
90
|
self
|
@@ -87,15 +92,24 @@ module Github
|
|
87
92
|
|
88
93
|
# Base64 encode string removing newline characters
|
89
94
|
#
|
95
|
+
# @api public
|
90
96
|
def strict_encode64(key)
|
91
97
|
value = self[key]
|
92
98
|
encoded = if Base64.respond_to?(:strict_encode64)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
99
|
+
Base64.strict_encode64(value)
|
100
|
+
else
|
101
|
+
[value].pack('m0')
|
102
|
+
end
|
97
103
|
self[key] = encoded.delete("\n\r")
|
98
104
|
end
|
99
105
|
|
106
|
+
# Filter out request params
|
107
|
+
#
|
108
|
+
# @api public
|
109
|
+
def request_params
|
110
|
+
to_hash.select do |key, value|
|
111
|
+
!REQUEST_PARAMS.include?(key.to_sym)
|
112
|
+
end
|
113
|
+
end
|
100
114
|
end # ParamsHash
|
101
115
|
end # Github
|
data/lib/github_api/request.rb
CHANGED
@@ -68,11 +68,11 @@ module Github
|
|
68
68
|
response = conn.send(action) do |request|
|
69
69
|
case action.to_sym
|
70
70
|
when *(HTTP_METHODS - METHODS_WITH_BODIES)
|
71
|
-
request.body = params.data if params.
|
72
|
-
if params.
|
71
|
+
request.body = params.data if params.key?('data')
|
72
|
+
if params.key?('encoder')
|
73
73
|
request.params.params_encoder(params.encoder)
|
74
74
|
end
|
75
|
-
request.url(self.path, params.
|
75
|
+
request.url(self.path, params.request_params)
|
76
76
|
when *METHODS_WITH_BODIES
|
77
77
|
request.url(self.path, connection_options[:query] || {})
|
78
78
|
request.body = params.data unless params.empty?
|
@@ -14,9 +14,9 @@ module Github
|
|
14
14
|
if request_with_body?(env)
|
15
15
|
env[:request_headers][CONTENT_TYPE] ||= MIME_TYPE
|
16
16
|
env[:body] = encode_body env[:body] unless env[:body].respond_to?(:to_str)
|
17
|
-
|
17
|
+
elsif safe_to_modify?(env)
|
18
18
|
# Ensure valid body for put and post requests
|
19
|
-
if [:put, :patch, :post].include?
|
19
|
+
if [:put, :patch, :post].include?(env[:method])
|
20
20
|
env[:body] = encode_body({})
|
21
21
|
end
|
22
22
|
end
|
@@ -33,7 +33,12 @@ module Github
|
|
33
33
|
|
34
34
|
def request_with_body?(env)
|
35
35
|
type = request_type(env)
|
36
|
-
has_body?(env) and (
|
36
|
+
has_body?(env) and safe_to_modify?(env)
|
37
|
+
end
|
38
|
+
|
39
|
+
def safe_to_modify?(env)
|
40
|
+
type = request_type(env)
|
41
|
+
type.empty? or type == MIME_TYPE
|
37
42
|
end
|
38
43
|
|
39
44
|
# Don't encode bodies in string form
|
@@ -30,6 +30,12 @@ module Github
|
|
30
30
|
loaded? ? env[:response_headers][RATELIMIT_REMAINING] : nil
|
31
31
|
end
|
32
32
|
|
33
|
+
# A unix timestamp describing when the ratelimit will
|
34
|
+
# be reset
|
35
|
+
def ratelimit_reset
|
36
|
+
loaded? ? env[:response_headers][RATELIMIT_RESET] : nil
|
37
|
+
end
|
38
|
+
|
33
39
|
def cache_control
|
34
40
|
loaded? ? env[:response_headers][CACHE_CONTROL] : nil
|
35
41
|
end
|
data/lib/github_api/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Github::Client::Authorizations, 'two-factor' do
|
6
|
+
let(:basic_auth) { 'login:password' }
|
7
|
+
let(:host) { "https://#{basic_auth}@api.github.com" }
|
8
|
+
|
9
|
+
it "fails with known OTP error" do
|
10
|
+
stub_get("/authorizations/1", host).to_return(
|
11
|
+
status: 401,
|
12
|
+
headers: {
|
13
|
+
content_type: 'application/json',
|
14
|
+
'X-GitHub-OTP' => 'required; sms'
|
15
|
+
},
|
16
|
+
body: {message: "Require two-factor authentication OTP token."}
|
17
|
+
)
|
18
|
+
expect {
|
19
|
+
described_class.new(basic_auth: 'login:password').get(1)
|
20
|
+
}.to raise_error(Github::Error::Unauthorized, /Require two-factor/)
|
21
|
+
end
|
22
|
+
end
|
@@ -2,34 +2,43 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
describe Github::ParamsHash do
|
5
|
+
RSpec.describe Github::ParamsHash do
|
6
6
|
let(:object) { described_class }
|
7
7
|
|
8
|
-
subject { object.new(hash) }
|
8
|
+
subject(:params) { object.new(hash) }
|
9
9
|
|
10
|
-
context '
|
11
|
-
let(:hash) { {
|
10
|
+
context 'when empty' do
|
11
|
+
let(:hash) { {} }
|
12
|
+
|
13
|
+
it { expect(params.options).to eq({:raw => false}) }
|
14
|
+
|
15
|
+
it { expect(params.data).to eq({}) }
|
12
16
|
|
13
|
-
it { expect(
|
17
|
+
it { expect(params.accept).to eq(nil) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'converts key to string' do
|
21
|
+
let(:hash) { {foo: 123 } }
|
14
22
|
|
15
|
-
it { expect(
|
23
|
+
it { expect(params['foo']).to eql(123) }
|
16
24
|
|
17
|
-
it { expect(
|
25
|
+
it { expect(params.data).to eql({"foo" => 123}) }
|
18
26
|
end
|
19
27
|
|
20
28
|
context 'media' do
|
21
|
-
let(:hash) { {:
|
29
|
+
let(:hash) { {media: "raw"} }
|
22
30
|
|
23
31
|
it 'parses media key' do
|
24
|
-
expect(
|
32
|
+
expect(params.media).to eql('application/vnd.github.v3.raw+json')
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
28
36
|
context 'with accept' do
|
29
|
-
let(:hash) { {:
|
37
|
+
let(:hash) { {accept: "application/json"} }
|
30
38
|
|
31
39
|
it 'overwrites media key' do
|
32
|
-
expect(
|
40
|
+
expect(params.accept).to eql('application/json')
|
41
|
+
expect(params.to_hash).to eq({'accept' => 'application/json'})
|
33
42
|
end
|
34
43
|
end
|
35
44
|
|
@@ -37,39 +46,52 @@ describe Github::ParamsHash do
|
|
37
46
|
let(:hash) { {} }
|
38
47
|
|
39
48
|
it 'overwrites media key' do
|
40
|
-
expect(
|
49
|
+
expect(params.accept).to be_nil
|
41
50
|
end
|
42
51
|
end
|
43
52
|
|
44
|
-
context '
|
45
|
-
let(:hash) { {:
|
53
|
+
context 'when data' do
|
54
|
+
let(:hash) { {data: 'foobar'} }
|
46
55
|
|
47
|
-
it
|
56
|
+
it 'extracts data key' do
|
57
|
+
expect(params.data).to eql('foobar')
|
58
|
+
expect(params.to_hash).to eql({'data' => 'foobar'})
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when content_type' do
|
63
|
+
let(:hash) { {content_type: 'application/octet-stream'} }
|
64
|
+
|
65
|
+
it 'extracts content_type key' do
|
66
|
+
expect(params.options[:headers]).to eql(hash)
|
67
|
+
end
|
48
68
|
end
|
49
69
|
|
50
|
-
context '
|
51
|
-
let(:hash) { {:
|
70
|
+
context 'when header' do
|
71
|
+
let(:hash) { {headers: {"X-GitHub-OTP" => "<2FA token>"}} }
|
52
72
|
|
53
|
-
it
|
73
|
+
it "sets headers" do
|
74
|
+
expect(params.options[:headers]).to eql({"X-GitHub-OTP" => "<2FA token>" })
|
75
|
+
end
|
54
76
|
end
|
55
77
|
|
56
78
|
context 'merges defaults' do
|
57
79
|
let(:hash) { { :homepage => "https://tty.github.io" }}
|
58
80
|
let(:defaults) {
|
59
|
-
{ "homepage"
|
60
|
-
|
81
|
+
{ "homepage" => "https://github.com",
|
82
|
+
"private" => false}
|
61
83
|
}
|
62
84
|
|
63
85
|
it 'correctly updates values' do
|
64
86
|
subject.merge_default(defaults)
|
65
|
-
expect(
|
66
|
-
expect(
|
87
|
+
expect(params['homepage']).to eql("https://tty.github.io")
|
88
|
+
expect(params['private']).to be_false
|
67
89
|
end
|
68
90
|
end
|
69
91
|
|
70
92
|
context 'strict encode' do
|
71
|
-
let(:hash) { {
|
93
|
+
let(:hash) { {content: "puts 'hello ruby'"} }
|
72
94
|
|
73
|
-
it { expect(
|
95
|
+
it { expect(params.strict_encode64('content')).to eql('cHV0cyAnaGVsbG8gcnVieSc=') }
|
74
96
|
end
|
75
97
|
end
|
@@ -8,6 +8,7 @@ describe Github::ResponseWrapper, '#headers' do
|
|
8
8
|
'Content-Type' => "application/json; charset=utf-8",
|
9
9
|
'X-RateLimit-Remaining' => '4999',
|
10
10
|
'X-RateLimit-Limit' => '5000',
|
11
|
+
'X-RateLimit-Reset' => '1422262420',
|
11
12
|
'content-length' => '344',
|
12
13
|
'ETag' => "\"d9a88f20567726e29d35c6fae87cef2f\"",
|
13
14
|
'Server' => "nginx/1.0.4",
|
@@ -27,6 +28,8 @@ describe Github::ResponseWrapper, '#headers' do
|
|
27
28
|
|
28
29
|
its(:ratelimit_remaining) { should == '4999' }
|
29
30
|
|
31
|
+
its(:ratelimit_reset) { should == '1422262420' }
|
32
|
+
|
30
33
|
its(:status) { should be 200 }
|
31
34
|
|
32
35
|
its(:etag) { should eql "\"d9a88f20567726e29d35c6fae87cef2f\"" }
|
metadata
CHANGED
@@ -1,42 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
5
|
-
prerelease:
|
4
|
+
version: 0.12.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Piotr Murach
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: addressable
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '2.3'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: hashie
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '3.3'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.3'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: faraday
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
45
|
- - ~>
|
42
46
|
- !ruby/object:Gem::Version
|
@@ -46,13 +50,19 @@ dependencies:
|
|
46
50
|
version: '0.10'
|
47
51
|
type: :runtime
|
48
52
|
prerelease: false
|
49
|
-
version_requirements:
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0.8'
|
58
|
+
- - <
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.10'
|
50
61
|
- !ruby/object:Gem::Dependency
|
51
62
|
name: multi_json
|
52
|
-
requirement:
|
53
|
-
none: false
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
54
64
|
requirements:
|
55
|
-
- -
|
65
|
+
- - '>='
|
56
66
|
- !ruby/object:Gem::Version
|
57
67
|
version: 1.7.5
|
58
68
|
- - <
|
@@ -60,52 +70,71 @@ dependencies:
|
|
60
70
|
version: '2.0'
|
61
71
|
type: :runtime
|
62
72
|
prerelease: false
|
63
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.7.5
|
78
|
+
- - <
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2.0'
|
64
81
|
- !ruby/object:Gem::Dependency
|
65
82
|
name: oauth2
|
66
|
-
requirement:
|
67
|
-
none: false
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
68
84
|
requirements:
|
69
|
-
- -
|
85
|
+
- - '>='
|
70
86
|
- !ruby/object:Gem::Version
|
71
87
|
version: '0'
|
72
88
|
type: :runtime
|
73
89
|
prerelease: false
|
74
|
-
version_requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
75
95
|
- !ruby/object:Gem::Dependency
|
76
96
|
name: nokogiri
|
77
|
-
requirement:
|
78
|
-
none: false
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
79
98
|
requirements:
|
80
99
|
- - ~>
|
81
100
|
- !ruby/object:Gem::Version
|
82
101
|
version: 1.6.3
|
83
102
|
type: :runtime
|
84
103
|
prerelease: false
|
85
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.6.3
|
86
109
|
- !ruby/object:Gem::Dependency
|
87
110
|
name: descendants_tracker
|
88
|
-
requirement:
|
89
|
-
none: false
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
90
112
|
requirements:
|
91
113
|
- - ~>
|
92
114
|
- !ruby/object:Gem::Version
|
93
115
|
version: 0.0.4
|
94
116
|
type: :runtime
|
95
117
|
prerelease: false
|
96
|
-
version_requirements:
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ~>
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.0.4
|
97
123
|
- !ruby/object:Gem::Dependency
|
98
124
|
name: bundler
|
99
|
-
requirement:
|
100
|
-
none: false
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
101
126
|
requirements:
|
102
127
|
- - ~>
|
103
128
|
- !ruby/object:Gem::Version
|
104
129
|
version: '1.5'
|
105
130
|
type: :development
|
106
131
|
prerelease: false
|
107
|
-
version_requirements:
|
108
|
-
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ~>
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '1.5'
|
137
|
+
description: ' Ruby client that supports all of the GitHub API methods. It''s build
|
109
138
|
in a modular way, that is, you can either instantiate the whole api wrapper Github.new
|
110
139
|
or use parts of it e.i. Github::Client::Repos.new if working solely with repositories
|
111
140
|
is your main concern. Intuitive query methods allow you easily call API endpoints. '
|
@@ -650,6 +679,7 @@ files:
|
|
650
679
|
- spec/github/client/authorizations/delete_spec.rb
|
651
680
|
- spec/github/client/authorizations/get_spec.rb
|
652
681
|
- spec/github/client/authorizations/list_spec.rb
|
682
|
+
- spec/github/client/authorizations/two_factor_spec.rb
|
653
683
|
- spec/github/client/authorizations/update_spec.rb
|
654
684
|
- spec/github/client/gists/comments/create_spec.rb
|
655
685
|
- spec/github/client/gists/comments/delete_spec.rb
|
@@ -919,28 +949,28 @@ files:
|
|
919
949
|
- README.md
|
920
950
|
- LICENSE.txt
|
921
951
|
homepage: http://peter-murach.github.io/github/
|
922
|
-
licenses:
|
952
|
+
licenses:
|
953
|
+
- MIT
|
954
|
+
metadata: {}
|
923
955
|
post_install_message:
|
924
956
|
rdoc_options: []
|
925
957
|
require_paths:
|
926
958
|
- lib
|
927
959
|
required_ruby_version: !ruby/object:Gem::Requirement
|
928
|
-
none: false
|
929
960
|
requirements:
|
930
|
-
- -
|
961
|
+
- - '>='
|
931
962
|
- !ruby/object:Gem::Version
|
932
963
|
version: '0'
|
933
964
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
934
|
-
none: false
|
935
965
|
requirements:
|
936
|
-
- -
|
966
|
+
- - '>='
|
937
967
|
- !ruby/object:Gem::Version
|
938
968
|
version: '0'
|
939
969
|
requirements: []
|
940
970
|
rubyforge_project:
|
941
|
-
rubygems_version:
|
971
|
+
rubygems_version: 2.0.3
|
942
972
|
signing_key:
|
943
|
-
specification_version:
|
973
|
+
specification_version: 4
|
944
974
|
summary: Ruby client for the official GitHub API
|
945
975
|
test_files: []
|
946
976
|
has_rdoc:
|