easypost 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/VERSION +1 -1
- data/lib/easypost/error.rb +17 -7
- data/lib/easypost/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffecde59165d8726bc3c8df04460ace5510db641
|
4
|
+
data.tar.gz: 305d583c4003b61f47ac2d9a98fc1d562c40a988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 647172542d948f1a4d731b05033cb82ad42f71fae98448f88f353d6cb37cb5a45bd26119f0a31bbe396d6cd5c991f76bc84503a040c83c0111f3ceba1928be13
|
7
|
+
data.tar.gz: 6ac4b06bd97be38e839bd9a346e51ab3adfc072658516a4959256cbb2954a35bcd25cb6ffe607d71bfd77faaf78f4c967092bd52d85f82ba9302bc377e9f13d8
|
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.2
|
data/lib/easypost/error.rb
CHANGED
@@ -5,6 +5,8 @@ module EasyPost
|
|
5
5
|
attr_reader :http_body
|
6
6
|
attr_reader :json_body
|
7
7
|
attr_reader :param
|
8
|
+
attr_reader :code
|
9
|
+
attr_reader :errors
|
8
10
|
|
9
11
|
def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil)
|
10
12
|
@message = message
|
@@ -12,18 +14,26 @@ module EasyPost
|
|
12
14
|
@http_body = http_body
|
13
15
|
@json_body = json_body
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@param = nil
|
19
|
-
end
|
17
|
+
@param = @json_body.fetch(:error, {}).fetch(:param, nil)
|
18
|
+
@code = @json_body.fetch(:error, {}).fetch(:code, nil)
|
19
|
+
@errors = @json_body.fetch(:error, {}).fetch(:errors, nil)
|
20
20
|
|
21
21
|
super(message)
|
22
22
|
end
|
23
23
|
|
24
24
|
def to_s
|
25
|
-
|
26
|
-
|
25
|
+
s = "#{@code} (#{@http_status}): #{@message}";
|
26
|
+
if @errors
|
27
|
+
s += "\nField errors:\n"
|
28
|
+
@errors.each do |field_error|
|
29
|
+
field_error.each do |k, v|
|
30
|
+
s += " #{k}: #{v}\n"
|
31
|
+
end
|
32
|
+
s += "\n"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
s
|
27
36
|
end
|
28
37
|
end
|
29
38
|
end
|
39
|
+
|
data/lib/easypost/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sawyer Bateman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|