gh 0.15.1 → 0.16.0.beta1

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
- SHA1:
3
- metadata.gz: 8fab2ae8cd99902e2fb8f8badecc90f5056ed754
4
- data.tar.gz: 3ad932435afaecc20a03a4690f01318808ab5abb
2
+ SHA256:
3
+ metadata.gz: 1891c12626a4b407757f0603a2a53a5b00ef9ba9ec4abed42becbc9678bfff6f
4
+ data.tar.gz: e68dee1e1a8530f3522e994dfbe8966b393af9fd8116e04b614a04f3bed1c76b
5
5
  SHA512:
6
- metadata.gz: 5068abca1b2d7973d394f2c515cfb01bef3bed872715034f6ae4d8c77a91f5e067b332e6d100c6d3ee7672c9b36ddc32f6e9eaa9c69e9daedc593ce07785eb83
7
- data.tar.gz: 71c9e7e8a50f835308af888d5e25a7ff84873ec0fe567f2ae82f04d6d1be00a97346e614fcb4f6d78e6a0e089c29f35bbc79cffcbb7da4dded93827ac19f7758
6
+ metadata.gz: '06648d300e04f447cd2d1b5fb1543dfe67601b06a32e0a62ff8e7e47d14efe731240777caf9939998844f02790fcc86cd2b1a2d707412717eb7e8323e36d5ef1'
7
+ data.tar.gz: 3003c253379c106b40d94f05ba4d7f546669fd28b528ba645c5dcf7156ab65b4bc4378815abec166ba93c66cd6cd7d01cfd06e42a0fc5f0e94a12d39ec3a6e74
data/lib/gh.rb CHANGED
@@ -7,7 +7,6 @@ module GH
7
7
  autoload :Case, 'gh/case'
8
8
  autoload :CustomLimit, 'gh/custom_limit'
9
9
  autoload :Error, 'gh/error'
10
- autoload :FaradayAdapter, 'gh/faraday_adapter'
11
10
  autoload :Instrumentation, 'gh/instrumentation'
12
11
  autoload :LazyLoader, 'gh/lazy_loader'
13
12
  autoload :LinkFollower, 'gh/link_follower'
@@ -58,9 +58,9 @@ module GH
58
58
 
59
59
  def github_done_checking?(hash)
60
60
  case hash['mergeable_state']
61
- when 'checking' then false
62
- when 'unknown' then hash['merged']
63
- when 'clean', 'dirty', 'unstable', 'stable', 'blocked', 'behind' then true
61
+ when 'checking' then false
62
+ when 'unknown' then hash['merged']
63
+ when 'clean', 'dirty', 'unstable', 'stable', 'blocked', 'behind', 'draft' then true
64
64
  else fail "unknown mergeable_state #{hash['mergeable_state'].inspect} for #{url(hash)}"
65
65
  end
66
66
  end
@@ -7,7 +7,7 @@ module GH
7
7
  class Remote < Wrapper
8
8
  attr_reader :api_host, :connection, :headers, :prefix
9
9
 
10
- # Public: Generates a new Rempte instance.
10
+ # Public: Generates a new Remote instance.
11
11
  #
12
12
  # api_host - HTTP host to send requests to, has to include schema (https or http)
13
13
  # options - Hash with configuration options:
@@ -16,7 +16,6 @@ module GH
16
16
  # :password - Github password used for login (optional).
17
17
  # :origin - Value of the origin request header (optional).
18
18
  # :headers - HTTP headers to be send on every request (optional).
19
- # :adapter - HTTP library to use for making requests (optional, default: :net_http)
20
19
  #
21
20
  # It is highly recommended to set origin, but not to set headers.
22
21
  # If you set the username, you should also set the password.
@@ -48,7 +47,9 @@ module GH
48
47
  builder.request(:basic_auth, username, password) if username and password
49
48
  builder.request(:retry)
50
49
  builder.response(:raise_error)
51
- #builder.use(options[:adapter] || GH::FaradayAdapter)
50
+ if defined? FaradayMiddleware::Instrumentation
51
+ builder.use :instrumentation
52
+ end
52
53
  builder.adapter(:net_http)
53
54
  end
54
55
  end
@@ -74,7 +75,8 @@ module GH
74
75
 
75
76
  # Internal: ...
76
77
  def http(verb, url, headers = {}, &block)
77
- connection.run_request(verb, url, nil, headers, &block)
78
+ body = headers.delete :body
79
+ connection.run_request(verb, url, body, headers, &block)
78
80
  rescue Exception => error
79
81
  raise Error.new(error, nil, :verb => verb, :url => url, :headers => headers)
80
82
  end
@@ -18,7 +18,7 @@ module GH
18
18
  @check_token = false
19
19
 
20
20
  auth_header = "Basic %s" % Base64.encode64("#{client_id}:#{client_secret}").gsub("\n", "")
21
- http :head, path_for("/applications/#{client_id}/tokens/#{token}?client_id=#{client_id}&client_secret=#{client_secret}"), "Authorization" => auth_header
21
+ http :post, path_for("/applications/#{client_id}/token"), :body => "{\"access_token\": \"#{token}\"}", "Authorization" => auth_header
22
22
  rescue GH::Error(:response_status => 404) => error
23
23
  raise GH::TokenInvalid, error
24
24
  end
@@ -1,4 +1,4 @@
1
1
  module GH
2
2
  # Public: Library version.
3
- VERSION = '0.15.1'
3
+ VERSION = '0.16.0.beta1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -53,19 +53,33 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.8'
55
55
  - !ruby/object:Gem::Dependency
56
- name: backports
56
+ name: faraday_middleware
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.14'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: multi_json
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 2.4.0
103
+ version: '2.4'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 2.4.0
110
+ version: '2.4'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: net-http-persistent
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +149,6 @@ files:
135
149
  - lib/gh/case.rb
136
150
  - lib/gh/custom_limit.rb
137
151
  - lib/gh/error.rb
138
- - lib/gh/faraday_adapter.rb
139
152
  - lib/gh/instrumentation.rb
140
153
  - lib/gh/lazy_loader.rb
141
154
  - lib/gh/link_follower.rb
@@ -163,15 +176,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
176
  requirements:
164
177
  - - ">="
165
178
  - !ruby/object:Gem::Version
166
- version: '0'
179
+ version: 2.3.0
167
180
  required_rubygems_version: !ruby/object:Gem::Requirement
168
181
  requirements:
169
- - - ">="
182
+ - - ">"
170
183
  - !ruby/object:Gem::Version
171
- version: '0'
184
+ version: 1.3.1
172
185
  requirements: []
173
186
  rubyforge_project:
174
- rubygems_version: 2.5.1
187
+ rubygems_version: 2.7.6.2
175
188
  signing_key:
176
189
  specification_version: 4
177
190
  summary: layered github client
@@ -1,60 +0,0 @@
1
- require 'gh'
2
- require 'faraday'
3
- require 'thread'
4
- require 'net/https'
5
- require 'net/http/pipeline'
6
- require 'net/http/persistent'
7
-
8
- module GH
9
- # Faraday adapter based on Net::HTTP, with persistent connection and pipeline support.
10
- class FaradayAdapter < Faraday::Adapter::NetHttpPersistent
11
- class Manager
12
- def initialize(*)
13
- @mutex = Mutex.new
14
- @requests = {}
15
- end
16
-
17
- def add_request(http, env, adapter)
18
- url = env[:url] + '/'
19
- env[:adapter] = adapter
20
-
21
- @mutex.synchronize do
22
- @requests[url] ||= []
23
- @requests[url] << env
24
- end
25
- end
26
-
27
- def run
28
- requests = nil
29
- @mutex.synchronize { requests, @requests = @requests, {} }
30
- http = Net::HTTP::Persistent.new 'GH'
31
- requests.each do |url, envs|
32
- _requests = envs.map { |env| env[:adapter].create_request(env) }
33
- responses = http.pipeline(url, _requests)
34
- envs.zip(responses) do |env, http_response|
35
- env[:adapter].save_response(env, http_response.code.to_i, http_response.body) do |headers|
36
- http_response.each_header { |key, value| headers[key] = value }
37
- end
38
- env[:response].finish(env)
39
- end
40
- end
41
- end
42
- end
43
-
44
- self.supports_parallel = true
45
-
46
- def self.setup_parallel_manager(options = {})
47
- Manager.new(options)
48
- end
49
-
50
- def call(env)
51
- catch(:parallel) { super }
52
- end
53
-
54
- def perform_request(http, env)
55
- return super unless env[:parallel_manager]
56
- env[:parallel_manager].add_request(http, env, self)
57
- throw :parallel, @app.call(env)
58
- end
59
- end
60
- end