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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90224d12fc784f80e84f67ddd69e4e3455b461f0
4
- data.tar.gz: 36373860f61fe49874233842df9e508f495c7053
3
+ metadata.gz: 74ea9b8ec53ca41799d04f1070f017272dd0a579
4
+ data.tar.gz: 54317292cbddc52245eb3e9c8932491e3cfdfc17
5
5
  SHA512:
6
- metadata.gz: 2e09500f5d74772db3f3c4b2f3accd698510ca650c5aedb02b8227d0337e8353f2236f524012fd3a23e90528610b9c5e33ac81fbb3a348d9a7ca6ff6bae8646a
7
- data.tar.gz: e79bcc5f12c33735d6fb6317b6500dcc9c58d30a95e8d86f8a9f7e5da5051a717defa8d6e03f28be7a3836942d3018e654925e76543db1751cfe80bf01dc6e84
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.1'
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.UploadIO.new("/path/to/bar.png", "image/png")
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.UploadIO.new("/path/to/bar.png", "image/png")
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.1.1** - Handle 500 errors with HTML response bodies when requesting tokens
168
+ - **0.2.0** - Works with `attr_encrypted`
169
+ - **0.1.1** - Handle 500 error with HTML response body when requesting a token
@@ -7,8 +7,9 @@ module DwollaV2
7
7
  end
8
8
 
9
9
  def self.refresh client, token, params = {}
10
- raise ArgumentError.new "invalid refresh_token" unless token[:refresh_token].is_a? String
11
- request_token client, {:grant_type => :refresh_token, :refresh_token => token[:refresh_token]}.merge(params)
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 = {}
@@ -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 = params[:access_token]
14
- @refresh_token = params[:refresh_token]
15
- @expires_in = params[:expires_in]
16
- @scope = params[:scope]
17
- @app_id = params[:app_id]
18
- @account_id = params[: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
@@ -1,3 +1,3 @@
1
1
  module DwollaV2
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
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: 0.1.1
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-20 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler