attune 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/attune/client.rb +7 -5
- data/lib/attune/version.rb +1 -1
- data/spec/attune/client_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c7246f1cc247ce77f93171fd082005a189ad88
|
4
|
+
data.tar.gz: c8bac31b37aa6d41914d4e3bf3ddcd8df46b4bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1ed5785966bc47a9c689735e4b459e295e49d5a3eb1f038adafc87e6bc9de462c0c53bcb05b76f4ef5d7c1752500c930d0e67bd5d8636a2a4459a94da3d1e2f
|
7
|
+
data.tar.gz: 79c8838e7273852fd7908cf9e5adfba6dd0706174582798fc85b2af3a7df163ed18428f13f2119436a9356b142297d8c1c3801a5384e067cee2a040e49e7a277
|
data/lib/attune/client.rb
CHANGED
@@ -211,19 +211,19 @@ module Attune
|
|
211
211
|
|
212
212
|
def get(path, params={})
|
213
213
|
adapter.get(path, params)
|
214
|
-
rescue Faraday::Error::ClientError => e
|
214
|
+
rescue Errno::ENOENT, Faraday::Error::ClientError => e
|
215
215
|
handle_exception(e)
|
216
216
|
end
|
217
217
|
|
218
218
|
def put(path, params={})
|
219
219
|
adapter.put(path, ::JSON.dump(params))
|
220
|
-
rescue Faraday::Error::ClientError => e
|
220
|
+
rescue Errno::ENOENT, Faraday::Error::ClientError => e
|
221
221
|
handle_exception(e)
|
222
222
|
end
|
223
223
|
|
224
224
|
def post_form(path, params={})
|
225
225
|
adapter.post(path, params)
|
226
|
-
rescue Faraday::Error::ClientError => e
|
226
|
+
rescue Errno::ENOENT, Faraday::Error::ClientError => e
|
227
227
|
handle_exception(e)
|
228
228
|
end
|
229
229
|
|
@@ -233,7 +233,7 @@ module Attune
|
|
233
233
|
req.headers['Content-Type'] = 'application/json'
|
234
234
|
req.body = ::JSON.dump(params)
|
235
235
|
end
|
236
|
-
rescue Faraday::Error::ClientError => e
|
236
|
+
rescue Errno::ENOENT, Faraday::Error::ClientError => e
|
237
237
|
handle_exception(e)
|
238
238
|
end
|
239
239
|
|
@@ -241,7 +241,9 @@ module Attune
|
|
241
241
|
if exception_handler == :mock
|
242
242
|
nil
|
243
243
|
else
|
244
|
-
if e.
|
244
|
+
if e.is_a? Errno::ENOENT
|
245
|
+
raise Faraday::Error::ConnectionFailed, e
|
246
|
+
elsif e.response && e.response[:status] == 401
|
245
247
|
raise AuthenticationException, e
|
246
248
|
else
|
247
249
|
raise e
|
data/lib/attune/version.rb
CHANGED
data/spec/attune/client_spec.rb
CHANGED
@@ -38,6 +38,12 @@ describe Attune::Client do
|
|
38
38
|
}.to raise_exception(Faraday::Error::ConnectionFailed)
|
39
39
|
stubs.verify_stubbed_calls
|
40
40
|
end
|
41
|
+
it "will raise ConnectionFailed on Errno::ENOENT" do
|
42
|
+
stubs.post("anonymous", %[{"user_agent":"Mozilla/5.0"}]){ raise Errno::ENOENT.new("test") }
|
43
|
+
expect {
|
44
|
+
client.create_anonymous(user_agent: 'Mozilla/5.0')
|
45
|
+
}.to raise_exception(Faraday::Error::ConnectionFailed)
|
46
|
+
end
|
41
47
|
it "will raise AuthenticationException" do
|
42
48
|
stubs.post("oauth/token",
|
43
49
|
{:client_id=>"id", :client_secret=>"secret", grant_type: :client_credentials}
|