ddy_remote_resource 1.0.4 → 1.0.5

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: 53853b2bc923849611145a783562290e1f352db4
4
- data.tar.gz: 68fe3d657f0635f6ce22131cd6d61b356b005c49
2
+ SHA256:
3
+ metadata.gz: fe4c10288f80776d4eca63eb7f5f7db427b470d549e2050cef173a1719432e10
4
+ data.tar.gz: c6d661086f88ec0f9efd0b2c185f46824cfc9bbad46ae98a04db990907457a3c
5
5
  SHA512:
6
- metadata.gz: 36a1aac2f46e915fc618f9d3dddfca865c9682845c017069bf6fb7508d0b7429f0eb98e950bf62f18d1cae9790fa11b01407a4e66110d7ea5a03298bd0efd599
7
- data.tar.gz: 2ccaff6087c60d3629fd94889fd7d50c34b9c07fa822c0a0eeb1ce4f98ada89a220200a1cfb774f7dfeb7db30ee317d21f07e7734c4715f9355f5e6e03585db1
6
+ metadata.gz: 74d865281d9c94853ceff853318242bd412f34bacd33cb35c1aec4dbb3d02c55cee46a0cd412dd2fa9b6b903efaae7a339cd988a803436f6ba765510d0649022
7
+ data.tar.gz: cb9220f100cb61250b34f64c9368966aa300bf364a402d754b83b00f10ec78b95295b3274ce1e235bd37fbdebc3b959f0e311478aed153e7b9528308f8053006
@@ -2,6 +2,7 @@ require 'active_support/all'
2
2
  require 'active_model'
3
3
  require 'virtus'
4
4
  require 'typhoeus'
5
+ require 'request_store'
5
6
 
6
7
  require_relative 'extensions/ethon/easy/queryable'
7
8
 
@@ -28,11 +28,11 @@ module RemoteResource
28
28
  end
29
29
 
30
30
  def self.global_headers=(headers)
31
- Thread.current[:global_headers] = headers
31
+ RequestStore.store[:global_headers] = headers
32
32
  end
33
33
 
34
34
  def self.global_headers
35
- Thread.current[:global_headers] ||= {}
35
+ RequestStore.store[:global_headers] ||= {}
36
36
  end
37
37
 
38
38
  module ClassMethods
@@ -42,15 +42,15 @@ module RemoteResource
42
42
  end
43
43
 
44
44
  def threaded_connection_options
45
- Thread.current[threaded_connection_options_thread_name] ||= {}
45
+ RequestStore.store[threaded_connection_options_thread_name] ||= {}
46
46
  end
47
47
 
48
48
  def with_connection_options(connection_options = {})
49
49
  begin
50
- Thread.current[threaded_connection_options_thread_name] = threaded_connection_options.merge(connection_options)
50
+ RequestStore.store[threaded_connection_options_thread_name] = threaded_connection_options.merge(connection_options)
51
51
  yield
52
52
  ensure
53
- Thread.current[threaded_connection_options_thread_name] = nil
53
+ RequestStore.store[threaded_connection_options_thread_name] = nil
54
54
  end
55
55
  end
56
56
 
@@ -106,7 +106,7 @@ module RemoteResource
106
106
  def conditional_headers
107
107
  headers = {}
108
108
  headers = headers.merge(DEFAULT_CONTENT_TYPE) if body.present?
109
- headers = headers.merge({ 'X-Request-Id' => Thread.current[:request_id] }) if Thread.current[:request_id].present?
109
+ headers = headers.merge({ 'X-Request-Id' => RequestStore.store[:request_id] }) if RequestStore.store[:request_id].present?
110
110
  headers
111
111
  end
112
112
 
@@ -1,3 +1,3 @@
1
1
  module RemoteResource
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency 'mime-types', '~> 3.0'
34
34
  spec.add_runtime_dependency 'ethon', '~> 0.7', '>= 0.7.1'
35
35
  spec.add_runtime_dependency 'typhoeus', '~> 0.7', '>= 0.7.0'
36
+ spec.add_runtime_dependency 'request_store', '~> 1.4.1'
36
37
  end
@@ -81,7 +81,7 @@ RSpec.describe RemoteResource::Base do
81
81
  end
82
82
 
83
83
  it 'sets the name of Thread variable with the implemented class' do
84
- expect(dummy_class.threaded_connection_options).to eql Thread.current['remote_resource.dummy.threaded_connection_options']
84
+ expect(dummy_class.threaded_connection_options).to eql RequestStore.store['remote_resource.dummy.threaded_connection_options']
85
85
  end
86
86
  end
87
87
 
@@ -540,13 +540,13 @@ RSpec.describe RemoteResource::Request do
540
540
  end
541
541
  end
542
542
 
543
- context 'when Thread.current[:request_id] is present' do
543
+ context 'when RequestStore.store[:request_id] is present' do
544
544
  before do
545
- Thread.current[:request_id] = 'CASCADING-REQUEST-ID'
545
+ RequestStore.store[:request_id] = 'CASCADING-REQUEST-ID'
546
546
  end
547
547
 
548
548
  after do
549
- Thread.current[:request_id] = nil
549
+ RequestStore.store[:request_id] = nil
550
550
  end
551
551
 
552
552
  let(:expected_headers) do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe RemoteResource::VERSION do
4
- it { is_expected.to eql '1.0.4' }
4
+ it { is_expected.to eql '1.0.5' }
5
5
  end
6
6
 
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddy_remote_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan van der Pas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -222,6 +222,20 @@ dependencies:
222
222
  - - ">="
223
223
  - !ruby/object:Gem::Version
224
224
  version: 0.7.0
225
+ - !ruby/object:Gem::Dependency
226
+ name: request_store
227
+ requirement: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - "~>"
230
+ - !ruby/object:Gem::Version
231
+ version: 1.4.1
232
+ type: :runtime
233
+ prerelease: false
234
+ version_requirements: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - "~>"
237
+ - !ruby/object:Gem::Version
238
+ version: 1.4.1
225
239
  description: RemoteResource, a gem to use resources with REST services. A replacement
226
240
  for ActiveResource gem.
227
241
  email:
@@ -306,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
320
  version: '0'
307
321
  requirements: []
308
322
  rubyforge_project:
309
- rubygems_version: 2.5.1
323
+ rubygems_version: 2.7.7
310
324
  signing_key:
311
325
  specification_version: 4
312
326
  summary: RemoteResource, a gem to use resources with REST services.