dwolla_v2 3.1.1 → 3.2.0

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
  SHA256:
3
- metadata.gz: 4be9f7bea7e810a03f2ab1696a4f58fab0a6a98ea1d58175a439821dda1f22fc
4
- data.tar.gz: 4298b78df775708117f2b2da8c34324fd473541b6c373fad528bdc056fd00bfd
3
+ metadata.gz: a283e4ef9b5e8d0202220cfbd8f9d8dac299b9639b18cfde4886e5dd899d83f0
4
+ data.tar.gz: d33bff404c79b6b65b9dc6d46b93db369d401fa3ee2e4272398b258cc0f98293
5
5
  SHA512:
6
- metadata.gz: db8f28c736e95cca9712bd393576e1e407f311fc77ce6a368f819980238276a8d48e0563c84665d3cbba112af10c048d81dd1114d5305dcc4737c4a90fb8e41d
7
- data.tar.gz: 6f4b3852412029a7c9eeb2de586aea3f88d5102b53eac27d624f01f2789553797bb5abb06b22a32593297c5a2e7213ca3b67bd95c8d808fe8fd5b790f61b1c01
6
+ metadata.gz: 55adfc35398537ef84565d361f3b9eb91dee7caca81497c4e6e30eb083cb1a8b3bdd6a1e3cbab3b2ddfac16c0f8a1c406c3a53af43276d1394bca39b69ba80cd
7
+ data.tar.gz: 8dfd11085f7ffa6441b581c4177ef34dcd4b70b0dbf73f535017c0f2c3b29f6cd0da46021837459dee978f1a92362d344afc895582a5d7701d0360aefbe25035
data/.gitignore CHANGED
@@ -8,3 +8,9 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /vendor/
11
+
12
+ # Visual Studio Code
13
+ .vscode/
14
+
15
+ # IntelliJ Idea
16
+ .idea/
data/Dockerfile ADDED
@@ -0,0 +1,10 @@
1
+ FROM ruby:3.1.2
2
+ RUN mkdir app && mkdir app/lib && mkdir app/spec
3
+ ADD lib /app/lib
4
+ ADD Gemfile /app
5
+ ADD dwolla_v2.gemspec /app
6
+ ADD Rakefile /app
7
+ ADD spec /app/spec
8
+ WORKDIR /app
9
+ RUN bundle install
10
+ CMD ["rake", "spec"]
data/README.md CHANGED
@@ -1,12 +1,30 @@
1
- # DwollaV2
1
+ # Dwolla SDK for Ruby
2
2
 
3
3
  ![Build Status](https://travis-ci.org/Dwolla/dwolla-v2-ruby.svg)
4
4
 
5
- Dwolla V2 Ruby client.
5
+ This repository contains the source code for Dwolla's Ruby-based SDK, which allows developers to interact with Dwolla's server-side API via a Ruby API, with automatic OAuth token management included. Any action that can be performed via an HTTP request can be made using this SDK when executed within a server-side environment.
6
6
 
7
- [API Documentation](https://docsv2.dwolla.com)
7
+ ## Table of Contents
8
8
 
9
- ## Installation
9
+ - [Getting Started](#getting-started)
10
+ - [Installation](#installation)
11
+ - [Initialization](#initialization)
12
+ - [Making Requests](#making-requests)
13
+ - [Low-level Requests](#low-level-requests)
14
+ - [Setting Headers](#setting-headers)
15
+ - [Responses](#responses)
16
+ - [Success](#success)
17
+ - [Error](#error)
18
+ - [Changelog](#changelog)
19
+ - [Community](#community)
20
+ - [Additional Resources](#additional-resources)
21
+
22
+
23
+ ## Getting Started
24
+
25
+ ### Installation
26
+
27
+ To begin using this SDK, you will first need to download it to your machine. We use [RubyGems](https://rubygems.org/gems/dwolla_v2) to distribute this package.
10
28
 
11
29
  Add this line to your application's Gemfile:
12
30
 
@@ -22,15 +40,14 @@ Or install it yourself as:
22
40
 
23
41
  $ gem install dwolla_v2
24
42
 
25
- ## `DwollaV2::Client`
43
+ ### Initialization
26
44
 
27
- ### Basic usage
45
+ Before any API requests can be made, you must first determine which environment you will be using, as well as fetch the application key and secret. To fetch your application key and secret, please visit one of the following links:
28
46
 
29
- Create a client using your application's consumer key and secret found on the applications page
30
- ([Sandbox][apsandbox], [Production][approd]).
47
+ * Production: https://dashboard.dwolla.com/applications
48
+ * Sandbox: https://dashboard-sandbox.dwolla.com/applications
31
49
 
32
- [apsandbox]: https://dashboard-sandbox.dwolla.com/applications
33
- [approd]: https://dashboard.dwolla.com/applications
50
+ Finally, you can create an instance of `Client` with `key` and `secret` replaced with the application key and secret that you fetched from one of the aforementioned links, respectively.
34
51
 
35
52
  ```ruby
36
53
  # config/initializers/dwolla.rb
@@ -41,13 +58,9 @@ $dwolla = DwollaV2::Client.new(
41
58
  )
42
59
  ```
43
60
 
44
- ### Integrations Authorization
61
+ #### Configure Faraday (Optional)
45
62
 
46
- Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization).
47
-
48
- ### Configure Faraday (optional)
49
-
50
- DwollaV2 uses [Faraday][faraday] to make HTTP requests. You can configure your own
63
+ Dwolla for Ruby uses [Faraday][faraday] to make HTTP requests. You can configure your own
51
64
  [Faraday middleware][faraday-middleware] and adapter when configuring your client. Remember to
52
65
  always include an adapter last, even if you want to use the default adapter.
53
66
 
@@ -68,27 +81,38 @@ $dwolla = DwollaV2::Client.new(
68
81
  end
69
82
  ```
70
83
 
71
- ## Requests
84
+ ## Making Requests
85
+
86
+ Once you've created a `Client`, currently, you can make low-level HTTP requests.
87
+
88
+ ### Low-level Requests
72
89
 
73
- `DwollaV2::Client`s can make requests using the `#get`, `#post`, and `#delete` methods.
90
+ To make low-level HTTP requests, you can use the [`get()`](#get), [`post()`](#post), and [`delete()`](#delete) methods.
74
91
 
92
+ #### `GET`
75
93
  ```ruby
76
94
  # GET api.dwolla.com/resource?foo=bar
77
95
  $dwolla.get "resource", foo: "bar"
96
+ ```
78
97
 
98
+ #### `POST`
99
+ ```ruby
79
100
  # POST api.dwolla.com/resource {"foo":"bar"}
80
101
  $dwolla.post "resource", foo: "bar"
81
102
 
82
103
  # POST api.dwolla.com/resource multipart/form-data foo=...
83
104
  $dwolla.post "resource", foo: Faraday::UploadIO.new("/path/to/bar.png", "image/png")
105
+ ```
84
106
 
107
+ #### `DELETE`
108
+ ```ruby
85
109
  # DELETE api.dwolla.com/resource
86
110
  $dwolla.delete "resource"
87
111
  ```
88
112
 
89
- #### Setting headers
113
+ ##### Setting Headers
90
114
 
91
- To set additional headers on a request you can pass a `Hash` of headers as the 3rd argument.
115
+ To set additional headers on a request, you can pass a `Hash` of headers as the 3rd argument.
92
116
 
93
117
  For example:
94
118
 
@@ -97,9 +121,15 @@ $dwolla.post "customers", { firstName: "John", lastName: "Doe", email: "jd@doe.c
97
121
  { 'Idempotency-Key': 'a52fcf63-0730-41c3-96e8-7147b5d1fb01' }
98
122
  ```
99
123
 
100
- ## Responses
124
+ #### Responses
125
+
126
+ The following snippets demonstrate successful and errored responses from the Dwolla API.
127
+
128
+ An errored response is returned when Dwolla's servers respond with a status code that is greater than or equal to 400, whereas a successful response is when Dwolla's servers respond with a 200-level status code.
129
+
130
+ ##### Success
101
131
 
102
- Requests return a `DwollaV2::Response`.
132
+ Successful requests return a `DwollaV2::Response`.
103
133
 
104
134
  ```ruby
105
135
  res = $dwolla.get "/"
@@ -115,7 +145,7 @@ res._links.events.href
115
145
  # => "https://api-sandbox.dwolla.com/events"
116
146
  ```
117
147
 
118
- ## Errors
148
+ ##### Error
119
149
 
120
150
  If the server returns an error, a `DwollaV2::Error` (or one of its subclasses) will be raised.
121
151
  `DwollaV2::Error`s are similar to `DwollaV2::Response`s.
@@ -140,9 +170,10 @@ rescue DwollaV2::Error => e
140
170
  end
141
171
  ```
142
172
 
143
- ### `DwollaV2::Error` subclasses:
144
173
 
145
- _See https://docsv2.dwolla.com/#errors for more info._
174
+ ###### `DwollaV2::Error` subclasses:
175
+
176
+ _See https://developers.dwolla.com/api-reference#errors for more info._
146
177
 
147
178
  - `DwollaV2::AccessDeniedError`
148
179
  - `DwollaV2::InvalidCredentialsError`
@@ -171,37 +202,24 @@ _See https://docsv2.dwolla.com/#errors for more info._
171
202
  - `DwollaV2::TooManyRequestsError`
172
203
  - `DwollaV2::ConflictError`
173
204
 
174
- ## Development
175
-
176
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
177
-
178
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
179
-
180
- ## Contributing
181
-
182
- Bug reports and pull requests are welcome on GitHub at https://github.com/Dwolla/dwolla-v2-ruby.
183
-
184
- ## License
185
-
186
- The gem is available as open source under the terms of the [MIT License](https://github.com/Dwolla/dwolla-v2-ruby).
187
-
188
205
  ## Changelog
189
206
 
190
- - **3.1.1** - Fix deprecation warning on Faraday::Connection#authorization (Thanks @javierjulio!). [#60](https://github.com/Dwolla/dwolla-v2-ruby/pull/60)
191
- - **3.1.0** - Added `DwollaV2::MaxNumberOfResourcesError` (Thanks @paulyeo21!). [#54](https://github.com/Dwolla/dwolla-v2-ruby/pull/54)
192
- - **3.0.1** - Update dependencies (Thanks @sealabcore!). [#48](https://github.com/Dwolla/dwolla-v2-ruby/pull/48)
207
+ - [**3.2.0**](https://github.com/Dwolla/dwolla-v2-ruby/releases/tag/3.2.0) - Minor version update to support Ruby 3.2+. The change involves adding '**' to the codebase to make `opts` in `./lib/dwollav2/client.rb` compliant with Ruby 3.2+. (Thanks [@peterb-onramp](https://github.com/peterb-onramp)!). [#68](https://github.com/Dwolla/dwolla-v2-ruby/pull/68)
208
+ - **3.1.1** - Fix deprecation warning on Faraday::Connection#authorization (Thanks [@javierjulio](https://github.com/javierjulio)!). [#60](https://github.com/Dwolla/dwolla-v2-ruby/pull/60)
209
+ - **3.1.0** - Added `DwollaV2::MaxNumberOfResourcesError` (Thanks [@paulyeo21](https://github.com/paulyeo21)!). [#54](https://github.com/Dwolla/dwolla-v2-ruby/pull/54)
210
+ - **3.0.1** - Update dependencies (Thanks [@sealabcore](https://github.com/sealabcore)!). [#48](https://github.com/Dwolla/dwolla-v2-ruby/pull/48)
193
211
  - **3.0.0** - Add integrations auth functions
194
212
  - **3.0.0.beta1** - Add token management functionality to `DwollaV2::Client`
195
213
  - **2.2.1** - Update dependencies
196
214
  - **2.2.0** - Change token url from `www.dwolla.com/oauth/v2/token` to `accounts.dwolla.com/token`
197
- - **2.1.0** - Ensure `Time.iso8601` is defined so timestamps get parsed. [#38](https://github.com/Dwolla/dwolla-v2-ruby/pull/38) (Thanks @javierjulio!)
198
- - **2.0.3** - Add `DuplicateResourceError` [#34](https://github.com/Dwolla/dwolla-v2-ruby/pull/34) (Thanks @javierjulio!)
199
- - **2.0.2** - Fix bug in [#30](https://github.com/Dwolla/dwolla-v2-ruby/pull/30) (Thanks again @sobrinho!)
200
- - **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!)
215
+ - **2.1.0** - Ensure `Time.iso8601` is defined so timestamps get parsed. [#38](https://github.com/Dwolla/dwolla-v2-ruby/pull/38) (Thanks [@javierjulio](https://github.com/javierjulio)!)
216
+ - **2.0.3** - Add `DuplicateResourceError` [#34](https://github.com/Dwolla/dwolla-v2-ruby/pull/34) (Thanks [@javierjulio](https://github.com/javierjulio)!)
217
+ - **2.0.2** - Fix bug in [#30](https://github.com/Dwolla/dwolla-v2-ruby/pull/30) (Thanks again [@sobrinho](https://github.com/sobrinho)!
218
+ - **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](https://github.com/sobrinho)!)
201
219
  - **2.0.0**
202
220
  - Rename `DwollaV2::Response` `#status` => `#response_status`, `#headers` => `#response_headers` to prevent
203
- [conflicts with response body properties][response-conflicts].
204
- - Remove support for Ruby versions < 2 ([Bump public_suffix dependency version][public-suffix]).
221
+ [conflicts with response body properties](https://discuss.dwolla.com/t/document-change-or-more-clarifiation/3964).
222
+ - Remove support for Ruby versions < 2 ([Bump public_suffix dependency version](https://github.com/Dwolla/dwolla-v2-ruby/pull/18#discussion_r108028135)).
205
223
  - **1.2.3** - Implement `#empty?` on `DwollaV2::Token` to allow it to be passed to ActiveRecord constructor.
206
224
  - **1.2.2** - Strip domain from URLs provided to `token.*` methods.
207
225
  - **1.2.1** - Update sandbox URLs from uat => sandbox.
@@ -217,5 +235,29 @@ The gem is available as open source under the terms of the [MIT License](https:/
217
235
  - **0.2.0** - Works with `attr_encrypted`
218
236
  - **0.1.1** - Handle 500 error with HTML response body when requesting a token
219
237
 
220
- [response-conflicts]: https://discuss.dwolla.com/t/document-change-or-more-clarifiation/3964
221
- [public-suffix]: https://github.com/Dwolla/dwolla-v2-ruby/pull/18#discussion_r108028135
238
+ ## Community
239
+ * If you have any feedback, please reach out to us on [our forums](https://discuss.dwolla.com/) or by [creating a GitHub issue](https://github.com/Dwolla/dwolla-v2-ruby/issues/new).
240
+ * If you would like to contribute to this library, [bug reports](https://github.com/Dwolla/dwolla-v2-ruby/issues) and [pull requests](https://github.com/Dwolla/dwolla-v2-ruby/pulls) are always appreciated!
241
+ * After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
242
+ * To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
243
+
244
+ ## Docker
245
+
246
+ If you prefer to use Docker to run dwolla-v2-python locally, a Dockerfile is included at the root directory.
247
+ Follow these instructions from [Docker's website](https://docs.docker.com/build/hellobuild/) to create a Docker image from the Dockerfile, and run it.
248
+
249
+ ## Additional Resources
250
+
251
+ To learn more about Dwolla and how to integrate our product with your application, please consider visiting the following resources and becoming a member of our community!
252
+
253
+ * [Dwolla](https://www.dwolla.com/)
254
+ * [Dwolla Developers](https://developers.dwolla.com/)
255
+ * [SDKs and Tools](https://developers.dwolla.com/sdks-tools)
256
+ * [Dwolla SDK for C#](https://github.com/Dwolla/dwolla-v2-csharp)
257
+ * [Dwolla SDK for Kotlin](https://github.com/Dwolla/dwolla-v2-kotlin)
258
+ * [Dwolla SDK for Node](https://github.com/Dwolla/dwolla-v2-node)
259
+ * [Dwolla SDK for PHP](https://github.com/Dwolla/dwolla-v2-php)
260
+ * [Dwolla SDK for Python](https://github.com/Dwolla/dwolla-v2-python)
261
+ * [Developer Support Forum](https://discuss.dwolla.com/)
262
+
263
+
@@ -20,7 +20,7 @@ module DwollaV2
20
20
 
21
21
  def_delegators :current_token, :get, :post, :delete
22
22
 
23
- def initialize opts
23
+ def initialize **opts
24
24
  opts[:id] ||= opts[:key]
25
25
  raise ArgumentError.new ":key is required" unless opts[:id].is_a? String
26
26
  raise ArgumentError.new ":secret is required" unless opts[:secret].is_a? String
@@ -1,3 +1,3 @@
1
1
  module DwollaV2
2
- VERSION = "3.1.1"
3
- end
2
+ VERSION = "3.2.0"
3
+ end
data/lib/dwolla_v2.rb CHANGED
@@ -38,7 +38,7 @@ require "dwolla_v2/errors/server_error"
38
38
  require "dwolla_v2/errors/temporarily_unavailable_error"
39
39
  require "dwolla_v2/errors/unsupported_grant_type_error"
40
40
 
41
- # Dwolla errors https://docsv2.dwolla.com/#errors
41
+ # Dwolla errors https://developers.dwolla.com/api-reference#errors
42
42
  require "dwolla_v2/errors/bad_request_error"
43
43
  require "dwolla_v2/errors/validation_error"
44
44
  require "dwolla_v2/errors/invalid_credentials_error"
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: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ausman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-22 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,6 +118,7 @@ files:
118
118
  - ".github/workflows/ruby.yml"
119
119
  - ".gitignore"
120
120
  - ".rspec"
121
+ - Dockerfile
121
122
  - Gemfile
122
123
  - LICENSE.txt
123
124
  - README.md
@@ -172,7 +173,7 @@ homepage: https://github.com/Dwolla/dwolla-v2-ruby
172
173
  licenses:
173
174
  - MIT
174
175
  metadata: {}
175
- post_install_message:
176
+ post_install_message:
176
177
  rdoc_options: []
177
178
  require_paths:
178
179
  - lib
@@ -187,8 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
188
  - !ruby/object:Gem::Version
188
189
  version: '0'
189
190
  requirements: []
190
- rubygems_version: 3.0.3.1
191
- signing_key:
191
+ rubygems_version: 3.2.3
192
+ signing_key:
192
193
  specification_version: 4
193
194
  summary: Dwolla V2 Ruby client
194
195
  test_files: []