orchestrate 0.6.2 → 0.6.3

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: 155ad76859df4168e1f6c4bccb31aa3653c8d818
4
- data.tar.gz: ff250dcd5c8fee7d94517aee3cc4ca3779111b08
3
+ metadata.gz: 280e11fed61bfb3b020de4fbed4b67d4392fd8f7
4
+ data.tar.gz: b454f95ec082424d99e99882ca4c9707da555f55
5
5
  SHA512:
6
- metadata.gz: 29dc0b21580643d4dc2f064a0db2794be8d2d91abadb1ebc7f81c40359801aafe7fd6991de2c0739bd4b7a19449038c747940b4a3f1e419b7c2104c4ce386fb3
7
- data.tar.gz: 6bdadb28536cefb2b8969e4e98f7ea2c8da1f13b1344395fb7407508c51ee863d70bc2cecf3129897942ab5fdf51be0324f3a743e9f3ebfe65770ae2e928705b
6
+ metadata.gz: e642894e20da91faa3aa746f217b6678273f9060e47aa4ad1664e3515208e8b96df6ebe4277d6b54c53995448ad7e74fc74dacae8760368821a1a42851275528
7
+ data.tar.gz: 03daed3e82a28e5c34de96568605dc313bb16338cf43369900eda1effee84ac000f380f6534c816341ad37353f734b2cd7418ef81f4ae0910618946145a703cd
data/README.md CHANGED
@@ -104,6 +104,9 @@ end
104
104
 
105
105
  ## Release Notes
106
106
 
107
+ - June 24, 2014: release 0.6.3
108
+ - Fix #55 to handle ping responses when unauthorized
109
+
107
110
  - June 24, 2014: release 0.6.2
108
111
  - Fix #48 to remove trailing -gzip from Etag header for ref value.
109
112
  - Custom #to_s and #inspect methods for Client, Response classes.
@@ -16,7 +16,7 @@ module Orchestrate::API
16
16
  # @param response [Faraday::Response] The response that caused the error.
17
17
  def initialize(response)
18
18
  @response = response
19
- if response.headers['Content-Type'] == 'application/json'
19
+ if response.headers['Content-Type'] == 'application/json' && response.body
20
20
  super(response.body['message'])
21
21
  else
22
22
  super(response.body)
@@ -396,8 +396,13 @@ module Orchestrate
396
396
  end
397
397
 
398
398
  if ! response.success?
399
- err_type = API::ERRORS.find do |err|
400
- err.status == response.status && err.code == response.body['code']
399
+ err_type = if response.body
400
+ API::ERRORS.find do |err|
401
+ err.status == response.status && err.code == response.body['code']
402
+ end
403
+ else
404
+ errors = API::ERRORS.select {|err| err.status == response.status }
405
+ errors.length == 1 ? errors.first : nil
401
406
  end
402
407
  if err_type
403
408
  raise err_type.new(response)
@@ -1,3 +1,3 @@
1
1
  module Orchestrate
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -36,4 +36,13 @@ describe Orchestrate::Client do
36
36
  client.ping
37
37
  end
38
38
 
39
+ it "handles ping with invalid api_key and raises Unauthorized" do
40
+ client, stubs = make_client_and_artifacts
41
+ headers = response_headers
42
+ stubs.head("/v0") { [ 401, headers, '' ] }
43
+ assert_raises Orchestrate::API::Unauthorized do
44
+ client.ping
45
+ end
46
+ end
47
+
39
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orchestrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Lyon
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-24 00:00:00.000000000 Z
13
+ date: 2014-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday