omniauth-dwolla 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/README.md +20 -1
- data/Rakefile +6 -0
- data/lib/omniauth-dwolla/version.rb +1 -1
- data/lib/omniauth/strategies/dwolla.rb +7 -1
- data/omniauth-dwolla.gemspec +16 -7
- data/spec/omniauth/strategies/dwolla_spec.rb +49 -13
- data/spec/spec_helper.rb +1 -0
- metadata +78 -49
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6c00ae2287f00a14d363b7a42f88dbbd93d49861
|
4
|
+
data.tar.gz: 58feebf016218b3162393c2047caf3631bf92464
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60ec1dc3bf0d5a3f8a728564d55cc3a9134b18f114c8f886fa897b661707b0ecc8ecc2154a4901257ad816cb6a4174512ca91a4f63b0a5ac60657c9e7a9efa08
|
7
|
+
data.tar.gz: d3e8bbed83d5e012f7f2e171672e84bcab417bb1080c2ff619ac5b4f18a9bf8f11a2ce64cd8896aad083417c713a9e7d266023b7b890941f533b83fcc6fd76c4
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,9 +20,28 @@ Here's a quick example, adding the middleware to a Rails app in `config/initiali
|
|
20
20
|
|
21
21
|
```ruby
|
22
22
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
23
|
-
provider :dwolla, ENV['DWOLLA_KEY'], ENV['DWOLLA_SECRET'], :scope => 'accountinfofull|send|request'
|
23
|
+
provider :dwolla, ENV['DWOLLA_KEY'], ENV['DWOLLA_SECRET'], :scope => 'accountinfofull|send|request', :provider_ignores_state => true
|
24
24
|
end
|
25
25
|
```
|
26
26
|
The :scope param is optional.
|
27
27
|
|
28
28
|
The default :scope is 'accountinfofull'. It is necessary in order to grab the uid and detailed info for user.
|
29
|
+
|
30
|
+
The extra hash will include:
|
31
|
+
```json
|
32
|
+
"raw_info": {
|
33
|
+
"City": "Des Moines",
|
34
|
+
"Id": "812-111-1111",
|
35
|
+
"Latitude": 41.584546,
|
36
|
+
"Longitude": -93.634167,
|
37
|
+
"Name": "Test User",
|
38
|
+
"State": "IA",
|
39
|
+
"Type": "Personal"
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
43
|
+
## Exception Handling
|
44
|
+
|
45
|
+
If the Dwolla library raises a `Dwolla::RequestException`, that will be wrapped and re-raised as a `OmniAuth::Strategies::OAuth2::CallbackError`. The OmniAuth OAuth2 library will, in turn, treat that as a failure due to invalid credentials, passing the `CallbackError` through Rack's middleware chain.
|
46
|
+
|
47
|
+
Note that the `Devise::OmniauthCallbacksController` provides a good example of handling this scenario.
|
data/Rakefile
CHANGED
@@ -5,12 +5,16 @@ module OmniAuth
|
|
5
5
|
module Strategies
|
6
6
|
class Dwolla < OmniAuth::Strategies::OAuth2
|
7
7
|
DEFAULT_SCOPE = 'accountinfofull'
|
8
|
-
|
8
|
+
option :name, 'dwolla'
|
9
9
|
option :client_options, {
|
10
10
|
:site => 'https://www.dwolla.com',
|
11
11
|
:authorize_url => '/oauth/v2/authenticate',
|
12
12
|
:token_url => '/oauth/v2/token'
|
13
13
|
}
|
14
|
+
#option :provider_ignores_state, true
|
15
|
+
# setting that has NO effect.
|
16
|
+
# If anyone can figure a way to make it work
|
17
|
+
# PLEASE issue a pull request. -masukomi
|
14
18
|
|
15
19
|
uid { user.id }
|
16
20
|
|
@@ -34,6 +38,8 @@ module OmniAuth
|
|
34
38
|
private
|
35
39
|
def user
|
36
40
|
@user ||= ::Dwolla::User.me(access_token.token).fetch
|
41
|
+
rescue ::Dwolla::RequestException => e
|
42
|
+
raise CallbackError.new(e, e.message)
|
37
43
|
end
|
38
44
|
|
39
45
|
def prune!(hash)
|
data/omniauth-dwolla.gemspec
CHANGED
@@ -5,11 +5,18 @@ require "omniauth-dwolla/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "omniauth-dwolla"
|
7
7
|
s.version = Omniauth::Dwolla::VERSION
|
8
|
-
s.authors = ["
|
9
|
-
s.email = ["
|
10
|
-
s.homepage = "https://github.com/
|
8
|
+
s.authors = ["masukomi"]
|
9
|
+
s.email = ["masukomi@masukomi.org"]
|
10
|
+
s.homepage = "https://github.com/masukomi/omniauth-dwolla"
|
11
11
|
s.summary = %q{OmniAuth strategy for Dwolla.}
|
12
12
|
s.description = %q{OmniAuth strategy for Dwolla.}
|
13
|
+
s.license = 'MIT'
|
14
|
+
post_install_string =<<END
|
15
|
+
Remember to specify
|
16
|
+
:provider_ignores_state => true
|
17
|
+
When you set up your Dwolla OmniAuth provider.
|
18
|
+
END
|
19
|
+
s.post_install_message = post_install_string
|
13
20
|
|
14
21
|
s.rubyforge_project = "omniauth-dwolla"
|
15
22
|
|
@@ -18,12 +25,14 @@ Gem::Specification.new do |s|
|
|
18
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
26
|
s.require_paths = ["lib"]
|
20
27
|
|
21
|
-
s.add_dependency 'omniauth', '~> 1.
|
22
|
-
s.add_dependency 'omniauth-oauth2', '~> 1.
|
23
|
-
s.add_dependency 'dwolla', '>= 0.0.
|
28
|
+
s.add_dependency 'omniauth', '~> 1.1.4'
|
29
|
+
s.add_dependency 'omniauth-oauth2', '~> 1.1.1'
|
30
|
+
s.add_dependency 'dwolla', '>= 0.0.14'
|
31
|
+
#using >=0.0.15 results in a variety of dependency conflicts
|
24
32
|
|
25
33
|
s.add_development_dependency 'rake'
|
26
|
-
s.add_development_dependency 'rspec', '~> 2.
|
34
|
+
s.add_development_dependency 'rspec', '~> 2.13.0'
|
27
35
|
s.add_development_dependency 'rack-test'
|
28
36
|
s.add_development_dependency 'simplecov'
|
37
|
+
s.add_development_dependency 'debugger'
|
29
38
|
end
|
@@ -9,16 +9,19 @@ describe OmniAuth::Strategies::Dwolla do
|
|
9
9
|
|
10
10
|
describe '#client' do
|
11
11
|
it 'should have the correct dwolla site' do
|
12
|
-
subject.client.site.
|
12
|
+
expect(subject.client.site).to eq("https://www.dwolla.com")
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should have the correct authorization url' do
|
16
|
-
subject.client.options[:authorize_url].
|
16
|
+
expect(subject.client.options[:authorize_url]).to eq("/oauth/v2/authenticate")
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should have the correct token url' do
|
20
|
-
subject.client.options[:token_url].
|
20
|
+
expect(subject.client.options[:token_url]).to eq('/oauth/v2/token')
|
21
21
|
end
|
22
|
+
|
23
|
+
#TODO find a way to set :provider_ignores_state to true by default
|
24
|
+
# and add a test for it. -masukomi
|
22
25
|
end
|
23
26
|
|
24
27
|
describe 'getting info' do
|
@@ -34,21 +37,54 @@ describe OmniAuth::Strategies::Dwolla do
|
|
34
37
|
|
35
38
|
subject.stub(:access_token) { @access_token }
|
36
39
|
|
37
|
-
@dwolla_user.should_receive(:fetch).and_return(@dwolla_user)
|
38
40
|
::Dwolla::User.should_receive(:me).with(@access_token.token).and_return(@dwolla_user)
|
39
41
|
end
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
context 'when successful' do
|
44
|
+
before do
|
45
|
+
@dwolla_user.should_receive(:fetch).and_return(@dwolla_user)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'sets the correct info based on user' do
|
49
|
+
subject.info.should == { 'name' => 'Test Name',
|
50
|
+
'latitude' => '123',
|
51
|
+
'longitude' => '321',
|
52
|
+
'city' => 'Sample City',
|
53
|
+
'state' => 'TT',
|
54
|
+
'type' => 'Personal' }
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'sets the correct uid based on user' do
|
58
|
+
subject.uid.should == '12345'
|
59
|
+
end
|
48
60
|
end
|
49
61
|
|
50
|
-
|
51
|
-
|
62
|
+
context 'when a Dwolla::RequestException is raised' do
|
63
|
+
let(:request_exception) { ::Dwolla::RequestException.new('Dwolla Error Message') }
|
64
|
+
|
65
|
+
before do
|
66
|
+
@dwolla_user.should_receive(:fetch).and_raise(request_exception)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 're-raises the appropriate OAuth error' do
|
70
|
+
expect {
|
71
|
+
subject.uid
|
72
|
+
}.to raise_error(OmniAuth::Strategies::OAuth2::CallbackError)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'passes along the original exception' do
|
76
|
+
exception = nil
|
77
|
+
|
78
|
+
begin
|
79
|
+
subject.uid
|
80
|
+
rescue OmniAuth::Strategies::OAuth2::CallbackError => e
|
81
|
+
exception = e
|
82
|
+
exception.error.should eq(request_exception)
|
83
|
+
exception.error_reason.should eq(request_exception.message)
|
84
|
+
end
|
85
|
+
|
86
|
+
exception.should be
|
87
|
+
end
|
52
88
|
end
|
53
89
|
end
|
54
90
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,96 +1,130 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-dwolla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.14
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- masukomi
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: omniauth
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.1.4
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.4
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: omniauth-oauth2
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: 1.1.1
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.1
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: dwolla
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - '>='
|
42
46
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.0.
|
47
|
+
version: 0.0.14
|
44
48
|
type: :runtime
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.14
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: rake
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: rspec
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
73
|
- - ~>
|
64
74
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
75
|
+
version: 2.13.0
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.13.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rack-test
|
71
|
-
requirement:
|
72
|
-
none: false
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
73
86
|
requirements:
|
74
|
-
- -
|
87
|
+
- - '>='
|
75
88
|
- !ruby/object:Gem::Version
|
76
89
|
version: '0'
|
77
90
|
type: :development
|
78
91
|
prerelease: false
|
79
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
80
97
|
- !ruby/object:Gem::Dependency
|
81
98
|
name: simplecov
|
82
|
-
requirement:
|
83
|
-
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
107
|
requirements:
|
85
|
-
- -
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: debugger
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
86
116
|
- !ruby/object:Gem::Version
|
87
117
|
version: '0'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
91
125
|
description: OmniAuth strategy for Dwolla.
|
92
126
|
email:
|
93
|
-
-
|
127
|
+
- masukomi@masukomi.org
|
94
128
|
executables: []
|
95
129
|
extensions: []
|
96
130
|
extra_rdoc_files: []
|
@@ -106,35 +140,30 @@ files:
|
|
106
140
|
- spec/omniauth/strategies/dwolla_spec.rb
|
107
141
|
- spec/spec_helper.rb
|
108
142
|
- spec/support/shared_examples.rb
|
109
|
-
homepage: https://github.com/
|
110
|
-
licenses:
|
111
|
-
|
143
|
+
homepage: https://github.com/masukomi/omniauth-dwolla
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message: "Remember to specify \n :provider_ignores_state => true\nWhen
|
148
|
+
you set up your Dwolla OmniAuth provider.\n"
|
112
149
|
rdoc_options: []
|
113
150
|
require_paths:
|
114
151
|
- lib
|
115
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
-
none: false
|
117
153
|
requirements:
|
118
|
-
- -
|
154
|
+
- - '>='
|
119
155
|
- !ruby/object:Gem::Version
|
120
156
|
version: '0'
|
121
|
-
segments:
|
122
|
-
- 0
|
123
|
-
hash: 402301085936081604
|
124
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
158
|
requirements:
|
127
|
-
- -
|
159
|
+
- - '>='
|
128
160
|
- !ruby/object:Gem::Version
|
129
161
|
version: '0'
|
130
|
-
segments:
|
131
|
-
- 0
|
132
|
-
hash: 402301085936081604
|
133
162
|
requirements: []
|
134
163
|
rubyforge_project: omniauth-dwolla
|
135
|
-
rubygems_version:
|
164
|
+
rubygems_version: 2.0.3
|
136
165
|
signing_key:
|
137
|
-
specification_version:
|
166
|
+
specification_version: 4
|
138
167
|
summary: OmniAuth strategy for Dwolla.
|
139
168
|
test_files:
|
140
169
|
- spec/omniauth/strategies/dwolla_spec.rb
|