dwolla_v2 0.3.0 → 0.3.1

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: 9335201401d3381e9a1e7ffdc143ccd991a3fd67
4
- data.tar.gz: bc65a7a240f407c133a4401c1a48f0a13ebd6f8a
3
+ metadata.gz: 811f43c8507739f9ba53fbd843f3d38c7d9554e7
4
+ data.tar.gz: 6f90eb874890c98cb2045de7ec2f107ca329ac07
5
5
  SHA512:
6
- metadata.gz: ccafd26042ddaefbc9acdbf0abf38900103b8a15f3285ac3e77d0def25d2121d966df317bd18ff7384c7ee2e2e600789b8f3f5a8634180b0197c60595203610b
7
- data.tar.gz: e50f913627d1935001da5e5676fa85ebc9cac4bc0046bfdf7721b298c3137fe764de41a724ce23902c7bc0e0ca1f593e0f1684e25ed34e7c12e267eef1406c7a
6
+ metadata.gz: b3d569ab13c930ca10eb2ce1d1ed077d08416cdaa020049929e1739d1ebb21a48f0950fad72091158656e05bb2b92ab55411b979d4a389f84d39aa15bdb7db03
7
+ data.tar.gz: 0f1af22dfb1dca2db0855c16b50907f8ae0839431d5cfdaa8b03e0e851d5fb26a18e6aed6be4856cfdf84a71b95da088be7d5c8811e38775f039f114eb9ee832
data/README.md CHANGED
@@ -44,7 +44,7 @@ end
44
44
  Get an application token:
45
45
 
46
46
  ```ruby
47
- $dwolla.auths.client scope: "ManagerCustomers|Funding"
47
+ $dwolla.auths.client scope: "ManageCustomers|Funding"
48
48
  ```
49
49
 
50
50
  Get an account token:
@@ -64,7 +64,7 @@ class YourAuthController < ApplicationController
64
64
 
65
65
  def auth
66
66
  $dwolla.auths.new redirect_uri: "https://yoursite.com/callback",
67
- scope: "ManagerCustomers|Funding"
67
+ scope: "ManageCustomers|Funding"
68
68
  end
69
69
  end
70
70
  ```
@@ -165,6 +165,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
165
165
 
166
166
  ## Changelog
167
167
 
168
+ - **0.3.1** - better `DwollaV2::Error` error messages
168
169
  - **0.3.0** - ISO8601 values in response body are converted to `Time` objects
169
170
  - **0.2.0** - Works with `attr_encrypted`
170
171
  - **0.1.1** - Handle 500 error with HTML response body when requesting a token
@@ -1,7 +1,5 @@
1
1
  module DwollaV2
2
2
  class Error < StandardError
3
- attr_reader :error, :error_description, :error_uri, :code, :message, :_links, :_embedded
4
-
5
3
  def self.raise! error
6
4
  raise self.new unless error.is_a? Hash
7
5
  if klass = error_class(error[:error] || error[:code])
@@ -11,21 +9,24 @@ module DwollaV2
11
9
  end
12
10
  end
13
11
 
14
- def initialize params = {}
15
- @error = params[:error]
16
- @error_description = params[:error_description]
17
- @error_uri = params[:error_uri]
18
- @code = params[:code]
19
- @message = params[:message]
20
- @_links = params[:_links]
21
- @_embedded = params[:_embedded]
12
+ def initialize error = nil
13
+ @error = error
14
+ end
15
+
16
+ def message
17
+ @error[:message]
18
+ end
19
+
20
+ def [] key
21
+ @error[key] rescue nil
22
+ end
23
+
24
+ def method_missing method
25
+ @error[method] rescue nil
22
26
  end
23
27
 
24
28
  def to_s
25
- [:error, :error_description, :error_uri, :code, :message, :_links, :_embedded]
26
- .map {|a| "#{a}: \"#{public_send(a)}\"" if public_send(a) }
27
- .compact
28
- .join ", "
29
+ @error.to_s
29
30
  end
30
31
 
31
32
  private
@@ -1,3 +1,3 @@
1
1
  module DwollaV2
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
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.3.0
4
+ version: 0.3.1
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-28 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler