dwolla_v2 0.1.1 → 0.2.0
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/README.md +5 -4
- data/lib/dwolla_v2/auth.rb +3 -2
- data/lib/dwolla_v2/token.rb +15 -6
- data/lib/dwolla_v2/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: 74ea9b8ec53ca41799d04f1070f017272dd0a579
|
4
|
+
data.tar.gz: 54317292cbddc52245eb3e9c8932491e3cfdfc17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27f8d6a9381f1617dbf5b39559951fb73247c8b139c9d43ea954c8b6fcc268faaa0cfede23f5700e980784e1f1b1abb87a28ad02fab967d846bb31d8ea6c521a
|
7
|
+
data.tar.gz: ef5920834152e90fe2de68e055129f48eea061b1342530c5e750095a31b6e8754731115327941607ebd7fcf6af67730abbd81a46a4bd9c5c3e67d6a2a7a7779f
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Dwolla V2 Ruby client. For the V1 Ruby client see [Dwolla/dwolla-ruby](https://g
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'dwolla_v2', '~> 0.
|
14
|
+
gem 'dwolla_v2', '~> 0.2'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -87,9 +87,9 @@ token = $dwolla.tokens.new token_data
|
|
87
87
|
```ruby
|
88
88
|
token.get "/resource", foo: "bar"
|
89
89
|
token.post "/resource", foo: "bar"
|
90
|
-
token.post "/resource", foo: Faraday
|
90
|
+
token.post "/resource", foo: Faraday::UploadIO.new("/path/to/bar.png", "image/png")
|
91
91
|
token.put "/resource", foo: "bar"
|
92
|
-
token.put "/resource", foo: Faraday
|
92
|
+
token.put "/resource", foo: Faraday::UploadIO.new("/path/to/bar.png", "image/png")
|
93
93
|
token.delete "/resource"
|
94
94
|
```
|
95
95
|
|
@@ -165,4 +165,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
165
165
|
|
166
166
|
## Changelog
|
167
167
|
|
168
|
-
- **0.
|
168
|
+
- **0.2.0** - Works with `attr_encrypted`
|
169
|
+
- **0.1.1** - Handle 500 error with HTML response body when requesting a token
|
data/lib/dwolla_v2/auth.rb
CHANGED
@@ -7,8 +7,9 @@ module DwollaV2
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.refresh client, token, params = {}
|
10
|
-
|
11
|
-
|
10
|
+
refresh_token = token.respond_to?(:refresh_token) ? token.refresh_token : token[:refresh_token]
|
11
|
+
raise ArgumentError.new "invalid refresh_token" unless refresh_token.is_a? String
|
12
|
+
request_token client, {:grant_type => :refresh_token, :refresh_token => refresh_token}.merge(params)
|
12
13
|
end
|
13
14
|
|
14
15
|
def initialize client, params = {}
|
data/lib/dwolla_v2/token.rb
CHANGED
@@ -7,15 +7,16 @@ module DwollaV2
|
|
7
7
|
attr_reader :client, :access_token, :refresh_token, :expires_in, :scope, :app_id, :account_id
|
8
8
|
|
9
9
|
delegate [:in_parallel] => :@conn
|
10
|
+
delegate [:reject] => :stringify_keys
|
10
11
|
|
11
12
|
def initialize client, params
|
12
13
|
@client = client
|
13
|
-
@access_token
|
14
|
-
@refresh_token = params
|
15
|
-
@expires_in
|
16
|
-
@scope
|
17
|
-
@app_id
|
18
|
-
@account_id
|
14
|
+
@access_token = get_param params, :access_token
|
15
|
+
@refresh_token = get_param params, :refresh_token
|
16
|
+
@expires_in = get_param params, :expires_in
|
17
|
+
@scope = get_param params, :scope
|
18
|
+
@app_id = get_param params, :app_id
|
19
|
+
@account_id = get_param params, :account_id
|
19
20
|
conn
|
20
21
|
freeze
|
21
22
|
end
|
@@ -58,6 +59,14 @@ module DwollaV2
|
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
62
|
+
def get_param params, key
|
63
|
+
if params.respond_to? key
|
64
|
+
params.public_send key
|
65
|
+
else
|
66
|
+
params[key]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
61
70
|
def self.full_url client, path
|
62
71
|
path = path[:_links][:self][:href] if path.is_a? Hash
|
63
72
|
if path.start_with? client.api_url
|
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.2.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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|