flexirest 1.3.1 → 1.3.2

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: bd8c9e532875def5d80496e08867b0f12579dc1d
4
- data.tar.gz: f4e81c7652797f5fc3dac4c02870691b2b356583
3
+ metadata.gz: fc944642eeec80748c437111eb7e7b5b5ee98d40
4
+ data.tar.gz: f931c97b2a77159732a14e78e69f125ef006cd69
5
5
  SHA512:
6
- metadata.gz: 80628e8db4f74a856ba72a017d74f2bbd0225fe4bc5088f06b20e8a7e9b4d6a18f8132ff3adb43b14c2d7fc1e08571c3a3e9a3dc78a0ae3208146eaeb2f4fb19
7
- data.tar.gz: 5599b5a95be27c4c391a7cd60654cc0329d32e1f1faad43696b24c4baef0762ec2d907cd945250d74bdedaf50273c2919166e631277754b40986094051420cdc
6
+ metadata.gz: 72e1f0677d501933a37699452787dc2f7a43ee7919c94e362b6daf6f7eb1b5fd0fe65c5c7cd8254d90a1c9c2027ddbd4fa26151205f2976de7074421e7b9d1b4
7
+ data.tar.gz: 86f2aa14d43f8d16a3bdc69824e443eedb30ee6e645c402898d0dab9e0d41514f0ac26ae30acabecc90d599507fb9f19f85db0b2681d9be90b4fee3f5c300964
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.2
4
+
5
+ Features:
6
+
7
+ - Allow setting the body for a delete request - whether this is within HTTP spec is dubious, but a few APIs require it (thanks to Jeffrey Gu)
8
+
3
9
  ## 1.3.1
4
10
 
5
11
  Features:
@@ -81,12 +81,13 @@ module Flexirest
81
81
  end
82
82
  end
83
83
 
84
- def delete(path, options={})
84
+ def delete(path, data, options={})
85
85
  set_defaults(options)
86
86
  make_safe_request(path) do
87
87
  @session.delete(path) do |req|
88
88
  set_per_request_timeout(req, options) if options[:timeout]
89
89
  req.headers = req.headers.merge(options[:headers])
90
+ req.body = data
90
91
  sign_request(req, options[:api_auth])
91
92
  end
92
93
  end
@@ -350,7 +350,7 @@ module Flexirest
350
350
  when :patch
351
351
  response = connection.patch(@url, @body, request_options)
352
352
  when :delete
353
- response = connection.delete(@url, request_options)
353
+ response = connection.delete(@url, @body, request_options)
354
354
  else
355
355
  raise InvalidRequestException.new("Invalid method #{http_method}")
356
356
  end
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -45,8 +45,8 @@ describe Flexirest::Connection do
45
45
  end
46
46
 
47
47
  it "should pass a DELETE request through to Faraday" do
48
- stub_request(:delete, "www.example.com/foo").to_return(body: "{result:true}")
49
- result = @connection.delete("/foo")
48
+ stub_request(:delete, "www.example.com/foo").with(body: "body").to_return(body: "{result:true}")
49
+ result = @connection.delete("/foo", "body")
50
50
  expect(result.body).to eq("{result:true}")
51
51
  end
52
52
 
@@ -102,7 +102,7 @@ describe Flexirest::Connection do
102
102
  with(:headers => @default_headers).
103
103
  to_return(body: "{result:true}")
104
104
 
105
- result = @connection.delete("/foo")
105
+ result = @connection.delete("/foo", "body")
106
106
  expect(result.body).to eq("{result:true}")
107
107
  end
108
108
  end
@@ -113,7 +113,7 @@ describe Flexirest::Base do
113
113
  end
114
114
 
115
115
  it "handles DELETE requests" do
116
- expect_any_instance_of(Flexirest::Connection).to receive(:delete).with("/remove", instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"result\":true}", status:200, response_headers:{})))
116
+ expect_any_instance_of(Flexirest::Connection).to receive(:delete).with("/remove", "", instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"result\":true}", status:200, response_headers:{})))
117
117
  ProxyClientExample.remove
118
118
  end
119
119
 
@@ -104,7 +104,7 @@ describe Flexirest::Request do
104
104
  end
105
105
 
106
106
  it "should get an HTTP connection when called and call delete on it" do
107
- expect_any_instance_of(Flexirest::Connection).to receive(:delete).with("/remove/1", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:'{"result":true}', response_headers:{})))
107
+ expect_any_instance_of(Flexirest::Connection).to receive(:delete).with("/remove/1", "", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(body:'{"result":true}', response_headers:{})))
108
108
  ExampleClient.remove(id:1)
109
109
  end
110
110
 
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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler