flexirest 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/flexirest/request.rb +5 -1
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/request_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 279ae7a2af0287f062269f28c6a7b0de3a68fc92
|
4
|
+
data.tar.gz: b3c284e4398f6c2ba6ce00febf171b9fa2646a82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b5d1fd29eee4108938611724a78058b9eb363a97ce9a36b60d20fa99c28328eaacd5e6e558a5b403938856932ad64ddee0ebf3dc7f1d0db3f3a28cb21774e56
|
7
|
+
data.tar.gz: 1b8c7df46edc7894d71f2e398dd9923a114fe136d38ee0667a5c5182cb90954dd42f0124858ee529504fedd719b2055a41b5da59a9d9cc28ce57d347d9356533
|
data/CHANGELOG.md
CHANGED
data/lib/flexirest/request.rb
CHANGED
@@ -226,7 +226,11 @@ module Flexirest
|
|
226
226
|
end
|
227
227
|
|
228
228
|
def prepare_params
|
229
|
-
|
229
|
+
if http_method == :post || http_method == :put || http_method == :patch
|
230
|
+
params = (@object._attributes rescue {}).merge(@params || {}) rescue {}
|
231
|
+
else
|
232
|
+
params = @params || @object._attributes rescue {}
|
233
|
+
end
|
230
234
|
if params.is_a?(String) || params.is_a?(Integer)
|
231
235
|
params = {id:params}
|
232
236
|
end
|
data/lib/flexirest/version.rb
CHANGED
data/spec/lib/request_spec.rb
CHANGED
@@ -768,6 +768,12 @@ describe Flexirest::Request do
|
|
768
768
|
expect{request.call}.to raise_error(Flexirest::InvalidRequestException)
|
769
769
|
end
|
770
770
|
|
771
|
+
it "should send all object's attributes and params through class mapped methods" do
|
772
|
+
expect_any_instance_of(Flexirest::Connection).to receive(:post).with("/create", "arg=2&prop=1", anything).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"first_name\":\"Johnny\", \"expenses\":[{\"amount\":1}, {\"amount\":2}]}", status:200, response_headers:{})))
|
773
|
+
client = ExampleClient.new(prop: "1")
|
774
|
+
client.create(arg: "2")
|
775
|
+
end
|
776
|
+
|
771
777
|
it "should send all class mapped methods through _callback_request" do
|
772
778
|
expect_any_instance_of(Flexirest::Connection).to receive(:get).with("/", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"first_name\":\"Johnny\", \"expenses\":[{\"amount\":1}, {\"amount\":2}]}", status:200, response_headers:{})))
|
773
779
|
expect(ExampleClient).to receive(:_callback_request).with(any_args).exactly(2).times
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexirest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|