dwolla_v2 1.1.2 → 1.2.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 +10 -9
- data/dwolla_v2.gemspec +1 -0
- data/lib/dwolla_v2/client.rb +5 -3
- data/lib/dwolla_v2/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a90c8e8f1c4e7d001065fdce9b878055be936208
|
4
|
+
data.tar.gz: fd51a4c855ec99d92377377f68c03d05a948a4dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3e88466f5a043ad48dece76d937601f8cd45d537c9cc67791b793e75422aee73999c62a9d022aa7d52bfdce564c4b9905143440ac0c15f21077eadcb61def0
|
7
|
+
data.tar.gz: 181cf5dfd28d31dad48606f0ddd0018c5ab5855c5fcad21b7bf6e307f0b355959a361b722cf554be0791072568d423f4bd9b492684fb91e1715ad55c97eb7ed6
|
data/README.md
CHANGED
@@ -34,14 +34,14 @@ Create a client using your application's consumer key and secret found on the ap
|
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
# config/initializers/dwolla.rb
|
37
|
-
$dwolla = DwollaV2::Client.new(
|
37
|
+
$dwolla = DwollaV2::Client.new(key: ENV["DWOLLA_APP_KEY"], secret: ENV["DWOLLA_APP_SECRET"])
|
38
38
|
```
|
39
39
|
|
40
40
|
### Using the sandbox environment (optional)
|
41
41
|
|
42
42
|
```ruby
|
43
43
|
# config/initializers/dwolla.rb
|
44
|
-
$dwolla = DwollaV2::Client.new(
|
44
|
+
$dwolla = DwollaV2::Client.new(key: ENV["DWOLLA_APP_KEY"], secret: ENV["DWOLLA_APP_SECRET"]) do |config|
|
45
45
|
config.environment = :sandbox
|
46
46
|
end
|
47
47
|
```
|
@@ -57,7 +57,7 @@ this to the `create!` method of an ActiveRecord model to create a record using t
|
|
57
57
|
|
58
58
|
```ruby
|
59
59
|
# config/initializers/dwolla.rb
|
60
|
-
$dwolla = DwollaV2::Client.new(
|
60
|
+
$dwolla = DwollaV2::Client.new(key: ENV["DWOLLA_APP_KEY"], secret: ENV["DWOLLA_APP_SECRET"]) do |config|
|
61
61
|
config.on_grant {|t| YourTokenData.create!(t) }
|
62
62
|
end
|
63
63
|
```
|
@@ -81,7 +81,7 @@ always include an adapter last, even if you want to use the default adapter.
|
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
# config/initializers/dwolla.rb
|
84
|
-
$dwolla = DwollaV2::Client.new(
|
84
|
+
$dwolla = DwollaV2::Client.new(key: ENV["DWOLLA_APP_KEY"], secret: ENV["DWOLLA_APP_SECRET"]) do |config|
|
85
85
|
config.faraday do |faraday|
|
86
86
|
faraday.response :logger
|
87
87
|
faraday.adapter Faraday.default_adapter
|
@@ -107,7 +107,7 @@ same Dwolla account that will be used when creating and managing White Label Cus
|
|
107
107
|
|
108
108
|
```ruby
|
109
109
|
application_token = $dwolla.auths.client
|
110
|
-
# => #<DwollaV2::Token client=#<DwollaV2::Client
|
110
|
+
# => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." expires_in=3600 scope="...">
|
111
111
|
```
|
112
112
|
|
113
113
|
*Application tokens do not include a `refresh_token`. When an application token expires, generate
|
@@ -126,7 +126,7 @@ You can instantiate a generated token by doing the following:
|
|
126
126
|
|
127
127
|
```ruby
|
128
128
|
account_token = $dwolla.tokens.new access_token: "...", refresh_token: "..."
|
129
|
-
# => #<DwollaV2::Token client=#<DwollaV2::Client
|
129
|
+
# => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="...">
|
130
130
|
```
|
131
131
|
|
132
132
|
The other way to get an account token is using the [`authorization_code`][authorization_code]
|
@@ -147,7 +147,7 @@ class YourAuthController < ApplicationController
|
|
147
147
|
def callback
|
148
148
|
# exchange the code for a token
|
149
149
|
token = auth.callback(params)
|
150
|
-
# => #<DwollaV2::Token client=#<DwollaV2::Client
|
150
|
+
# => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="..." expires_in=3600 scope="ManageCustomers|Funding" account_id="...">
|
151
151
|
session[:account_id] = token.account_id
|
152
152
|
end
|
153
153
|
|
@@ -170,7 +170,7 @@ Tokens with `refresh_token`s can be refreshed using `$dwolla.auths.refresh`, whi
|
|
170
170
|
|
171
171
|
```ruby
|
172
172
|
refreshed_token = $dwolla.auths.refresh(expired_token)
|
173
|
-
# => #<DwollaV2::Token client=#<DwollaV2::Client
|
173
|
+
# => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="..." expires_in=3600 scope="ManageCustomers|Funding" account_id="...">
|
174
174
|
```
|
175
175
|
|
176
176
|
### Initializing pre-existing tokens:
|
@@ -183,7 +183,7 @@ $dwolla.tokens.new access_token: "...",
|
|
183
183
|
expires_in: 123,
|
184
184
|
scope: "...",
|
185
185
|
account_id: "..."
|
186
|
-
#<DwollaV2::Token client=#<DwollaV2::Client
|
186
|
+
#<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="..." expires_in=123 scope="..." account_id="...">
|
187
187
|
```
|
188
188
|
|
189
189
|
```ruby
|
@@ -334,6 +334,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
334
334
|
|
335
335
|
## Changelog
|
336
336
|
|
337
|
+
- **1.2.0** - Refer to Client :id as :key in docs/public APIs for consistency.
|
337
338
|
- **1.1.2** - Add support for `verified_account` and `dwolla_landing` auth flags.
|
338
339
|
- **1.1.1** - Add `TooManyRequestsError` and `ConflictError` classes.
|
339
340
|
- **1.1.0** - Support setting headers on a per-request basis.
|
data/dwolla_v2.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
25
|
spec.add_development_dependency "webmock", "~> 1.22"
|
26
26
|
|
27
|
+
spec.add_dependency "public_suffix", "~> 1.4.6"
|
27
28
|
spec.add_dependency "hashie", "~> 3.4"
|
28
29
|
spec.add_dependency "faraday", "~> 0.9"
|
29
30
|
spec.add_dependency "faraday_middleware", "~> 0.10"
|
data/lib/dwolla_v2/client.rb
CHANGED
@@ -14,10 +14,12 @@ module DwollaV2
|
|
14
14
|
}
|
15
15
|
|
16
16
|
attr_reader :id, :secret, :auths, :tokens
|
17
|
+
alias_method :key, :id
|
17
18
|
|
18
19
|
def initialize opts
|
19
|
-
|
20
|
-
raise ArgumentError.new "
|
20
|
+
opts[:id] ||= opts[:key]
|
21
|
+
raise ArgumentError.new ":key is required" unless opts[:id].is_a? String
|
22
|
+
raise ArgumentError.new ":secret is required" unless opts[:secret].is_a? String
|
21
23
|
@id = opts[:id]
|
22
24
|
@secret = opts[:secret]
|
23
25
|
yield self if block_given?
|
@@ -75,7 +77,7 @@ module DwollaV2
|
|
75
77
|
end
|
76
78
|
|
77
79
|
def inspect
|
78
|
-
Util.pretty_inspect self.class.name,
|
80
|
+
Util.pretty_inspect self.class.name, key: id, secret: secret, environment: environment
|
79
81
|
end
|
80
82
|
end
|
81
83
|
end
|
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: 1.
|
4
|
+
version: 1.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:
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.22'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: public_suffix
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.4.6
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.4.6
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: hashie
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
199
|
version: '0'
|
186
200
|
requirements: []
|
187
201
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.
|
202
|
+
rubygems_version: 2.6.8
|
189
203
|
signing_key:
|
190
204
|
specification_version: 4
|
191
205
|
summary: Dwolla V2 Ruby client
|