omniauth-dwolla 0.0.14 → 0.0.16

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: 6c00ae2287f00a14d363b7a42f88dbbd93d49861
4
- data.tar.gz: 58feebf016218b3162393c2047caf3631bf92464
3
+ metadata.gz: 708c6cb6598b5c0b6afac46100b0a106a900dba8
4
+ data.tar.gz: 0f5438fa8c45ab1870fc8738d34a523ba0f7f9a8
5
5
  SHA512:
6
- metadata.gz: 60ec1dc3bf0d5a3f8a728564d55cc3a9134b18f114c8f886fa897b661707b0ecc8ecc2154a4901257ad816cb6a4174512ca91a4f63b0a5ac60657c9e7a9efa08
7
- data.tar.gz: d3e8bbed83d5e012f7f2e171672e84bcab417bb1080c2ff619ac5b4f18a9bf8f11a2ce64cd8896aad083417c713a9e7d266023b7b890941f533b83fcc6fd76c4
6
+ metadata.gz: 02a0fc43bc3e182127f0f84969b83942c2f672ea871fef9e54d3453a9e968a58c3f82a73f4f2f0d917660fc03a48aae957ae0ed718cbcf8a8227cb976e293943
7
+ data.tar.gz: f39e3f4fa250c93ab67ee0ed98639b23d76d700cf6ed1551ac123e2626819e00cbe03be3512dc0682e5b2e87eca7cc4d8edc93a76608fc9f63ccf3ba7c3d6f87
@@ -0,0 +1,12 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## 0.0.16 - 2014-10-11
5
+ ### Added
6
+ * A Changelog
7
+ * A maintainer's note with contact info
8
+
9
+ ### Changed
10
+ * merged in [LeadDyno](https://github.com/LeadDyno)'s work to support new
11
+ [dwolla-ruby](https://github.com/Dwolla/dwolla-ruby) gem.
12
+
data/README.md CHANGED
@@ -14,18 +14,26 @@ Then `bundle install`.
14
14
 
15
15
  ## Usage
16
16
 
17
- `OmniAuth::Strategies::Dwolla` is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth.
17
+ `OmniAuth::Strategies::Dwolla` is simply a Rack middleware.
18
+ Read the OmniAuth 1.0 docs for detailed instructions:
19
+ <https://github.com/intridea/omniauth>.
18
20
 
19
- Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb` and getting a token with scope permissions for full user info, send and request transactions:
21
+ Here's a quick example, adding the middleware to a Rails app
22
+ in `config/initializers/omniauth.rb` and getting a token with
23
+ scope permissions for full user info, send and request transactions:
20
24
 
21
25
  ```ruby
22
26
  Rails.application.config.middleware.use OmniAuth::Builder do
23
- provider :dwolla, ENV['DWOLLA_KEY'], ENV['DWOLLA_SECRET'], :scope => 'accountinfofull|send|request', :provider_ignores_state => true
27
+ provider :dwolla, ENV['DWOLLA_KEY'], ENV['DWOLLA_SECRET'],
28
+ :scope => 'accountinfofull|send|request',
29
+ :provider_ignores_state => true
24
30
  end
25
31
  ```
26
- The :scope param is optional.
27
32
 
28
- The default :scope is 'accountinfofull'. It is necessary in order to grab the uid and detailed info for user.
33
+ The `:scope` param is optional.
34
+
35
+ The default :scope is 'accountinfofull'.
36
+ It is necessary in order to grab the uid and detailed info for user.
29
37
 
30
38
  The extra hash will include:
31
39
  ```json
@@ -42,6 +50,22 @@ The extra hash will include:
42
50
 
43
51
  ## Exception Handling
44
52
 
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.
53
+ If the Dwolla library raises a `Dwolla::RequestException`,
54
+ that will be wrapped and re-raised as a
55
+ `OmniAuth::Strategies::OAuth2::CallbackError`. The OmniAuth OAuth2
56
+ library will, in turn, treat that as a failure due to invalid
57
+ credentials, passing the `CallbackError` through Rack's middleware chain.
58
+
59
+ Note that the `Devise::OmniauthCallbacksController` provides a
60
+ good example of handling this scenario.
61
+
62
+ ## Maintainer's Note
63
+
64
+ The [omniauth-dwolla gem](https://github.com/masukomi/omniauth-dwolla)
65
+ is currently maintained by masukomi ([GitHub](https://github.com/masukomi/), [web](http://masukomi.org/)). PRs will be happily accepted but
66
+ the tests must still pass (and be updated if necessary). We're dealing
67
+ with money here folks. We can't be careless.
46
68
 
47
- Note that the `Devise::OmniauthCallbacksController` provides a good example of handling this scenario.
69
+ I'm [@masukomi on Twitter](https://twitter.com/masukomi) and that's the best
70
+ way to contact me if you have any questions or ideas about this gem. My GitHub
71
+ notifications page is typically overflowing with stuff from work. ;)
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Dwolla
3
- VERSION = "0.0.14"
3
+ VERSION = "0.0.16"
4
4
  end
5
5
  end
@@ -16,17 +16,17 @@ module OmniAuth
16
16
  # If anyone can figure a way to make it work
17
17
  # PLEASE issue a pull request. -masukomi
18
18
 
19
- uid { user.id }
19
+ uid { user['Id'] }
20
20
 
21
21
  info do
22
22
  prune!({
23
- 'name' => user.name,
24
- 'latitude' => user.latitude,
25
- 'longitude' => user.longitude,
26
- 'city' => user.city,
27
- 'state' => user.state,
28
- 'type' => user.type
29
- })
23
+ 'name' => user['Name'],
24
+ 'latitude' => user['Latitude'],
25
+ 'longitude' => user['Longitude'],
26
+ 'city' => user['City'],
27
+ 'state' => user['State'],
28
+ 'type' => user['Type']
29
+ })
30
30
  end
31
31
 
32
32
  def authorize_params
@@ -37,8 +37,8 @@ module OmniAuth
37
37
 
38
38
  private
39
39
  def user
40
- @user ||= ::Dwolla::User.me(access_token.token).fetch
41
- rescue ::Dwolla::RequestException => e
40
+ @user ||= ::Dwolla::Users.me(access_token.token)
41
+ rescue ::Dwolla::DwollaError => e
42
42
  raise CallbackError.new(e, e.message)
43
43
  end
44
44
 
@@ -25,10 +25,9 @@ END
25
25
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
26
  s.require_paths = ["lib"]
27
27
 
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
28
+ s.add_dependency 'omniauth', '~> 1.2'
29
+ s.add_dependency 'omniauth-oauth2', '~> 1.2'
30
+ s.add_dependency 'dwolla-ruby', '~> 2.5'
32
31
 
33
32
  s.add_development_dependency 'rake'
34
33
  s.add_development_dependency 'rspec', '~> 2.13.0'
@@ -27,31 +27,31 @@ describe OmniAuth::Strategies::Dwolla do
27
27
  describe 'getting info' do
28
28
  before do
29
29
  @access_token = double(:token => 'test_token')
30
- @dwolla_user = double( :id => '12345',
31
- :name => 'Test Name',
32
- :latitude => '123',
33
- :longitude => '321',
34
- :city => 'Sample City',
35
- :state => 'TT',
36
- :type => 'Personal' )
30
+ @dwolla_user = { 'Id' => '12345',
31
+ 'Name' => 'Test Name',
32
+ 'Latitude' => '123',
33
+ 'Longitude' => '321',
34
+ 'City' => 'Sample City',
35
+ 'State' => 'TT',
36
+ 'Type' => 'Personal' }
37
37
 
38
38
  subject.stub(:access_token) { @access_token }
39
-
40
- ::Dwolla::User.should_receive(:me).with(@access_token.token).and_return(@dwolla_user)
41
39
  end
42
40
 
43
41
  context 'when successful' do
44
42
  before do
45
- @dwolla_user.should_receive(:fetch).and_return(@dwolla_user)
43
+ ::Dwolla::Users.should_receive(:me).with(@access_token.token).and_return(@dwolla_user)
46
44
  end
47
45
 
48
46
  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' }
47
+ # note that the keys are all lowercase
48
+ # unlike the response that came back from Dwolla
49
+ expect(subject.info).to eq({ 'name' => 'Test Name',
50
+ 'latitude' => '123',
51
+ 'longitude' => '321',
52
+ 'city' => 'Sample City',
53
+ 'state' => 'TT',
54
+ 'type' => 'Personal' })
55
55
  end
56
56
 
57
57
  it 'sets the correct uid based on user' do
@@ -59,11 +59,11 @@ describe OmniAuth::Strategies::Dwolla do
59
59
  end
60
60
  end
61
61
 
62
- context 'when a Dwolla::RequestException is raised' do
63
- let(:request_exception) { ::Dwolla::RequestException.new('Dwolla Error Message') }
62
+ context 'when a Dwolla::AuthenticationError is raised' do
63
+ let(:auth_error) { ::Dwolla::AuthenticationError.new('Dwolla Error Message') }
64
64
 
65
65
  before do
66
- @dwolla_user.should_receive(:fetch).and_raise(request_exception)
66
+ ::Dwolla::Users.should_receive(:me).with(@access_token.token).and_raise(auth_error)
67
67
  end
68
68
 
69
69
  it 're-raises the appropriate OAuth error' do
@@ -79,8 +79,8 @@ describe OmniAuth::Strategies::Dwolla do
79
79
  subject.uid
80
80
  rescue OmniAuth::Strategies::OAuth2::CallbackError => e
81
81
  exception = e
82
- exception.error.should eq(request_exception)
83
- exception.error_reason.should eq(request_exception.message)
82
+ exception.error.should eq(auth_error)
83
+ exception.error_reason.should eq(auth_error.message)
84
84
  end
85
85
 
86
86
  exception.should be
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-dwolla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - masukomi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-28 00:00:00.000000000 Z
11
+ date: 2014-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.4
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.4
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: omniauth-oauth2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.1
33
+ version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.1
40
+ version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: dwolla
42
+ name: dwolla-ruby
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.14
47
+ version: '2.5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.14
54
+ version: '2.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +130,7 @@ extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
132
  - .gitignore
133
+ - CHANGELOG.md
133
134
  - Gemfile
134
135
  - README.md
135
136
  - Rakefile