restful_resource 2.17.0 → 2.18.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
  SHA256:
3
- metadata.gz: 4f1e1688884fd8954caa9da4cef1a9d2c3a1e294ded09414ce82a3865cf40e30
4
- data.tar.gz: cb8672227647b41612c0a6a9ba739dde8705fb353369347106b037cc4c2a45c2
3
+ metadata.gz: 4f45c7bb4d3a312e9e03f80bb613672260ea6db0d7eb025cd5b8f8e347c242ff
4
+ data.tar.gz: 5afb32e079d5006ca35680ae356ca657d4e66bee19432a3a797a0a377dea0ac6
5
5
  SHA512:
6
- metadata.gz: 676a02c4acb372b64b6a82e628cef146a2043709cecb56a9819e37ce253d15af0f386db2a9d6e08a5c9b02d5e7e8895b61e88af7065f560c941ccad1400a8daa
7
- data.tar.gz: e5ebf7348404ce117ac51963c23969754adbc144fbd97cc8ee4a967a80fe8c0a1a162ce55824800f5afd321167efe240fdb97226d05ded37fb74ba67209d6f4d
6
+ metadata.gz: b3b92083d51ee14c66d5f8640b56119d734b277a1a0cde77f6b44f8f18dfaa90f71a66d53b696a3b8c53734d78952032a0da1d746055e84cf6ce82abe54195ff
7
+ data.tar.gz: fcf23240eca478b98a05df1fc26680c1028873da7b9588c96635fab52be1bb91811cf8ac30f94a5b60c7a445e0daf162b43764ceca9503f9a3c862c5e386b6b8
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
  # Changelog
2
+ 2.18
3
+ ---
4
+
5
+ - Configure Faraday's default adapter as `net_http`
6
+ - Fix `X-Client-Start` & `X-Client-Timeout` headers to be strings not integers
7
+
2
8
  2.17
3
9
  ---
4
10
 
@@ -1,6 +1,3 @@
1
- # Use the Faraday-Typhoeus adapter provided by Typhoeus, not Faraday
2
- require 'typhoeus/adapters/faraday'
3
-
4
1
  module RestfulResource
5
2
  class HttpClient
6
3
  class HttpError < StandardError
@@ -240,7 +237,7 @@ module RestfulResource
240
237
  b.response :encoding
241
238
  b.use :gzip
242
239
 
243
- b.adapter :typhoeus
240
+ b.adapter Faraday.default_adapter
244
241
  end
245
242
  end
246
243
 
@@ -261,7 +258,7 @@ module RestfulResource
261
258
  req.url request.url
262
259
 
263
260
  req.headers = req.headers.merge(request.headers).merge(x_client_start: time_current_ms)
264
- req.headers = req.headers.merge(x_client_timeout: req.options[:timeout]) if req.options[:timeout]
261
+ req.headers = req.headers.merge(x_client_timeout: req.options[:timeout]&.to_s) if req.options[:timeout]
265
262
  end
266
263
 
267
264
  Response.new(body: response.body, headers: response.headers, status: response.status)
@@ -295,7 +292,7 @@ module RestfulResource
295
292
  end
296
293
 
297
294
  def time_current_ms
298
- (Time.current.to_f * 1_000.0).to_i
295
+ (Time.current.to_f * 1_000.0).to_i.to_s
299
296
  end
300
297
  end
301
298
  end
@@ -1,3 +1,3 @@
1
1
  module RestfulResource
2
- VERSION = '2.17.0'.freeze
2
+ VERSION = '2.18.0'.freeze
3
3
  end
@@ -34,5 +34,4 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency 'faraday_middleware', '~> 1.0'
35
35
  spec.add_dependency 'link_header'
36
36
  spec.add_dependency 'rack', '~> 2.2'
37
- spec.add_dependency 'typhoeus', '~> 1.4'
38
37
  end
@@ -18,8 +18,8 @@ describe RestfulResource::HttpClient do
18
18
  let(:middleware) { connection.builder.handlers }
19
19
 
20
20
  describe 'Builder configuration' do
21
- it 'uses the typhoeus adapter' do
22
- expect(connection.adapter).to eq Faraday::Adapter::Typhoeus
21
+ it 'uses the net http adapter' do
22
+ expect(connection.adapter).to eq Faraday::Adapter::NetHttp
23
23
  end
24
24
 
25
25
  it 'url_encodes requests' do
@@ -221,7 +221,7 @@ RSpec.describe RestfulResource::HttpClient do
221
221
 
222
222
  context 'when explicit timeout set on connection' do
223
223
  let(:timeout) { 5 }
224
- let(:required_headers) { { 'X-Client-Timeout' => 5 } }
224
+ let(:required_headers) { { 'X-Client-Timeout' => '5' } }
225
225
 
226
226
  it 'sets X-Client-Timeout correctly' do
227
227
  response = http_client.get('http://httpbin.org/get')
@@ -243,7 +243,7 @@ RSpec.describe RestfulResource::HttpClient do
243
243
 
244
244
  context 'when set on request' do
245
245
  let(:timeout) { nil }
246
- let(:required_headers) { { 'X-Client-Timeout' => 1 } }
246
+ let(:required_headers) { { 'X-Client-Timeout' => '1' } }
247
247
 
248
248
  it 'sets X-Client-Timeout correctly' do
249
249
  response = http_client.get('http://httpbin.org/get', timeout: 1)
@@ -255,7 +255,7 @@ RSpec.describe RestfulResource::HttpClient do
255
255
 
256
256
  describe 'X-Client-Start' do
257
257
  let(:now) { Time.current }
258
- let(:required_headers) { { 'X-Client-Start' => (now.to_f * 1000.0).to_i } }
258
+ let(:required_headers) { { 'X-Client-Start' => (now.to_f * 1000.0).to_i.to_s } }
259
259
  let(:http_client) { described_class.new(connection: connection) }
260
260
  let(:connection) do
261
261
  conn = faraday_connection do |stubs|
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.17.0
4
+ version: 2.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Santoro
8
8
  - Federico Rebora
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-03-05 00:00:00.000000000 Z
12
+ date: 2024-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -227,20 +227,6 @@ dependencies:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
229
  version: '2.2'
230
- - !ruby/object:Gem::Dependency
231
- name: typhoeus
232
- requirement: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: '1.4'
237
- type: :runtime
238
- prerelease: false
239
- version_requirements: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: '1.4'
244
230
  description: A simple activerecord inspired rest resource base class implemented using
245
231
  rest-client
246
232
  email:
@@ -297,7 +283,7 @@ homepage: http://www.github.com/carwow/restful_resource
297
283
  licenses:
298
284
  - MIT
299
285
  metadata: {}
300
- post_install_message:
286
+ post_install_message:
301
287
  rdoc_options: []
302
288
  require_paths:
303
289
  - lib
@@ -312,8 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
298
  - !ruby/object:Gem::Version
313
299
  version: '0'
314
300
  requirements: []
315
- rubygems_version: 3.4.19
316
- signing_key:
301
+ rubygems_version: 3.1.6
302
+ signing_key:
317
303
  specification_version: 4
318
304
  summary: A simple activerecord inspired rest resource base class implemented using
319
305
  rest-client