dwolla_v2 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/dwolla_v2.rb +1 -0
- data/lib/dwolla_v2/middleware/parse_iso8601_response_body.rb +13 -0
- data/lib/dwolla_v2/token.rb +1 -0
- data/lib/dwolla_v2/util.rb +12 -0
- data/lib/dwolla_v2/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9335201401d3381e9a1e7ffdc143ccd991a3fd67
|
4
|
+
data.tar.gz: bc65a7a240f407c133a4401c1a48f0a13ebd6f8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccafd26042ddaefbc9acdbf0abf38900103b8a15f3285ac3e77d0def25d2121d966df317bd18ff7384c7ee2e2e600789b8f3f5a8634180b0197c60595203610b
|
7
|
+
data.tar.gz: e50f913627d1935001da5e5676fa85ebc9cac4bc0046bfdf7721b298c3137fe764de41a724ce23902c7bc0e0ca1f593e0f1684e25ed34e7c12e267eef1406c7a
|
data/README.md
CHANGED
@@ -165,5 +165,6 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
165
165
|
|
166
166
|
## Changelog
|
167
167
|
|
168
|
+
- **0.3.0** - ISO8601 values in response body are converted to `Time` objects
|
168
169
|
- **0.2.0** - Works with `attr_encrypted`
|
169
170
|
- **0.1.1** - Handle 500 error with HTML response body when requesting a token
|
data/lib/dwolla_v2.rb
CHANGED
@@ -16,6 +16,7 @@ require "dwolla_v2/error"
|
|
16
16
|
require "dwolla_v2/util"
|
17
17
|
|
18
18
|
require "dwolla_v2/middleware/symbolize_response_body"
|
19
|
+
require "dwolla_v2/middleware/parse_iso8601_response_body"
|
19
20
|
require "dwolla_v2/middleware/handle_errors"
|
20
21
|
|
21
22
|
# OAuth errors https://tools.ietf.org/html/rfc6749
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module DwollaV2
|
2
|
+
class ParseIso8601ResponseBody
|
3
|
+
def initialize app
|
4
|
+
@app = app
|
5
|
+
end
|
6
|
+
|
7
|
+
def call request_env
|
8
|
+
@app.call(request_env).on_complete do |response_env|
|
9
|
+
response_env.body = Util.deep_parse_iso8601_values(response_env.body)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/dwolla_v2/token.rb
CHANGED
data/lib/dwolla_v2/util.rb
CHANGED
@@ -10,6 +10,18 @@ module DwollaV2
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.deep_parse_iso8601_values obj
|
14
|
+
if obj.is_a? Hash
|
15
|
+
Hash[obj.map{|k,v| [k, deep_parse_iso8601_values(v)] }]
|
16
|
+
elsif obj.is_a? Array
|
17
|
+
obj.map {|i| deep_parse_iso8601_values(i) }
|
18
|
+
elsif obj.is_a? String
|
19
|
+
Time.iso8601 obj rescue obj
|
20
|
+
else
|
21
|
+
obj
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
13
25
|
def self.classify str
|
14
26
|
str.split("_").map do |i|
|
15
27
|
i.sub(/^(.)/) { $1.capitalize }
|
data/lib/dwolla_v2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwolla_v2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Ausman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/dwolla_v2/errors/unsupported_response_type_error.rb
|
141
141
|
- lib/dwolla_v2/errors/validation_error.rb
|
142
142
|
- lib/dwolla_v2/middleware/handle_errors.rb
|
143
|
+
- lib/dwolla_v2/middleware/parse_iso8601_response_body.rb
|
143
144
|
- lib/dwolla_v2/middleware/symbolize_response_body.rb
|
144
145
|
- lib/dwolla_v2/portal.rb
|
145
146
|
- lib/dwolla_v2/response.rb
|