lob 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/lob.rb +1 -1
- data/lib/lob/errors/lob_error.rb +3 -7
- data/lib/lob/version.rb +1 -1
- data/spec/lob/errors/lob_error_spec.rb +4 -2
- 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: 865e83ff8c1948e5999f3c85f9397260306e5142
|
4
|
+
data.tar.gz: ef741f0b597b48e6aa074f8f2471d2be9809eef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caf0310352db0c2055546b47eeedd67008e54e9f009afafde599c4dfe4892d87e44370eedc30e42cc9a78d46b05190c11e2aba891be7c5db5d243f29b3a67a5c
|
7
|
+
data.tar.gz: 416e556d6f7fd7267668825bfdc9ea410cc907161ec74ced9616bd0de4ce50fc621264fc7de5aac218d777bc2684fe295216ea8aa81c745d0357f3ee451d9c9b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## [**2.1.0**](https://github.com/lob/lob-ruby/releases/tag/v2.1.0)
|
2
|
+
- [**#119**] (https://github.com/lob/lob-ruby/pull/119) better error messages
|
3
|
+
|
4
|
+
## [**2.0.1**](https://github.com/lob/lob-ruby/releases/tag/v2.0.1)
|
5
|
+
- [**#118**] (https://github.com/lob/lob-ruby/pull/118) removed prawn and fixed examples
|
6
|
+
|
1
7
|
## 2.0.0
|
2
8
|
|
3
9
|
Version 2.0.0 introduces several breaking changes. It requires a minimum API version of `2015-04-11`.
|
data/lib/lob.rb
CHANGED
@@ -52,7 +52,7 @@ module Lob
|
|
52
52
|
message = response.fetch("error").fetch("message")
|
53
53
|
raise InvalidRequestError.new(message, error.http_code, error.http_body, error.response)
|
54
54
|
rescue JSON::ParserError, KeyError
|
55
|
-
raise LobError.new("Invalid response object:
|
55
|
+
raise LobError.new("Invalid response object:", error.http_code, error.http_body)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
data/lib/lob/errors/lob_error.rb
CHANGED
@@ -1,17 +1,13 @@
|
|
1
1
|
module Lob
|
2
2
|
class LobError < StandardError
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :http_status, :http_body, :json_body
|
4
4
|
|
5
|
-
def initialize(message
|
6
|
-
@message = message
|
5
|
+
def initialize(message, http_status=nil, http_body=nil, json_body=nil)
|
7
6
|
@http_status = http_status
|
8
7
|
@http_body = http_body
|
9
8
|
@json_body = json_body
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_s
|
13
9
|
status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
|
14
|
-
"#{status_string}#{
|
10
|
+
super("#{status_string}#{message} \n #{@http_body}")
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
data/lib/lob/version.rb
CHANGED
@@ -5,12 +5,14 @@ describe Lob::LobError do
|
|
5
5
|
describe "#to_s" do
|
6
6
|
it "should return a string with the status code and message" do
|
7
7
|
error = Lob::LobError.new("hello", 404)
|
8
|
-
error.to_s.
|
8
|
+
error.to_s.must_include("(Status 404)")
|
9
|
+
error.to_s.must_include("hello")
|
9
10
|
end
|
10
11
|
|
11
12
|
it "should returna a message without the status code if not provided" do
|
12
13
|
error = Lob::LobError.new("hello")
|
13
|
-
error.to_s.
|
14
|
+
error.to_s.wont_include("Status")
|
15
|
+
error.to_s.must_include("hello")
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|