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.
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Dwolla
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ require 'dwolla'
4
4
  module OmniAuth
5
5
  module Strategies
6
6
  class Dwolla < OmniAuth::Strategies::OAuth2
7
- DEFAULT_SCOPE = 'send|transactions|balance|request|accountinfofull'
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 { raw_info.id }
15
+ uid { user.id }
16
16
 
17
17
  info do
18
18
  prune!({
19
- 'name' => raw_info.name,
20
- 'latitude' => raw_info.latitude,
21
- 'longitude' => raw_info.longitude,
22
- 'city' => raw_info.city,
23
- 'state' => raw_info.state,
24
- 'type' => raw_info.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|
@@ -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.10'
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('send|transactions|balance|request|accountinfofull')
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.11
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-15 00:00:00.000000000Z
12
+ date: 2012-01-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &2166954920 !ruby/object:Gem::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: *2166954920
24
+ version_requirements: *2166205940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: omniauth-oauth2
27
- requirement: &2166954340 !ruby/object:Gem::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: *2166954340
35
+ version_requirements: *2166205260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dwolla
38
- requirement: &2166953820 !ruby/object:Gem::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.10
43
+ version: 0.0.12
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2166953820
46
+ version_requirements: *2166204800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &2166953280 !ruby/object:Gem::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: *2166953280
57
+ version_requirements: *2166204400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &2166952520 !ruby/object:Gem::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: *2166952520
68
+ version_requirements: *2166203820
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-test
71
- requirement: &2166951940 !ruby/object:Gem::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: *2166951940
79
+ version_requirements: *2166203300
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: simplecov
82
- requirement: &2166951240 !ruby/object:Gem::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: *2166951240
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: -1117197958278180261
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: -1117197958278180261
132
+ hash: -3483138997451871976
133
133
  requirements: []
134
134
  rubyforge_project: omniauth-dwolla
135
135
  rubygems_version: 1.8.10