berkshelf-api-client 1.1.0 → 1.1.1

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: b24984684bc4e74fd8c9e4c74a96e7387075c235
4
- data.tar.gz: 37fa9b61254d333c6b10abb5aff3638c807f09fa
3
+ metadata.gz: 1ae52121b8a453496aed06a502cf6f1a04db8064
4
+ data.tar.gz: acc3706fad1bf844627501bd60f2ccd1ddccbf0e
5
5
  SHA512:
6
- metadata.gz: a2687d666f257c2ec25c9786f1f25e12fc8c5cbcec50717b09c4b2570975013ca5a5d77502e6d6c1ee196d992d98669cb2334b03915f9397e6738b6933e203f1
7
- data.tar.gz: 3c210c34674982c6ec7411d2cdfb6520eae51349e711e8a81205bf64990cdef7af55860f1a31a8a01e1d343277152cf5253611e03fbebc32e87f087ca66e8522
6
+ metadata.gz: 9844b0690e99f908e45293c2ba693768379bb40d49097566d47a54fba3efa170dd9139a09bc2c97b3cb1e76c48d576f81e458c42a09dda2c59d938ce4f3a3ba1
7
+ data.tar.gz: e9ad01a91d38dfd169be53795fe351491eda4b0b6a8ab4b452aa6797940cae8aee2d63eec3caf0e9e6211e0f903e345d2ee8976aaff3e32fd3e6695c29f69f2b
@@ -8,4 +8,6 @@ notifications:
8
8
  - "irc.freenode.org#berkshelf"
9
9
  skip_join: true
10
10
  use_notice: true
11
+ before_install:
12
+ - sudo apt-get install -qq libarchive12 libarchive-dev
11
13
  script: bundle exec rake spec
@@ -1,6 +1,8 @@
1
1
  require 'faraday'
2
2
 
3
3
  module Berkshelf::APIClient
4
+ require_relative 'errors'
5
+
4
6
  class Connection < Faraday::Connection
5
7
  # @return [String]
6
8
  attr_reader :url
@@ -36,7 +38,10 @@ module Berkshelf::APIClient
36
38
  b.request :retry,
37
39
  max: self.retries,
38
40
  interval: self.retry_interval,
39
- exceptions: [ Faraday::Error::TimeoutError, Errno::ETIMEDOUT ]
41
+ exceptions: [
42
+ Faraday::Error::TimeoutError,
43
+ Errno::ETIMEDOUT
44
+ ]
40
45
 
41
46
  b.adapter :net_http
42
47
  end
@@ -62,14 +67,16 @@ module Berkshelf::APIClient
62
67
  end
63
68
  end
64
69
  when 404
65
- raise APIClient::ServiceNotFound, "service not found at: #{url}"
70
+ raise ServiceNotFound, "service not found at: #{url}"
66
71
  when 500..504
67
- raise APIClient::ServiceUnavaiable, "service unavailable at: #{url}"
72
+ raise ServiceUnavaiable, "service unavailable at: #{url}"
68
73
  else
69
- raise APIClient::BadResponse, "bad response #{response.inspect}"
74
+ raise BadResponse, "bad response #{response.inspect}"
70
75
  end
71
76
  rescue Faraday::Error::TimeoutError, Errno::ETIMEDOUT
72
- raise APIClient::TimeoutError, "Unable to connect to: #{url}"
77
+ raise TimeoutError, "Unable to connect to: #{url}"
78
+ rescue Faraday::Error::ConnectionFailed => ex
79
+ raise ServiceUnavaiable, ex
73
80
  end
74
81
  end
75
82
  end
@@ -1,5 +1,5 @@
1
1
  module Berkshelf
2
2
  module APIClient
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -53,5 +53,15 @@ describe Berkshelf::APIClient::Connection do
53
53
  expect(remote.location_type).to_not be_nil
54
54
  end
55
55
  end
56
+
57
+ context "when the connection to the service fails" do
58
+ before do
59
+ instance.should_receive(:get).and_raise(Faraday::Error::ConnectionFailed.new(StandardError))
60
+ end
61
+
62
+ it "raises a Berkshelf::APIClient::ServiceUnavaiable" do
63
+ expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavaiable)
64
+ end
65
+ end
56
66
  end
57
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-12-27 00:00:00.000000000 Z
13
+ date: 2013-12-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday