Skip to content

Commit adf0569

Browse files
ShreyaThapajcoon97
andauthored
DEV-1012: Update README to conform to new style guide (#64)
* DEV-1012: Update README to conform to new style guide * Minor edits * Remove `public-suffix` variable and reference link directly * Update README.md * Apply suggestions from code review Co-authored-by: James Coon <james@jcoon.dev>
1 parent 498c365 commit adf0569

File tree

3 files changed

+93
-51
lines changed

3 files changed

+93
-51
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88
/spec/reports/
99
/tmp/
1010
/vendor/
11+
12+
# Visual Studio Code
13+
.vscode/
14+
15+
# IntelliJ Idea
16+
.idea/

README.md

+86-50
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1-
# DwollaV2
1+
# Dwolla SDK for Ruby
22

33
![Build Status](https://travis-ci.org/Dwolla/dwolla-v2-ruby.svg)
44

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.
66

7-
[API Documentation](https://docsv2.dwolla.com)
7+
## Table of Contents
88

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.
1028

1129
Add this line to your application's Gemfile:
1230

@@ -22,15 +40,14 @@ Or install it yourself as:
2240

2341
$ gem install dwolla_v2
2442

25-
## `DwollaV2::Client`
43+
### Initialization
2644

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:
2846

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
3149

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.
3451

3552
```ruby
3653
# config/initializers/dwolla.rb
@@ -41,13 +58,9 @@ $dwolla = DwollaV2::Client.new(
4158
)
4259
```
4360

44-
### Integrations Authorization
61+
#### Configure Faraday (Optional)
4562

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
5164
[Faraday middleware][faraday-middleware] and adapter when configuring your client. Remember to
5265
always include an adapter last, even if you want to use the default adapter.
5366

@@ -68,27 +81,38 @@ $dwolla = DwollaV2::Client.new(
6881
end
6982
```
7083

71-
## Requests
84+
## Making Requests
85+
86+
Once you've created a `Client`, currently, you can make low-level HTTP requests.
7287

73-
`DwollaV2::Client`s can make requests using the `#get`, `#post`, and `#delete` methods.
88+
### Low-level Requests
7489

90+
To make low-level HTTP requests, you can use the [`get()`](#get), [`post()`](#post), and [`delete()`](#delete) methods.
91+
92+
#### `GET`
7593
```ruby
7694
# GET api.dwolla.com/resource?foo=bar
7795
$dwolla.get "resource", foo: "bar"
96+
```
7897

98+
#### `POST`
99+
```ruby
79100
# POST api.dwolla.com/resource {"foo":"bar"}
80101
$dwolla.post "resource", foo: "bar"
81102

82103
# POST api.dwolla.com/resource multipart/form-data foo=...
83104
$dwolla.post "resource", foo: Faraday::UploadIO.new("/path/to/bar.png", "image/png")
105+
```
84106

107+
#### `DELETE`
108+
```ruby
85109
# DELETE api.dwolla.com/resource
86110
$dwolla.delete "resource"
87111
```
88112

89-
#### Setting headers
113+
##### Setting Headers
90114

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.
92116

93117
For example:
94118

@@ -97,9 +121,15 @@ $dwolla.post "customers", { firstName: "John", lastName: "Doe", email: "jd@doe.c
97121
{ 'Idempotency-Key': 'a52fcf63-0730-41c3-96e8-7147b5d1fb01' }
98122
```
99123

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.
101129

102-
Requests return a `DwollaV2::Response`.
130+
##### Success
131+
132+
Successful requests return a `DwollaV2::Response`.
103133

104134
```ruby
105135
res = $dwolla.get "/"
@@ -115,7 +145,7 @@ res._links.events.href
115145
# => "https://api-sandbox.dwolla.com/events"
116146
```
117147

118-
## Errors
148+
##### Error
119149

120150
If the server returns an error, a `DwollaV2::Error` (or one of its subclasses) will be raised.
121151
`DwollaV2::Error`s are similar to `DwollaV2::Response`s.
@@ -140,9 +170,10 @@ rescue DwollaV2::Error => e
140170
end
141171
```
142172

143-
### `DwollaV2::Error` subclasses:
144173

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._
146177

147178
- `DwollaV2::AccessDeniedError`
148179
- `DwollaV2::InvalidCredentialsError`
@@ -171,37 +202,23 @@ _See https://docsv2.dwolla.com/#errors for more info._
171202
- `DwollaV2::TooManyRequestsError`
172203
- `DwollaV2::ConflictError`
173204

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-
188205
## Changelog
189206

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.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)
208+
- **3.1.0** - Added `DwollaV2::MaxNumberOfResourcesError` (Thanks [@paulyeo21](https://github.com/paulyeo21)!). [#54](https://github.com/Dwolla/dwolla-v2-ruby/pull/54)
209+
- **3.0.1** - Update dependencies (Thanks [@sealabcore](https://github.com/sealabcore)!). [#48](https://github.com/Dwolla/dwolla-v2-ruby/pull/48)
193210
- **3.0.0** - Add integrations auth functions
194211
- **3.0.0.beta1** - Add token management functionality to `DwollaV2::Client`
195212
- **2.2.1** - Update dependencies
196213
- **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!)
214+
- **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)!)
215+
- **2.0.3** - Add `DuplicateResourceError` [#34](https://github.com/Dwolla/dwolla-v2-ruby/pull/34) (Thanks [@javierjulio](https://github.com/javierjulio)!)
216+
- **2.0.2** - Fix bug in [#30](https://github.com/Dwolla/dwolla-v2-ruby/pull/30) (Thanks again [@sobrinho](https://github.com/sobrinho)!
217+
- **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)!)
201218
- **2.0.0**
202219
- 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]).
220+
[conflicts with response body properties](https://discuss.dwolla.com/t/document-change-or-more-clarifiation/3964).
221+
- Remove support for Ruby versions < 2 ([Bump public_suffix dependency version](https://github.com/Dwolla/dwolla-v2-ruby/pull/18#discussion_r108028135)).
205222
- **1.2.3** - Implement `#empty?` on `DwollaV2::Token` to allow it to be passed to ActiveRecord constructor.
206223
- **1.2.2** - Strip domain from URLs provided to `token.*` methods.
207224
- **1.2.1** - Update sandbox URLs from uat => sandbox.
@@ -217,5 +234,24 @@ The gem is available as open source under the terms of the [MIT License](https:/
217234
- **0.2.0** - Works with `attr_encrypted`
218235
- **0.1.1** - Handle 500 error with HTML response body when requesting a token
219236

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
237+
## Community
238+
* 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).
239+
* 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!
240+
* 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.
241+
* 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).
242+
243+
## Additional Resources
244+
245+
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!
246+
247+
* [Dwolla](https://www.dwolla.com/)
248+
* [Dwolla Developers](https://developers.dwolla.com/)
249+
* [SDKs and Tools](https://developers.dwolla.com/sdks-tools)
250+
* [Dwolla SDK for C#](https://github.com/Dwolla/dwolla-v2-csharp)
251+
* [Dwolla SDK for Kotlin](https://github.com/Dwolla/dwolla-v2-kotlin)
252+
* [Dwolla SDK for Node](https://github.com/Dwolla/dwolla-v2-node)
253+
* [Dwolla SDK for PHP](https://github.com/Dwolla/dwolla-v2-php)
254+
* [Dwolla SDK for Python](https://github.com/Dwolla/dwolla-v2-python)
255+
* [Developer Support Forum](https://discuss.dwolla.com/)
256+
257+

lib/dwolla_v2.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
require "dwolla_v2/errors/temporarily_unavailable_error"
3939
require "dwolla_v2/errors/unsupported_grant_type_error"
4040

41-
# Dwolla errors https://docsv2.dwolla.com/#errors
41+
# Dwolla errors https://developers.dwolla.com/api-reference#errors
4242
require "dwolla_v2/errors/bad_request_error"
4343
require "dwolla_v2/errors/validation_error"
4444
require "dwolla_v2/errors/invalid_credentials_error"

0 commit comments

Comments
 (0)