routemaster-drain 2.4.3 → 2.4.4

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: c7ca5be9d4b97210b633d75fcde82f08f2ad1ed8
4
- data.tar.gz: 7dabd1a62b742501ffe160c446663f4dc6311262
3
+ metadata.gz: cbb67c5fb3fc8aec8fe43fb6035f99672eb3ce87
4
+ data.tar.gz: bb35752a729017d5e15d3189ce60f93ef60abd60
5
5
  SHA512:
6
- metadata.gz: f2617c7f0a0106e2d3c1ae84db3d95cceabf305a9abaef3a3e72eca5d12547890d92291549a28bf28bd69a0cdb7395a0f9ed2a2f43f5bff781b19dc9555e131c
7
- data.tar.gz: c28e1ccf259db57ac7d484a893091185a2637ca59622f55aff5dd389267d355b387f9504ec9c3bde42f00b09cb63153ad589a760ce31ec5fbba154e71aa0a7ca
6
+ metadata.gz: b611d4238abac43c10ccd52413541cf272edd293694b42618084bc7393b63f2ca4e27d78e33cf71f4193369c54ae3916a0fca49b376eb99b86d220d7b8dae008
7
+ data.tar.gz: 004e39f85620152ae1c6275e1edbaa4867badf20b5adda669207079740bc2da746531c86eaf43d0e83da11765b6a5803aff1b4da1fd09cd8bc3ff5a8883446ed
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 2.4.4 (2017-03-27)
2
+
3
+ Features:
4
+
5
+ - Optionally wrap the APIClient actions inside a Response class (#37)
6
+
1
7
  ### 2.4.3 (2017-03-22)
2
8
 
3
9
  Bug fixes:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- routemaster-drain (2.4.3)
4
+ routemaster-drain (2.4.4)
5
5
  concurrent-ruby
6
6
  faraday (>= 0.9.0)
7
7
  faraday_middleware
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- routemaster-drain (2.4.3)
4
+ routemaster-drain (2.4.4)
5
5
  concurrent-ruby
6
6
  faraday (>= 0.9.0)
7
7
  faraday_middleware
@@ -236,4 +236,4 @@ DEPENDENCIES
236
236
  webmock
237
237
 
238
238
  BUNDLED WITH
239
- 1.14.5
239
+ 1.14.6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- routemaster-drain (2.4.3)
4
+ routemaster-drain (2.4.4)
5
5
  concurrent-ruby
6
6
  faraday (>= 0.9.0)
7
7
  faraday_middleware
@@ -253,4 +253,4 @@ DEPENDENCIES
253
253
  webmock
254
254
 
255
255
  BUNDLED WITH
256
- 1.14.5
256
+ 1.14.6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- routemaster-drain (2.4.3)
4
+ routemaster-drain (2.4.4)
5
5
  concurrent-ruby
6
6
  faraday (>= 0.9.0)
7
7
  faraday_middleware
@@ -256,4 +256,4 @@ DEPENDENCIES
256
256
  webmock
257
257
 
258
258
  BUNDLED WITH
259
- 1.14.5
259
+ 1.14.6
@@ -72,11 +72,19 @@ module Routemaster
72
72
  end
73
73
 
74
74
  def post(url, body: {}, headers: {})
75
- _request(:post, url: url, body: body, headers: headers)
75
+ _wrapped_response _request(
76
+ :post,
77
+ url: url,
78
+ body: body,
79
+ headers: headers)
76
80
  end
77
81
 
78
82
  def patch(url, body: {}, headers: {})
79
- _request(:patch, url: url, body: body, headers: headers)
83
+ _wrapped_response _request(
84
+ :patch,
85
+ url: url,
86
+ body: body,
87
+ headers: headers)
80
88
  end
81
89
 
82
90
  def delete(url, headers: {})
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '2.4.3'
3
+ VERSION = '2.4.4'
4
4
  end
5
5
  end
@@ -55,9 +55,19 @@ describe Routemaster::APIClient do
55
55
  expect(req.headers).to include('X-Custom-Header')
56
56
  end
57
57
  end
58
+ end
58
59
 
60
+ shared_examples 'a wrappable response' do
59
61
  context 'when response_class is present' do
60
62
  before do
63
+ @req = stub_request(:get, /example\.com/).to_return(
64
+ status: 200,
65
+ body: { id: 132, type: 'widget' }.to_json,
66
+ headers: {
67
+ 'content-type' => 'application/json;v=1'
68
+ }
69
+ )
70
+
61
71
  class DummyResponse
62
72
  def initialize(res, client: nil); end
63
73
  def dummy; true; end
@@ -75,11 +85,13 @@ describe Routemaster::APIClient do
75
85
  describe '#get' do
76
86
  subject { fetcher.get(url, headers: headers) }
77
87
  it_behaves_like 'a GET requester'
88
+ it_behaves_like 'a wrappable response'
78
89
  end
79
90
 
80
91
  describe '#fget' do
81
92
  subject { fetcher.fget(url, headers: headers) }
82
93
  it_behaves_like 'a GET requester'
94
+ it_behaves_like 'a wrappable response'
83
95
 
84
96
  context "when setting callbacks" do
85
97
  before do
@@ -147,6 +159,8 @@ describe Routemaster::APIClient do
147
159
  subject
148
160
  expect(@post_req).to have_been_requested
149
161
  end
162
+
163
+ it_behaves_like 'a wrappable response'
150
164
  end
151
165
 
152
166
  describe '#patch' do
@@ -166,6 +180,8 @@ describe Routemaster::APIClient do
166
180
  subject
167
181
  expect(@patch_req).to have_been_requested
168
182
  end
183
+
184
+ it_behaves_like 'a wrappable response'
169
185
  end
170
186
 
171
187
  describe '#delete' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routemaster-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday