omniauth-dwolla 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omniauth-dwolla/version.rb +1 -1
- data/lib/omniauth/strategies/dwolla.rb +11 -12
- data/omniauth-dwolla.gemspec +1 -1
- data/spec/omniauth/strategies/dwolla_spec.rb +32 -1
- metadata +19 -19
@@ -4,7 +4,7 @@ require 'dwolla'
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
6
|
class Dwolla < OmniAuth::Strategies::OAuth2
|
7
|
-
DEFAULT_SCOPE = '
|
7
|
+
DEFAULT_SCOPE = 'accountinfofull'
|
8
8
|
|
9
9
|
option :client_options, {
|
10
10
|
:site => 'https://www.dwolla.com',
|
@@ -12,16 +12,16 @@ module OmniAuth
|
|
12
12
|
:token_url => '/oauth/v2/token'
|
13
13
|
}
|
14
14
|
|
15
|
-
uid {
|
15
|
+
uid { user.id }
|
16
16
|
|
17
17
|
info do
|
18
18
|
prune!({
|
19
|
-
'name' =>
|
20
|
-
'latitude' =>
|
21
|
-
'longitude' =>
|
22
|
-
'city' =>
|
23
|
-
'state' =>
|
24
|
-
'type' =>
|
19
|
+
'name' => user.name,
|
20
|
+
'latitude' => user.latitude,
|
21
|
+
'longitude' => user.longitude,
|
22
|
+
'city' => user.city,
|
23
|
+
'state' => user.state,
|
24
|
+
'type' => user.type
|
25
25
|
})
|
26
26
|
end
|
27
27
|
|
@@ -31,11 +31,10 @@ module OmniAuth
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def raw_info
|
35
|
-
@raw_info ||= ::Dwolla::User.me(access_token.token).fetch
|
36
|
-
end
|
37
|
-
|
38
34
|
private
|
35
|
+
def user
|
36
|
+
@user ||= ::Dwolla::User.me(access_token.token).fetch
|
37
|
+
end
|
39
38
|
|
40
39
|
def prune!(hash)
|
41
40
|
hash.delete_if do |_, value|
|
data/omniauth-dwolla.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_dependency 'omniauth', '~> 1.0'
|
22
22
|
s.add_dependency 'omniauth-oauth2', '~> 1.0'
|
23
|
-
s.add_dependency 'dwolla', '>= 0.0.
|
23
|
+
s.add_dependency 'dwolla', '>= 0.0.12'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rake'
|
26
26
|
s.add_development_dependency 'rspec', '~> 2.7'
|
@@ -21,10 +21,41 @@ describe OmniAuth::Strategies::Dwolla do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
describe 'getting info' do
|
25
|
+
before do
|
26
|
+
@access_token = double(:token => 'test_token')
|
27
|
+
@dwolla_user = double( :id => '12345',
|
28
|
+
:name => 'Test Name',
|
29
|
+
:latitude => '123',
|
30
|
+
:longitude => '321',
|
31
|
+
:city => 'Sample City',
|
32
|
+
:state => 'TT',
|
33
|
+
:type => 'Personal' )
|
34
|
+
|
35
|
+
subject.stub(:access_token) { @access_token }
|
36
|
+
|
37
|
+
@dwolla_user.should_receive(:fetch).and_return(@dwolla_user)
|
38
|
+
::Dwolla::User.should_receive(:me).with(@access_token.token).and_return(@dwolla_user)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'set the correct info based on user' do
|
42
|
+
subject.info.should == { 'name' => 'Test Name',
|
43
|
+
'latitude' => '123',
|
44
|
+
'longitude' => '321',
|
45
|
+
'city' => 'Sample City',
|
46
|
+
'state' => 'TT',
|
47
|
+
'type' => 'Personal' }
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'set the correct uid based on user' do
|
51
|
+
subject.uid.should == '12345'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
24
55
|
describe '#authorize_params' do
|
25
56
|
it 'includes default scope for email and offline access' do
|
26
57
|
subject.authorize_params.should be_a(Hash)
|
27
|
-
subject.authorize_params[:scope].should eq('
|
58
|
+
subject.authorize_params[:scope].should eq('accountinfofull')
|
28
59
|
end
|
29
60
|
end
|
30
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-dwolla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement: &
|
16
|
+
requirement: &2166205940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2166205940
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: omniauth-oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &2166205260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,21 +32,21 @@ dependencies:
|
|
32
32
|
version: '1.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2166205260
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dwolla
|
38
|
-
requirement: &
|
38
|
+
requirement: &2166204800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.0.
|
43
|
+
version: 0.0.12
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2166204800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &2166204400 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2166204400
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &2166203820 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '2.7'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2166203820
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rack-test
|
71
|
-
requirement: &
|
71
|
+
requirement: &2166203300 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2166203300
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov
|
82
|
-
requirement: &
|
82
|
+
requirement: &2166202840 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2166202840
|
91
91
|
description: OmniAuth strategy for Dwolla.
|
92
92
|
email:
|
93
93
|
- contato@jefferson.eti.br
|
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
segments:
|
122
122
|
- 0
|
123
|
-
hash: -
|
123
|
+
hash: -3483138997451871976
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
126
126
|
requirements:
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
segments:
|
131
131
|
- 0
|
132
|
-
hash: -
|
132
|
+
hash: -3483138997451871976
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project: omniauth-dwolla
|
135
135
|
rubygems_version: 1.8.10
|