fulfil-io 0.4.1 → 0.4.2
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/fulfil/client.rb +1 -1
- data/lib/fulfil/response_parser.rb +14 -2
- data/lib/fulfil/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35c4c9a9a5c6e89dc1963296ecb2d2bef838a93fe67f4d16b2cc6d1234870787
|
4
|
+
data.tar.gz: 54030ba2a9cffd08d0f720a195cb29196a8bc38d6860fc7ff30e59b3328f97a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b73ec09fc10b8183ed80d0f60bfe8911394c8d8e624a28e8d4aa77889a2912673876faf5af204ada89ba87ee9fff32796fb8b43a2b6825c1eb91eaf3773fb47
|
7
|
+
data.tar.gz: a0251fe789efa3744c331e5b590f64a0ce6dd100b204e0413b98d925733c99fda0be8ba2d5e8fb7e7fc2793a1f26b25030b58bdab61ee69bf3b68c59154c9582
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.4.2
|
2
|
+
|
3
|
+
* Raise an `UnhandledTypeError` and reveal the offender.
|
4
|
+
* Convert timedelta data types to Decimals.
|
5
|
+
* Don't use `.present?` to check if response is a Hash.
|
6
|
+
|
1
7
|
## 0.4.1
|
2
8
|
|
3
9
|
* @cdmwebs screwed up the release process, so this is a tiny bump to fix. No code changes.
|
data/lib/fulfil/client.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
module Fulfil
|
2
2
|
module ResponseParser
|
3
|
+
class UnhandledTypeError < StandardError
|
4
|
+
attr_reader :value
|
5
|
+
|
6
|
+
def initialize(msg, value)
|
7
|
+
@value = value
|
8
|
+
super(msg)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
3
12
|
# Handle value objects, for example:
|
4
13
|
#
|
5
14
|
# "order_date": {
|
@@ -19,10 +28,13 @@ module Fulfil
|
|
19
28
|
when 'datetime'
|
20
29
|
time = value.dig('iso_string')
|
21
30
|
DateTime.parse(time)
|
22
|
-
when 'Decimal'
|
31
|
+
when 'Decimal', 'timedelta'
|
23
32
|
value.dig('decimal').to_f
|
24
33
|
else
|
25
|
-
raise UnhandledTypeError
|
34
|
+
raise UnhandledTypeError.new(
|
35
|
+
"received a value that we don't know how to handle: #{json_class}",
|
36
|
+
json_class
|
37
|
+
)
|
26
38
|
end
|
27
39
|
end
|
28
40
|
|
data/lib/fulfil/version.rb
CHANGED