easypost 4.13.0 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/easypost/error.rb +15 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c71d319c7e56e6787ce3e63fa8afaa634d8eeeb57ba77fd754f86e284a66dff9
|
|
4
|
+
data.tar.gz: 90e4523dc2a2dd2ff8af06ad0cdd95a24ff3fa93c098d81458deeb3d9cd7f60a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99646c67e4f7264adb2a3bbf48dcd2224623a88c69ce4650a9066a79ee7e7a1203816f5b39b9d2086840ea47a512de0184f7547cb92a741e6669fcb68f7618f9
|
|
7
|
+
data.tar.gz: bbd168c93b623642b947955088d0baf089027c1d19335bca4ff41ae0ca39e770019953934c23b5a7d30194cdfecc6d5e29717ed37b1525bb90525825b3a8b937
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.13.1 (2023-04-18)
|
|
4
|
+
|
|
5
|
+
- Improves Error Deserialization to dynamically handle edge cases that have a bad format
|
|
6
|
+
|
|
3
7
|
## v4.13.0 (2023-04-04)
|
|
4
8
|
|
|
5
9
|
- Adds `get_next_page` function to each object which retrieves the next page of a collection when the `has_more` key is present in the response
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.13.
|
|
1
|
+
4.13.1
|
data/lib/easypost/error.rb
CHANGED
|
@@ -7,7 +7,7 @@ class EasyPost::Error < StandardError
|
|
|
7
7
|
# Initialize a new EasyPost Error
|
|
8
8
|
def initialize(message = nil, status = nil, code = nil, errors = nil, http_body = nil)
|
|
9
9
|
# message should be a string but can sometimes incorrectly come back as an array
|
|
10
|
-
@message = message.is_a?(
|
|
10
|
+
@message = message.is_a?(String) ? message : EasyPost::Error.traverse_json_element(message, [])
|
|
11
11
|
@status = status
|
|
12
12
|
@code = code
|
|
13
13
|
@errors = errors
|
|
@@ -29,4 +29,18 @@ class EasyPost::Error < StandardError
|
|
|
29
29
|
code == other.code &&
|
|
30
30
|
errors == other.errors
|
|
31
31
|
end
|
|
32
|
+
|
|
33
|
+
# Recursively traverses a JSON element to extract error messages and returns them as a comma-separated string.
|
|
34
|
+
def self.traverse_json_element(error_message, messages_list)
|
|
35
|
+
case error_message
|
|
36
|
+
when Hash
|
|
37
|
+
error_message.each_value { |value| traverse_json_element(value, messages_list) }
|
|
38
|
+
when Array
|
|
39
|
+
error_message.each { |value| traverse_json_element(value, messages_list) }
|
|
40
|
+
else
|
|
41
|
+
messages_list.push(error_message.to_s)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
messages_list.join(', ')
|
|
45
|
+
end
|
|
32
46
|
end
|
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: 4.13.
|
|
4
|
+
version: 4.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- EasyPost Developers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-04-
|
|
11
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: brakeman
|