dwolla_v2 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cafca4ba5043293349a816b777be7acc7a9e9ed
4
- data.tar.gz: b6a74a586e445103f1fb87416096653f53bc7ddc
3
+ metadata.gz: e2c5759f8b81eb5d85c8fae2e308062048a9ec09
4
+ data.tar.gz: f4536f036c14fac66caf7d6c260f67dcfcceb020
5
5
  SHA512:
6
- metadata.gz: fe9b1d99826e13809b3925470614559e8cbdacba6a3763bc6ac4951e6633e919fdca4c05ac84ca1fb6a7d7cfbb38a30969ed00211cc640f2cf22e393bc4aefe1
7
- data.tar.gz: 81d8598e3fc866688bc6b0131072c705f7c03803b54e8656ac034f8e60a145e60598f761b00685b28ac7221657b1b970467eb72dda3871a128b46380cc4ec40b
6
+ metadata.gz: c0b10cccd12b0f82f6fd615db9e2e1c098d50d37f3caa38cb2b39ce4733245c44cb5880eec8a13de99133cea6baf3e84b499f1c5c48913450b22f4b47af780dc
7
+ data.tar.gz: 6af8d862bcfabc8cb606f5b5d0c94da711f08a3072faff16f383299b12d794b85114d9cf1fff25baac3247ea0600d0dbe76a1bc57d2a8bfad18bfb70824a3089
@@ -3,8 +3,10 @@ language: ruby
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - 2.1.7
7
- - 2.2.0
6
+ - 2.1.9
7
+ - 2.2.9
8
+ - 2.3.6
9
+ - 2.4.3
8
10
  - ruby-head
9
11
  - rbx-2
10
12
  - jruby
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![Build Status](https://travis-ci.org/Dwolla/dwolla-v2-ruby.svg)
4
4
 
5
- Dwolla V2 Ruby client. For the V1 Ruby client see [Dwolla/dwolla-ruby](https://github.com/Dwolla/dwolla-ruby).
5
+ Dwolla V2 Ruby client.
6
6
 
7
7
  [API Documentation](https://docsv2.dwolla.com)
8
8
 
@@ -29,8 +29,8 @@ Or install it yourself as:
29
29
  Create a client using your application's consumer key and secret found on the applications page
30
30
  ([Sandbox][apsandbox], [Production][approd]).
31
31
 
32
- [apsandbox]: https://sandbox.dwolla.com/applications
33
- [approd]: https://www.dwolla.com/applications
32
+ [apsandbox]: https://dashboard-sandbox.dwolla.com/applications
33
+ [approd]: https://dashboard.dwolla.com/applications
34
34
 
35
35
  ```ruby
36
36
  # config/initializers/dwolla.rb
@@ -91,17 +91,12 @@ end
91
91
 
92
92
  ## `DwollaV2::Token`
93
93
 
94
- Tokens can be used to make requests to the Dwolla V2 API. There are two types of tokens:
94
+ Tokens can be used to make requests to the Dwolla V2 API.
95
95
 
96
96
  ### Application tokens
97
97
 
98
- Application tokens are used to access the API on behalf of a consumer application. API resources that
99
- belong to an application include: `webhook-subscriptions`, `events`, and `webhooks`. Application
100
- tokens can be created using the [`client_credentials`][client_credentials] OAuth grant type:
101
-
102
- **Note:** If an application has the `ManageCustomers` scope enabled, it can also be used to access
103
- the API for White Label Customer related endpoints. Keep in mind, the application must belong to
104
- same Dwolla account that will be used when creating and managing White Label Customers in the API.
98
+ Application access tokens are used to authenticate against the API on behalf of a consumer application. Application tokens can be used to access resources in the API that either belong to the application itself (`webhooks`, `events`, `webhook-subscriptions`) or the partner Account that owns the consumer application (`accounts`, `customers`, `funding-sources`, etc.). Application
99
+ tokens are obtained by using the [`client_credentials`][client_credentials] OAuth grant type:
105
100
 
106
101
  [client_credentials]: https://tools.ietf.org/html/rfc6749#section-4.4
107
102
 
@@ -110,80 +105,17 @@ application_token = $dwolla.auths.client
110
105
  # => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." expires_in=3600 scope="...">
111
106
  ```
112
107
 
113
- *Application tokens do not include a `refresh_token`. When an application token expires, generate
114
- a new one using `$dwolla.auths.client`.*
115
-
116
- ### Account tokens
117
-
118
- Account tokens are used to access the API on behalf of a Dwolla account. API resources that belong
119
- to an account include `customers`, `funding-sources`, `documents`, `mass-payments`, `mass-payment-items`,
120
- `transfers`, and `on-demand-authorizations`.
121
-
122
- There are two ways to get an account token. One is by generating a token at
123
- https://sandbox.dwolla.com/applications (Sandbox) or https://www.dwolla.com/applications (Production).
124
-
125
- You can instantiate a generated token by doing the following:
126
-
127
- ```ruby
128
- account_token = $dwolla.tokens.new access_token: "...", refresh_token: "..."
129
- # => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="...">
130
- ```
131
-
132
- The other way to get an account token is using the [`authorization_code`][authorization_code]
133
- OAuth grant type. This flow works by redirecting a user to dwolla.com in order to get authorization
134
- and sending them back to your website with an authorization code which can be exchanged for a token.
135
- For example:
136
-
137
- [authorization_code]: https://tools.ietf.org/html/rfc6749#section-4.1
138
-
139
- ```ruby
140
- class YourAuthController < ApplicationController
141
- # redirect the user to dwolla.com for authorization
142
- def authorize
143
- redirect_to auth.url
144
- end
145
-
146
- # https://yoursite.com/callback?code=...&state=...
147
- def callback
148
- # exchange the code for a token
149
- token = auth.callback(params)
150
- # => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="..." expires_in=3600 scope="ManageCustomers|Funding" account_id="...">
151
- session[:account_id] = token.account_id
152
- end
153
-
154
- private
155
-
156
- def auth
157
- $dwolla.auths.new redirect_uri: "https://yoursite.com/callback",
158
- scope: "ManageCustomers|Funding",
159
- state: session[:state] ||= SecureRandom.hex(8), # optional
160
- verified_account: true, # optional
161
- dwolla_landing: "register" # optional
162
- end
163
- end
164
- ```
165
-
166
- ### Refreshing tokens
167
-
168
- Tokens with `refresh_token`s can be refreshed using `$dwolla.auths.refresh`, which takes a
169
- `DwollaV2::Token` as its first argument and returns a new token.
170
-
171
- ```ruby
172
- refreshed_token = $dwolla.auths.refresh(expired_token)
173
- # => #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="..." expires_in=3600 scope="ManageCustomers|Funding" account_id="...">
174
- ```
108
+ _Application tokens do not include a `refresh_token`. When an application token expires, generate
109
+ a new one using `$dwolla.auths.client`._
175
110
 
176
- ### Initializing pre-existing tokens:
111
+ ### Initializing a pre-existing access token:
177
112
 
178
113
  `DwollaV2::Token`s can be initialized with the following attributes:
179
114
 
180
115
  ```ruby
181
116
  $dwolla.tokens.new access_token: "...",
182
- refresh_token: "...",
183
- expires_in: 123,
184
- scope: "...",
185
- account_id: "..."
186
- #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." refresh_token="..." expires_in=123 scope="..." account_id="...">
117
+ expires_in: 123
118
+ #<DwollaV2::Token client=#<DwollaV2::Client key="..." secret="..." environment=:sandbox> access_token="..." expires_in=123>
187
119
  ```
188
120
 
189
121
  ```ruby
@@ -280,34 +212,34 @@ end
280
212
 
281
213
  ### `DwollaV2::Error` subclasses:
282
214
 
283
- *See https://docsv2.dwolla.com/#errors for more info.*
284
-
285
- - `DwollaV2::AccessDeniedError`
286
- - `DwollaV2::InvalidCredentialsError`
287
- - `DwollaV2::NotFoundError`
288
- - `DwollaV2::BadRequestError`
289
- - `DwollaV2::InvalidGrantError`
290
- - `DwollaV2::RequestTimeoutError`
291
- - `DwollaV2::ExpiredAccessTokenError`
292
- - `DwollaV2::InvalidRequestError`
293
- - `DwollaV2::ServerError`
294
- - `DwollaV2::ForbiddenError`
295
- - `DwollaV2::InvalidResourceStateError`
296
- - `DwollaV2::TemporarilyUnavailableError`
297
- - `DwollaV2::InvalidAccessTokenError`
298
- - `DwollaV2::InvalidScopeError`
299
- - `DwollaV2::UnauthorizedClientError`
300
- - `DwollaV2::InvalidAccountStatusError`
301
- - `DwollaV2::InvalidScopesError`
302
- - `DwollaV2::UnsupportedGrantTypeError`
303
- - `DwollaV2::InvalidApplicationStatusError`
304
- - `DwollaV2::InvalidVersionError`
305
- - `DwollaV2::UnsupportedResponseTypeError`
306
- - `DwollaV2::InvalidClientError`
307
- - `DwollaV2::MethodNotAllowedError`
308
- - `DwollaV2::ValidationError`
309
- - `DwollaV2::TooManyRequestsError`
310
- - `DwollaV2::ConflictError`
215
+ _See https://docsv2.dwolla.com/#errors for more info._
216
+
217
+ * `DwollaV2::AccessDeniedError`
218
+ * `DwollaV2::InvalidCredentialsError`
219
+ * `DwollaV2::NotFoundError`
220
+ * `DwollaV2::BadRequestError`
221
+ * `DwollaV2::InvalidGrantError`
222
+ * `DwollaV2::RequestTimeoutError`
223
+ * `DwollaV2::ExpiredAccessTokenError`
224
+ * `DwollaV2::InvalidRequestError`
225
+ * `DwollaV2::ServerError`
226
+ * `DwollaV2::ForbiddenError`
227
+ * `DwollaV2::InvalidResourceStateError`
228
+ * `DwollaV2::TemporarilyUnavailableError`
229
+ * `DwollaV2::InvalidAccessTokenError`
230
+ * `DwollaV2::InvalidScopeError`
231
+ * `DwollaV2::UnauthorizedClientError`
232
+ * `DwollaV2::InvalidAccountStatusError`
233
+ * `DwollaV2::InvalidScopesError`
234
+ * `DwollaV2::UnsupportedGrantTypeError`
235
+ * `DwollaV2::InvalidApplicationStatusError`
236
+ * `DwollaV2::InvalidVersionError`
237
+ * `DwollaV2::UnsupportedResponseTypeError`
238
+ * `DwollaV2::InvalidClientError`
239
+ * `DwollaV2::MethodNotAllowedError`
240
+ * `DwollaV2::ValidationError`
241
+ * `DwollaV2::TooManyRequestsError`
242
+ * `DwollaV2::ConflictError`
311
243
 
312
244
  ## Sample code
313
245
 
@@ -334,26 +266,27 @@ The gem is available as open source under the terms of the [MIT License](https:/
334
266
 
335
267
  ## Changelog
336
268
 
337
- - **2.0.2** - Fix bug in [#30](https://github.com/Dwolla/dwolla-v2-ruby/pull/30) (Thanks again @sobrinho!)
338
- - **2.0.1** - Fix bugs in [#27](https://github.com/Dwolla/dwolla-v2-ruby/pull/27) + [#28](https://github.com/Dwolla/dwolla-v2-ruby/pull/28) (Thanks @sobrinho!)
339
- - **2.0.0**
340
- - Rename `DwollaV2::Response` `#status` => `#response_status`, `#headers` => `#response_headers` to prevent
269
+ * **2.0.3** - Add `DuplicateResourceError` [#34](https://github.com/Dwolla/dwolla-v2-ruby/pull/34) (Thanks @javierjulio!)
270
+ * **2.0.2** - Fix bug in [#30](https://github.com/Dwolla/dwolla-v2-ruby/pull/30) (Thanks again @sobrinho!)
271
+ * **2.0.1** - Fix bugs in [#27](https://github.com/Dwolla/dwolla-v2-ruby/pull/27) + [#28](https://github.com/Dwolla/dwolla-v2-ruby/pull/28) (Thanks @sobrinho!)
272
+ * **2.0.0**
273
+ * Rename `DwollaV2::Response` `#status` => `#response_status`, `#headers` => `#response_headers` to prevent
341
274
  [conflicts with response body properties][response-conflicts].
342
- - Remove support for Ruby versions < 2 ([Bump public_suffix dependency version][public-suffix]).
343
- - **1.2.3** - Implement `#empty?` on `DwollaV2::Token` to allow it to be passed to ActiveRecord constructor.
344
- - **1.2.2** - Strip domain from URLs provided to `token.*` methods.
345
- - **1.2.1** - Update sandbox URLs from uat => sandbox.
346
- - **1.2.0** - Refer to Client :id as :key in docs/public APIs for consistency.
347
- - **1.1.2** - Add support for `verified_account` and `dwolla_landing` auth flags.
348
- - **1.1.1** - Add `TooManyRequestsError` and `ConflictError` classes.
349
- - **1.1.0** - Support setting headers on a per-request basis.
350
- - **1.0.1** - Set user agent header.
351
- - **1.0.0** - Refactor `Error` class to be more like response, add ability to access keys using methods.
352
- - **0.4.0** - Refactor and document how `DwollaV2::Response` works
353
- - **0.3.1** - better `DwollaV2::Error` error messages
354
- - **0.3.0** - ISO8601 values in response body are converted to `Time` objects
355
- - **0.2.0** - Works with `attr_encrypted`
356
- - **0.1.1** - Handle 500 error with HTML response body when requesting a token
275
+ * Remove support for Ruby versions < 2 ([Bump public_suffix dependency version][public-suffix]).
276
+ * **1.2.3** - Implement `#empty?` on `DwollaV2::Token` to allow it to be passed to ActiveRecord constructor.
277
+ * **1.2.2** - Strip domain from URLs provided to `token.*` methods.
278
+ * **1.2.1** - Update sandbox URLs from uat => sandbox.
279
+ * **1.2.0** - Refer to Client :id as :key in docs/public APIs for consistency.
280
+ * **1.1.2** - Add support for `verified_account` and `dwolla_landing` auth flags.
281
+ * **1.1.1** - Add `TooManyRequestsError` and `ConflictError` classes.
282
+ * **1.1.0** - Support setting headers on a per-request basis.
283
+ * **1.0.1** - Set user agent header.
284
+ * **1.0.0** - Refactor `Error` class to be more like response, add ability to access keys using methods.
285
+ * **0.4.0** - Refactor and document how `DwollaV2::Response` works
286
+ * **0.3.1** - better `DwollaV2::Error` error messages
287
+ * **0.3.0** - ISO8601 values in response body are converted to `Time` objects
288
+ * **0.2.0** - Works with `attr_encrypted`
289
+ * **0.1.1** - Handle 500 error with HTML response body when requesting a token
357
290
 
358
291
  [response-conflicts]: https://discuss.dwolla.com/t/document-change-or-more-clarifiation/3964
359
292
  [public-suffix]: https://github.com/Dwolla/dwolla-v2-ruby/pull/18#discussion_r108028135
@@ -53,6 +53,7 @@ require "dwolla_v2/errors/invalid_version_error"
53
53
  require "dwolla_v2/errors/request_timeout_error"
54
54
  require "dwolla_v2/errors/too_many_requests_error"
55
55
  require "dwolla_v2/errors/conflict_error"
56
+ require "dwolla_v2/errors/duplicate_resource_error"
56
57
 
57
58
  module DwollaV2
58
59
  end
@@ -0,0 +1,4 @@
1
+ module DwollaV2
2
+ class DuplicateResourceError < Error
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module DwollaV2
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
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: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ausman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,6 +132,7 @@ files:
132
132
  - lib/dwolla_v2/errors/access_denied_error.rb
133
133
  - lib/dwolla_v2/errors/bad_request_error.rb
134
134
  - lib/dwolla_v2/errors/conflict_error.rb
135
+ - lib/dwolla_v2/errors/duplicate_resource_error.rb
135
136
  - lib/dwolla_v2/errors/expired_access_token_error.rb
136
137
  - lib/dwolla_v2/errors/forbidden_error.rb
137
138
  - lib/dwolla_v2/errors/invalid_access_token_error.rb