aptible-resource 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -4
- data/lib/aptible/resource/version.rb +1 -1
- data/lib/hyper_resource/exceptions.rb +6 -3
- data/spec/aptible/errors_spec.rb +12 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da52a6676fbc3aa9da01557a33bb0100139eaca9
|
4
|
+
data.tar.gz: ba7f27713f9c590644cfce371e3047f4648e96c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5cf5426a77887b729c706c441ce01247df3535a9f452a4754501735a6f0a85c3425ac2ad10f59438b1e4e40ea09d36ea8a32533ee6686a77d64aa4437cc591d
|
7
|
+
data.tar.gz: 2fa66a48ab851356d7e7b460cf2a6fefe53d2291144e1478dcfb287779b181ac4e64094e9e4fbca0fbdc26312b1a37a0dd49353db99b90cc2fb96d7493953b2a
|
data/.travis.yml
CHANGED
@@ -22,11 +22,14 @@ class HyperResource
|
|
22
22
|
self.body = attrs[:body]
|
23
23
|
|
24
24
|
## Try to help out with the message
|
25
|
-
if
|
26
|
-
if error =
|
25
|
+
if body
|
26
|
+
if (error = body['error'])
|
27
27
|
message = "#{message} (#{error})"
|
28
28
|
end
|
29
|
-
|
29
|
+
if (error_message = body['message'])
|
30
|
+
message = "#{message} (#{error_message})"
|
31
|
+
end
|
32
|
+
elsif response
|
30
33
|
message = "#{message} (#{response.body})"
|
31
34
|
end
|
32
35
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Aptible::Resource::Base do
|
4
|
+
it 'throws errors with a useful message' do
|
5
|
+
href = 'https://resource.example.com/mainframes/1'
|
6
|
+
body = { 'error' => 'unprocessable_entity', message: 'This is all wrong' }
|
7
|
+
stub_request(:get, href).to_return(body: JSON.unparse(body), status: 422)
|
8
|
+
|
9
|
+
expect { Api::Mainframe.find(1) }
|
10
|
+
.to raise_error(/unprocessable_entity.*all wrong/im)
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uri_template
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- lib/hyper_resource/objects.rb
|
222
222
|
- lib/hyper_resource/response.rb
|
223
223
|
- lib/hyper_resource/version.rb
|
224
|
+
- spec/aptible/errors_spec.rb
|
224
225
|
- spec/aptible/resource/base_spec.rb
|
225
226
|
- spec/aptible/resource/retry_spec.rb
|
226
227
|
- spec/fixtures/api.rb
|
@@ -247,11 +248,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
248
|
version: '0'
|
248
249
|
requirements: []
|
249
250
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.6.13
|
251
252
|
signing_key:
|
252
253
|
specification_version: 4
|
253
254
|
summary: Foundation classes for Aptible resource server gems
|
254
255
|
test_files:
|
256
|
+
- spec/aptible/errors_spec.rb
|
255
257
|
- spec/aptible/resource/base_spec.rb
|
256
258
|
- spec/aptible/resource/retry_spec.rb
|
257
259
|
- spec/fixtures/api.rb
|