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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dded993c5744f3cdda2e692ac1ad19dc5d45a334
4
- data.tar.gz: d2351212650888e95d0ae6847a0d02cd82f4eaad
3
+ metadata.gz: da52a6676fbc3aa9da01557a33bb0100139eaca9
4
+ data.tar.gz: ba7f27713f9c590644cfce371e3047f4648e96c0
5
5
  SHA512:
6
- metadata.gz: 4a0e35ad0dd2a1e845edbcd42e74c7242ad1be592dc78fb61f8f102ead28eeb279aa435cb2fb2508a06c482a228e7717a78ef9c2c1d24bff427f4da2b76f2c39
7
- data.tar.gz: 3e65e843ce94ba3a907683639c4b9dad74a8f8926cb14fb4cf536405d5fe48c3a968494e485a587ecbf5f55f875a4143235ec05da86351645cc7ae15dbf824dc
6
+ metadata.gz: e5cf5426a77887b729c706c441ce01247df3535a9f452a4754501735a6f0a85c3425ac2ad10f59438b1e4e40ea09d36ea8a32533ee6686a77d64aa4437cc591d
7
+ data.tar.gz: 2fa66a48ab851356d7e7b460cf2a6fefe53d2291144e1478dcfb287779b181ac4e64094e9e4fbca0fbdc26312b1a37a0dd49353db99b90cc2fb96d7493953b2a
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  sudo: false
2
2
 
3
3
  rvm:
4
- - 2.0.0
5
- - 2.1.0
6
- - 2.2.0
7
- - jruby-9.0.5.0
4
+ - "2.0"
5
+ - "2.1"
6
+ - "2.2"
7
+ - "2.3"
8
+ - jruby-9.1.13.0
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Resource
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
@@ -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 self.body
26
- if error = self.body['error']
25
+ if body
26
+ if (error = body['error'])
27
27
  message = "#{message} (#{error})"
28
28
  end
29
- elsif self.response
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.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-03-31 00:00:00.000000000 Z
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.4.5.1
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