smooth_operator 1.30.8 → 1.30.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/smooth_operator/operator.rb +11 -7
- data/lib/smooth_operator/version.rb +1 -1
- data/spec/smooth_operator/attribute_assignment_spec.rb +1 -1
- data/spec/smooth_operator/finder_methods_spec.rb +10 -0
- data/spec/smooth_operator/operator_spec.rb +3 -3
- data/spec/smooth_operator/remote_call_spec.rb +1 -1
- data/spec/support/test_server.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2ExMjI4NTIwZGI3MjZiYWRiODBhZWMyMDI4M2M2ZDQxZWU3MmVhZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2JjYmM4ODM0M2FiZTJkNzgxZTZjNzk1NjgyMTJjNWE1MGEwOTllNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDA1MDEzNzZiN2M1OWZkNzk3MGEwOGMwOTk4YzE1Y2FiODE3NTRlMTRjOGI5
|
10
|
+
NzRlYjJhZDkzNzFmOWY1YTYyZTU2YTI5ZWQ2NzI4ZTBjNzJkMjc2OTQ3NmU0
|
11
|
+
MjQ2Zjk5NmQ3MzhkNWJkY2FkYzJkZDhhMDdmNGRkOTA0OGU4NTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTMyM2JhNjU3MjE5OTRiNzFjZDIzNzJiNzA4ZDcxOTM5MzY3NjU1NTEyNGU2
|
14
|
+
NzhjNWJlOWU4ZDMzY2M2YWI2NDUxNjZiMTE0NzVjNTY5ZTk2Y2Q3NDA3ZjUz
|
15
|
+
ODllMGViZDIzYTZkNDczYWFmYzUzYzNlYTZlNTI3ZjdiZDU2ZmE=
|
@@ -13,13 +13,7 @@ module SmoothOperator
|
|
13
13
|
|
14
14
|
relative_path = resource_path(relative_path)
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
if !parent_object.nil? && options[:ignore_parent] != true
|
19
|
-
id = Helpers.primary_key(parent_object)
|
20
|
-
|
21
|
-
options[:resources_name] ||= "#{parent_object.class.resources_name}/#{id}/#{self.class.resources_name}"
|
22
|
-
end
|
16
|
+
options[:parent_object] ||= _options[:parent_object]
|
23
17
|
|
24
18
|
call_args = before_request(http_verb, relative_path, data, options)
|
25
19
|
|
@@ -127,6 +121,16 @@ module SmoothOperator
|
|
127
121
|
|
128
122
|
options[:headers] = object.headers.merge(options[:headers] || {})
|
129
123
|
|
124
|
+
parent_object = options[:parent_object]
|
125
|
+
|
126
|
+
if !parent_object.nil? && options[:ignore_parent] != true
|
127
|
+
id = Helpers.primary_key(parent_object)
|
128
|
+
|
129
|
+
id = "#{id}/" if Helpers.present?(id)
|
130
|
+
|
131
|
+
options[:resources_name] ||= "#{parent_object.class.resources_name}/#{id}#{object.resources_name}"
|
132
|
+
end
|
133
|
+
|
130
134
|
options
|
131
135
|
end
|
132
136
|
|
@@ -61,7 +61,7 @@ describe SmoothOperator::AttributeAssignment do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
context "when one of the attribute's value, is an hash and is unknown to the schema" do
|
64
|
-
context "when the .unknown_hash_class is unused"
|
64
|
+
context "when the .unknown_hash_class is unused" do
|
65
65
|
subject { User::Base.new(address: { street: 'something', postal_code: { code: '123' } }) }
|
66
66
|
|
67
67
|
it "a new instance of OpenStruct will be initialized with that hash" do
|
@@ -33,6 +33,16 @@ describe SmoothOperator::FinderMethods do
|
|
33
33
|
# end
|
34
34
|
|
35
35
|
describe ".find" do
|
36
|
+
context "when using parent_object option", current: true do
|
37
|
+
it "should return nested data" do
|
38
|
+
user = User::Base.new(id: 1)
|
39
|
+
remote_call = Post.find(5, nil, parent_object: user)
|
40
|
+
|
41
|
+
expect(remote_call.parsed_response)
|
42
|
+
.to eq({ 'id' => 1, 'body' => 'from_nested_url' })
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
36
46
|
context "when the server returns a single hash" do
|
37
47
|
let(:user) { subject.find(5).data }
|
38
48
|
|
@@ -17,7 +17,7 @@ describe SmoothOperator::Operator do
|
|
17
17
|
|
18
18
|
context "submiting a complex hash" do
|
19
19
|
|
20
|
-
|
20
|
+
xit 'should correctly encode that hash' do
|
21
21
|
remote_call = subject.get('test_complex_hash', attributes_for(:user_with_complex_hash))
|
22
22
|
|
23
23
|
expect(remote_call.status).to eq(true)
|
@@ -45,9 +45,9 @@ describe SmoothOperator::Operator do
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
-
context "submiting a complex hash"
|
48
|
+
context "submiting a complex hash" do
|
49
49
|
|
50
|
-
|
50
|
+
xit 'should correctly encode that hash' do
|
51
51
|
remote_call = subject.post('test_complex_hash', attributes_for(:user_with_complex_hash))
|
52
52
|
|
53
53
|
expect(remote_call.status).to eq(true)
|
@@ -260,7 +260,7 @@ describe SmoothOperator::RemoteCall do
|
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
context "when the connection exceeds the timeout"
|
263
|
+
context "when the connection exceeds the timeout" do
|
264
264
|
before(:all) do
|
265
265
|
@subject = User::TimeoutConnection.new
|
266
266
|
@subject.save('/timeout')
|
data/spec/support/test_server.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smooth_operator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.30.
|
4
|
+
version: 1.30.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Gonçalves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|