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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e256a8b0669441065bf4b2d0b0d723afca73bbd
4
- data.tar.gz: e746fab54b71d2d0c6ff0923f6bb397d7a9d27ea
3
+ metadata.gz: 72c7246f1cc247ce77f93171fd082005a189ad88
4
+ data.tar.gz: c8bac31b37aa6d41914d4e3bf3ddcd8df46b4bbb
5
5
  SHA512:
6
- metadata.gz: 0c0b6e93e0334c4e143e01662e4daf70b20c89b24b519b645008de9eb8e009fe12d7a2410a00ea03e95896649822f5b641a7e046791fe5d4fc5bd7823c8bc1db
7
- data.tar.gz: 24e5d43a8d95fabb70b5200a3b58e3860c7f1742192d222f1698801722f6601b989ef3a88395ffa410b6e37cade38cd240c9a25ca40b44e727e91ae78a872b82
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.response && e.response[:status] == 401
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
@@ -1,3 +1,3 @@
1
1
  module Attune
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -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}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attune
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn