omniauth-paypal-oauth2 1.4.11 → 1.4.12

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: dd2f166f6e0686965fa8b2ebae679c4b8b5d8b8f
4
- data.tar.gz: df9cc586c668c542d040fe8b78cb576f5c47e59f
3
+ metadata.gz: f8db4d3f029030ed80f716e5750974921ffedf5d
4
+ data.tar.gz: e4975e1847d5ed314642996d903f0ee7743dcea9
5
5
  SHA512:
6
- metadata.gz: a1231f151ae6a74fb9ea595c5b0ba26c9c7a0116b89cb8b676470c0537fddbbfa54ad746b8aab10dca62b04bdf7b102c49d195c977b24dac73f1dac94b511e9f
7
- data.tar.gz: 9f006baaa3344629cfd61afa6e40298f622d4d327151b4d42f594a1c1f0e0381cf89dd7e12f0f2e29058c4519ceb6c8f11d83bc6077437a83d9605a59f59d93f
6
+ metadata.gz: b8f3d346ceb1553f5817af559b776d5405a566b77dd417d2c4b9a476acf7cbca83cf3d6e1b2325de4acea32a47d9229c4acd0798bb0ee84751476aa15a90b3e4
7
+ data.tar.gz: 28cfba0158c0989c1f6015709e957ffd196923ce4e488476135323ebfed22e0905d1a336a3b0f28c64bf2719999c58fdb694541375cf1d14db470ab5d6c5e9f8
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gemspec
3
+ gemspec
4
+
5
+ # Development
6
+ group :development do
7
+ gem 'rubocop', '~> 0.47.1', require: false
8
+ end
data/README.md CHANGED
@@ -44,7 +44,7 @@ Here's an example for adding the middleware to a Rails app in `config/initialize
44
44
 
45
45
  ```ruby
46
46
  Rails.application.config.middleware.use OmniAuth::Builder do
47
- provider :paypal_oauth2, ENV["PAYPAL_CLIENT_ID"], ENV["PAYPAL_CLIENT_SECRET"], :strategy_class => OmniAuth::Strategies::PayPalOauth2
47
+ provider :paypal_oauth2, ENV["PAYPAL_CLIENT_ID"], ENV["PAYPAL_CLIENT_SECRET"]
48
48
  end
49
49
  ```
50
50
 
@@ -138,7 +138,7 @@ Configuration options can be passed as the last parameter here as key/value pair
138
138
 
139
139
  ```ruby
140
140
  require "omniauth-paypal-oauth2"
141
- config.omniauth :paypal_oauth2, "PAYPAL_CLIENT_ID", "PAYPAL_CLIENT_SECRET", :strategy_class => OmniAuth::Strategies::PayPalOauth2, { }
141
+ config.omniauth :paypal_oauth2, "PAYPAL_CLIENT_ID", "PAYPAL_CLIENT_SECRET", { }
142
142
  ```
143
143
 
144
144
  Then add the following to 'config/routes.rb' so the callback routes are defined.
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -1,20 +1,20 @@
1
1
  shared_examples 'an oauth2 strategy' do
2
2
  describe '#client' do
3
3
  it 'should be initialized with symbolized client_options' do
4
- @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
4
+ @options = { client_options: { 'authorize_url' => 'https://example.com' } }
5
5
  expect(subject.client.options[:authorize_url]).to eq('https://example.com')
6
6
  end
7
7
  end
8
8
 
9
9
  describe '#authorize_params' do
10
10
  it 'should include any authorize params passed in the :authorize_params option' do
11
- @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
11
+ @options = { authorize_params: { foo: 'bar', baz: 'zip' } }
12
12
  expect(subject.authorize_params['foo']).to eq('bar')
13
13
  expect(subject.authorize_params['baz']).to eq('zip')
14
14
  end
15
15
 
16
16
  it 'should include top-level options that are marked as :authorize_options' do
17
- @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
17
+ @options = { authorize_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
18
18
  expect(subject.authorize_params['scope']).to eq('bar')
19
19
  expect(subject.authorize_params['foo']).to eq('baz')
20
20
  end
@@ -22,13 +22,13 @@ shared_examples 'an oauth2 strategy' do
22
22
 
23
23
  describe '#token_params' do
24
24
  it 'should include any token params passed in the :token_params option' do
25
- @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
25
+ @options = { token_params: { foo: 'bar', baz: 'zip' } }
26
26
  expect(subject.token_params['foo']).to eq('bar')
27
27
  expect(subject.token_params['baz']).to eq('zip')
28
28
  end
29
29
 
30
30
  it 'should include top-level options that are marked as :token_options' do
31
- @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
31
+ @options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
32
32
  expect(subject.token_params['scope']).to eq('bar')
33
33
  expect(subject.token_params['foo']).to eq('baz')
34
34
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
- module PayPalOauth2
3
- VERSION = "1.4.11"
2
+ module PaypalOauth2
3
+ VERSION = '1.4.12'
4
4
  end
5
5
  end
@@ -2,26 +2,26 @@ require 'omniauth-oauth2'
2
2
 
3
3
  module OmniAuth
4
4
  module Strategies
5
- class PayPalOauth2 < OmniAuth::Strategies::OAuth2
6
- DEFAULT_SCOPE = "email,profile"
7
- DEFAULT_RESPONSE_TYPE = "code"
8
- SANDBOX_SITE = "https://api.sandbox.paypal.com"
5
+ class PaypalOauth2 < OmniAuth::Strategies::OAuth2
6
+ DEFAULT_SCOPE = 'email,profile'
7
+ DEFAULT_RESPONSE_TYPE = 'code'
8
+ SANDBOX_SITE = 'https://api.sandbox.paypal.com'
9
9
  SANDBOX_AUTHORIZE_URL = 'https://www.sandbox.paypal.com/signin/authorize'
10
10
 
11
- option :name, "paypal_oauth2"
11
+ option :name, 'paypal_oauth2'
12
12
 
13
13
  option :client_options, {
14
- :site => 'https://api.paypal.com',
15
- :authorize_url => 'https://www.paypal.com/signin/authorize',
16
- :token_url => '/v1/identity/openidconnect/tokenservice',
17
- :setup => true
14
+ site: 'https://api.paypal.com',
15
+ authorize_url: 'https://www.paypal.com/signin/authorize',
16
+ token_url: '/v1/identity/openidconnect/tokenservice',
17
+ setup: true
18
18
  }
19
19
 
20
20
  option :authorize_options, [:scope, :response_type]
21
21
  option :provider_ignores_state, true
22
22
  option :sandbox, false
23
23
 
24
- uid { @parsed_uid ||= (/\/([^\/]+)\z/.match raw_info['user_id'])[1] } #https://www.paypal.com/webapps/auth/identity/user/baCNqjGvIxzlbvDCSsfhN3IrQDtQtsVr79AwAjMxekw => baCNqjGvIxzlbvDCSsfhN3IrQDtQtsVr79AwAjMxekw
24
+ uid { @parsed_uid ||= (%r{\/([^\/]+)\z}.match raw_info['user_id'])[1] } # https://www.paypal.com/webapps/auth/identity/user/baCNqjGvIxzlbvDCSsfhN3IrQDtQtsVr79AwAjMxekw => baCNqjGvIxzlbvDCSsfhN3IrQDtQtsVr79AwAjMxekw
25
25
 
26
26
  info do
27
27
  prune!({
@@ -64,7 +64,7 @@ module OmniAuth
64
64
  end
65
65
 
66
66
  def raw_info
67
- @raw_info ||= load_identity()
67
+ @raw_info ||= load_identity
68
68
  end
69
69
 
70
70
  def authorize_params
@@ -74,17 +74,13 @@ module OmniAuth
74
74
  end
75
75
  end
76
76
 
77
- def callback_url
78
- full_host + script_name + callback_path
79
- end
80
-
81
77
  private
82
78
 
83
79
  def load_identity
84
80
  access_token.options[:mode] = :query
85
81
  access_token.options[:param_name] = :access_token
86
82
  access_token.options[:grant_type] = :authorization_code
87
- access_token.get('/v1/identity/openidconnect/userinfo', { :params => { :schema => 'openid'}}).parsed || {}
83
+ access_token.get('/v1/identity/openidconnect/userinfo', { params: { schema: 'openid' } }).parsed || {}
88
84
  end
89
85
 
90
86
  def prune!(hash)
@@ -93,7 +89,6 @@ module OmniAuth
93
89
  value.nil? || (value.respond_to?(:empty?) && value.empty?)
94
90
  end
95
91
  end
96
-
97
92
  end
98
93
  end
99
94
  end
@@ -3,16 +3,16 @@ require File.expand_path(File.join('..', 'lib', 'omniauth', 'paypal_oauth2', 've
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = 'omniauth-paypal-oauth2'
6
- gem.version = OmniAuth::PayPalOauth2::VERSION
6
+ gem.version = OmniAuth::PaypalOauth2::VERSION
7
7
  gem.license = 'MIT'
8
- gem.summary = %q{A PayPal OAuth2 strategy for OmniAuth 1.x}
9
- gem.description = %q{A PayPal OAuth2 strategy for OmniAuth 1.x}
8
+ gem.summary = 'A PayPal OAuth2 strategy for OmniAuth 1.x'
9
+ gem.description = 'A PayPal OAuth2 strategy for OmniAuth 1.x'
10
10
  gem.authors = ['Jonas Hübotter']
11
11
  gem.email = ['jonas@slooob.com']
12
12
  gem.homepage = 'https://github.com/jonhue/omniauth-paypal-oauth2'
13
13
 
14
14
  gem.files = `git ls-files`.split("\n")
15
- gem.require_paths = ["lib"]
15
+ gem.require_paths = ['lib']
16
16
 
17
17
  gem.required_ruby_version = '>= 2.0'
18
18
 
@@ -21,4 +21,4 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.add_development_dependency 'rspec', '~> 3.5'
23
23
  gem.add_development_dependency 'rake'
24
- end
24
+ end
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
  require 'omniauth-paypal-oauth2'
3
3
 
4
- describe OmniAuth::Strategies::PayPalOauth2 do
4
+ describe OmniAuth::Strategies::PaypalOauth2 do
5
5
  subject do
6
- OmniAuth::Strategies::PayPalOauth2.new(nil, @options || {})
6
+ OmniAuth::Strategies::PaypalOauth2.new(nil, @options || {})
7
7
  end
8
8
 
9
9
  it_should_behave_like 'an oauth2 strategy'
@@ -14,7 +14,7 @@ describe OmniAuth::Strategies::PayPalOauth2 do
14
14
  end
15
15
 
16
16
  it 'has correct PayPal sandbox site' do
17
- @options = { :sandbox => true }
17
+ @options = { sandbox: true }
18
18
  subject.setup_phase
19
19
  expect(subject.client.site).to eq('https://api.sandbox.paypal.com')
20
20
  end
@@ -24,7 +24,7 @@ describe OmniAuth::Strategies::PayPalOauth2 do
24
24
  end
25
25
 
26
26
  it 'has correct sandbox authorize url' do
27
- @options = { :sandbox => true }
27
+ @options = { sandbox: true }
28
28
  subject.setup_phase
29
29
  expect(subject.client.options[:authorize_url]).to eq('https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize')
30
30
  end
@@ -35,14 +35,14 @@ describe OmniAuth::Strategies::PayPalOauth2 do
35
35
 
36
36
  it 'runs the setup block if passed one' do
37
37
  counter = ''
38
- @options = { :setup => Proc.new { |env| counter = 'ok' } }
38
+ @options = { setup: proc { counter = 'ok' } }
39
39
  subject.setup_phase
40
- expect(counter).to eq("ok")
40
+ expect(counter).to eq('ok')
41
41
  end
42
42
  end
43
43
 
44
44
  describe '#callback_path' do
45
- it "has the correct callback path" do
45
+ it 'has the correct callback path' do
46
46
  expect(subject.callback_path).to eq('/auth/paypal_oauth2/callback')
47
47
  end
48
48
  end
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,6 @@ require 'rspec'
3
3
  require 'omniauth-oauth2'
4
4
  Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
5
5
 
6
- RSpec.configure do |config|
7
- OmniAuth.config.test_mode = true
6
+ RSpec.configure do
7
+ OmniAuth.config.test_mode = true
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-paypal-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.11
4
+ version: 1.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-17 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2