distant 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/distant.gemspec +1 -1
- data/lib/distant/base.rb +3 -3
- data/spec/client/base_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc4ec26a4a9e4bdd296eec969e32c67415ebc70
|
4
|
+
data.tar.gz: d227f3cf38b58bbca5f38af2985a80872d2274ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b739b2e08643cc241c71720e6a57446518ea1f2f16da2c40ed5c701018d14019d29fd1c8c2acc2a2a71c6cadf1fc1d559ba7ea9af27d7fab7f6d1166700626b4
|
7
|
+
data.tar.gz: 593f74678551b439653706f448748f6d265653ff8d1b543aebe0d6beb104f095ea9adf3f437778997bfdd42af8a6cc3807db7976fd5057eeef331ca2fd02841a
|
data/distant.gemspec
CHANGED
data/lib/distant/base.rb
CHANGED
@@ -53,7 +53,7 @@ module Distant
|
|
53
53
|
path = path_closure_generator(route).call(*args)
|
54
54
|
headers = Distant.config.default_headers('')
|
55
55
|
.merge(Distant.config.auth_headers(''))
|
56
|
-
response_data = preprocess_response connection.get(path, headers)
|
56
|
+
response_data = preprocess_response connection.get(path, headers: headers)
|
57
57
|
if response_data.is_a? Array
|
58
58
|
response_data.map{ |item| marshal(item) }
|
59
59
|
else
|
@@ -68,7 +68,7 @@ module Distant
|
|
68
68
|
path = self.class.path_closure_generator(route).call(id: self.id)
|
69
69
|
headers = Distant.config.default_headers('')
|
70
70
|
.merge(Distant.config.auth_headers(''))
|
71
|
-
response_data = self.class.preprocess_response connection.get(path, headers)
|
71
|
+
response_data = self.class.preprocess_response connection.get(path, headers: headers)
|
72
72
|
class_ref = Kernel.const_get self.class.to_s.deconstantize + '::' + plural.to_s.singularize.classify
|
73
73
|
response_data.map{ |item| class_ref.marshal(item) }
|
74
74
|
end
|
@@ -82,7 +82,7 @@ module Distant
|
|
82
82
|
path = self.class.path_closure_generator(route).call(id: foreign_key_value)
|
83
83
|
headers = Distant.config.default_headers('')
|
84
84
|
.merge(Distant.config.auth_headers(''))
|
85
|
-
response_data = self.class.preprocess_response connection.get(path, headers)
|
85
|
+
response_data = self.class.preprocess_response connection.get(path, headers: headers)
|
86
86
|
class_ref = Kernel.const_get self.class.to_s.deconstantize + '::' + singular.to_s.classify
|
87
87
|
class_ref.marshal(response_data)
|
88
88
|
end
|
data/spec/client/base_spec.rb
CHANGED
@@ -121,7 +121,7 @@ describe Distant::Base do
|
|
121
121
|
expect(Distant::BaseTest).to receive(:preprocess_response){ [{id: 123}] }
|
122
122
|
end
|
123
123
|
it 'makes a GET request with the correct route' do
|
124
|
-
expect(Distant::Connection).to receive(:get).with(@route, {})
|
124
|
+
expect(Distant::Connection).to receive(:get).with(@route, headers: {})
|
125
125
|
# Finally:
|
126
126
|
Distant::BaseTest.all
|
127
127
|
end
|
@@ -131,7 +131,7 @@ describe Distant::Base do
|
|
131
131
|
expect(Distant::BaseTest).to receive(:preprocess_response){ {id: 123} }
|
132
132
|
end
|
133
133
|
it 'makes a GET request with the correct route' do
|
134
|
-
expect(Distant::Connection).to receive(:get).with(@single_route.gsub(':id', '123'), {})
|
134
|
+
expect(Distant::Connection).to receive(:get).with(@single_route.gsub(':id', '123'), headers: {})
|
135
135
|
# Finally:
|
136
136
|
Distant::BaseTest.find(id: 123)
|
137
137
|
end
|
@@ -151,7 +151,7 @@ describe Distant::Base do
|
|
151
151
|
expect(Distant::BaseTest).to receive(:preprocess_response){ [{base_test_id: 123, id: 456}]}
|
152
152
|
end
|
153
153
|
it 'makes a GET request with the correct route' do
|
154
|
-
expect(Distant::Connection).to receive(:get).with('/base/123/tests', {})
|
154
|
+
expect(Distant::Connection).to receive(:get).with('/base/123/tests', headers: {})
|
155
155
|
result = Distant::BaseTest.new(id: 123).sub_tests
|
156
156
|
expect(result.first).to be_a Distant::SubTest
|
157
157
|
end
|
@@ -171,7 +171,7 @@ describe Distant::Base do
|
|
171
171
|
expect(Distant::SubTest).to receive(:preprocess_response){ {id: 123, name: 'foo'}}
|
172
172
|
end
|
173
173
|
it 'makes a GET request with the correct route' do
|
174
|
-
expect(Distant::Connection).to receive(:get).with('/base/123', {})
|
174
|
+
expect(Distant::Connection).to receive(:get).with('/base/123', headers: {})
|
175
175
|
result = Distant::SubTest.new(id: 456, base_test_id: 123).base_test
|
176
176
|
expect(result).to be_a Distant::BaseTest
|
177
177
|
end
|