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 +5 -5
- data/lib/remote_resource.rb +1 -0
- data/lib/remote_resource/base.rb +5 -5
- data/lib/remote_resource/request.rb +1 -1
- data/lib/remote_resource/version.rb +1 -1
- data/remote_resource.gemspec +1 -0
- data/spec/lib/remote_resource/base_spec.rb +1 -1
- data/spec/lib/remote_resource/request_spec.rb +3 -3
- data/spec/lib/remote_resource/version_spec.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fe4c10288f80776d4eca63eb7f5f7db427b470d549e2050cef173a1719432e10
|
4
|
+
data.tar.gz: c6d661086f88ec0f9efd0b2c185f46824cfc9bbad46ae98a04db990907457a3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74d865281d9c94853ceff853318242bd412f34bacd33cb35c1aec4dbb3d02c55cee46a0cd412dd2fa9b6b903efaae7a339cd988a803436f6ba765510d0649022
|
7
|
+
data.tar.gz: cb9220f100cb61250b34f64c9368966aa300bf364a402d754b83b00f10ec78b95295b3274ce1e235bd37fbdebc3b959f0e311478aed153e7b9528308f8053006
|
data/lib/remote_resource.rb
CHANGED
data/lib/remote_resource/base.rb
CHANGED
@@ -28,11 +28,11 @@ module RemoteResource
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.global_headers=(headers)
|
31
|
-
|
31
|
+
RequestStore.store[:global_headers] = headers
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.global_headers
|
35
|
-
|
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
|
-
|
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
|
-
|
50
|
+
RequestStore.store[threaded_connection_options_thread_name] = threaded_connection_options.merge(connection_options)
|
51
51
|
yield
|
52
52
|
ensure
|
53
|
-
|
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' =>
|
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
|
|
data/remote_resource.gemspec
CHANGED
@@ -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
|
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
|
543
|
+
context 'when RequestStore.store[:request_id] is present' do
|
544
544
|
before do
|
545
|
-
|
545
|
+
RequestStore.store[:request_id] = 'CASCADING-REQUEST-ID'
|
546
546
|
end
|
547
547
|
|
548
548
|
after do
|
549
|
-
|
549
|
+
RequestStore.store[:request_id] = nil
|
550
550
|
end
|
551
551
|
|
552
552
|
let(:expected_headers) do
|
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
|
+
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-
|
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.
|
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.
|