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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f28de2c590cd7b7b1e6f697ee8a7754b2229dd1
4
- data.tar.gz: 4a5e1f2611b17b356af7660225d9bb5851131a7d
3
+ metadata.gz: 279ae7a2af0287f062269f28c6a7b0de3a68fc92
4
+ data.tar.gz: b3c284e4398f6c2ba6ce00febf171b9fa2646a82
5
5
  SHA512:
6
- metadata.gz: c4f74bc929c9286f645fa652dfb8cace3ad70b463ca29272eb55a48b61ad1273239221c5ace8d10428c45423439fe64cf0675c19df3b66e6d2327900b92b9bb5
7
- data.tar.gz: b1df82262931a447f99670d097dc662cac1b6c21733709640bea16d0133c4dbd143f3e792cfd4c88921ad3f95ba56d49ae874ea01a153a2424f41ea355d17984
6
+ metadata.gz: 0b5d1fd29eee4108938611724a78058b9eb363a97ce9a36b60d20fa99c28328eaacd5e6e558a5b403938856932ad64ddee0ebf3dc7f1d0db3f3a28cb21774e56
7
+ data.tar.gz: 1b8c7df46edc7894d71f2e398dd9923a114fe136d38ee0667a5c5182cb90954dd42f0124858ee529504fedd719b2055a41b5da59a9d9cc28ce57d347d9356533
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.1
4
+
5
+ Bugfix:
6
+
7
+ - PUT/POST/PATCH methods called on an instantiated object should merge the objects attributes with specified params.
8
+
3
9
  ## 1.5.0
4
10
 
5
11
  Bugfix:
@@ -226,7 +226,11 @@ module Flexirest
226
226
  end
227
227
 
228
228
  def prepare_params
229
- params = @params || @object._attributes rescue {}
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
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -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.0
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-09-29 00:00:00.000000000 Z
11
+ date: 2017-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler