omniauth-boletosimples 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cb401f88cad09689c2b5499482999e236065d8bb8278494acc6ef4f482ab266
4
- data.tar.gz: 6a522bd6a9bcca95c5f59ff5055398e835c6d70b77ec461d7b05bd5e794e2018
3
+ metadata.gz: b0060b4ecb03a3d5ca498fec9ed35b8cd5efd2a09176aad4f4edc4907dd0471e
4
+ data.tar.gz: 9f653f20372ee7e87bfffb0026c340d3a3e4f5cea7dd7389e16016a3d13fb0a2
5
5
  SHA512:
6
- metadata.gz: fd6930fda3956c619c3b53299244e32238262332acbe79da9bf385260bf4f25d3905c74bb62232c436abc835e744c47c3903d910d58a733f33ddfb691758c68e
7
- data.tar.gz: 5d9fd123dc24705966541b7e3d243cd2c9ee31e0a46c74c19ccfec8e08f98e9968b1ce1fd274192bab22b181b5e9cf8ca78471f28c3b0392fb743b0ebae17f9f
6
+ metadata.gz: ddb8e8d2309e00ca27ee4ae84c140a25dda8fdf7b654656e965a91600d808cf6be9eb8889618d1fdbe73fada3a45c96f8cd0c0fdaf71a02fff94b23365aff1cc
7
+ data.tar.gz: e529b3e2762e57790ef2b10f13baa481dc2cc071ed6a2ff2f9d028514ec355e5d521634d4780379d2074fe6e5b39931cca5bfe6dba4809da9ec3d139e773268e
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.6.3
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
@@ -1,48 +1,48 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-boletosimples (0.0.9)
5
- omniauth-oauth2 (~> 1.4.0)
4
+ omniauth-boletosimples (0.1.0)
5
+ omniauth-oauth2 (~> 1.6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  diff-lcs (1.3)
11
- faraday (0.12.2)
11
+ faraday (0.15.4)
12
12
  multipart-post (>= 1.2, < 3)
13
- hashie (3.5.7)
14
- json (2.1.0)
15
- jwt (1.5.6)
13
+ hashie (3.6.0)
14
+ json (2.2.0)
15
+ jwt (2.2.1)
16
16
  multi_json (1.13.1)
17
17
  multi_xml (0.6.0)
18
- multipart-post (2.0.0)
19
- oauth2 (1.4.0)
20
- faraday (>= 0.8, < 0.13)
21
- jwt (~> 1.0)
18
+ multipart-post (2.1.1)
19
+ oauth2 (1.4.1)
20
+ faraday (>= 0.8, < 0.16.0)
21
+ jwt (>= 1.0, < 3.0)
22
22
  multi_json (~> 1.3)
23
23
  multi_xml (~> 0.5)
24
24
  rack (>= 1.2, < 3)
25
- omniauth (1.8.1)
26
- hashie (>= 3.4.6, < 3.6.0)
25
+ omniauth (1.9.0)
26
+ hashie (>= 3.4.6, < 3.7.0)
27
27
  rack (>= 1.6.2, < 3)
28
- omniauth-oauth2 (1.4.0)
29
- oauth2 (~> 1.0)
30
- omniauth (~> 1.2)
31
- rack (2.0.3)
32
- rake (12.3.0)
33
- rspec (3.7.0)
34
- rspec-core (~> 3.7.0)
35
- rspec-expectations (~> 3.7.0)
36
- rspec-mocks (~> 3.7.0)
37
- rspec-core (3.7.1)
38
- rspec-support (~> 3.7.0)
39
- rspec-expectations (3.7.0)
28
+ omniauth-oauth2 (1.6.0)
29
+ oauth2 (~> 1.1)
30
+ omniauth (~> 1.9)
31
+ rack (2.0.7)
32
+ rake (12.3.2)
33
+ rspec (3.8.0)
34
+ rspec-core (~> 3.8.0)
35
+ rspec-expectations (~> 3.8.0)
36
+ rspec-mocks (~> 3.8.0)
37
+ rspec-core (3.8.2)
38
+ rspec-support (~> 3.8.0)
39
+ rspec-expectations (3.8.4)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.7.0)
42
- rspec-mocks (3.7.0)
41
+ rspec-support (~> 3.8.0)
42
+ rspec-mocks (3.8.1)
43
43
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.7.0)
45
- rspec-support (3.7.0)
44
+ rspec-support (~> 3.8.0)
45
+ rspec-support (3.8.2)
46
46
 
47
47
  PLATFORMS
48
48
  ruby
@@ -54,4 +54,4 @@ DEPENDENCIES
54
54
  rspec
55
55
 
56
56
  BUNDLED WITH
57
- 1.16.1
57
+ 2.0.2
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1 +1,3 @@
1
- require 'omniauth/boletosimples'
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/boletosimples'
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth/boletosimples/version'
2
- require 'omniauth/strategies/boletosimples'
4
+ require 'omniauth/strategies/boletosimples'
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OmniAuth
2
4
  module BoletoSimples
3
- VERSION = "0.0.9"
5
+ VERSION = '0.1.0'
4
6
  end
5
7
  end
@@ -1,21 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-oauth2'
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class BoletoSimples < OmniAuth::Strategies::OAuth2
6
- DEFAULT_SCOPE = "profile"
8
+ DEFAULT_SCOPE = 'profile'
7
9
  ENVIRONMENTS = {
8
10
  development: 'http://localhost:5000',
9
11
  sandbox: 'https://sandbox.boletosimples.com.br',
10
12
  production: 'https://boletosimples.com.br'
11
- }
13
+ }.freeze
12
14
  option :name, 'boletosimples'
13
- option :client_options, {
14
- :token_url => '/api/v1/oauth2/token',
15
- :setup => true
16
- }
15
+ option :client_options,
16
+ token_url: '/api/v1/oauth2/token',
17
+ setup: true
17
18
 
18
- option :authorize_options, [:scope, :response_type]
19
+ option :authorize_options, %i[scope response_type]
19
20
  option :provider_ignores_state, true
20
21
  option :environment, :production
21
22
 
@@ -33,7 +34,7 @@ module OmniAuth
33
34
  cpf: raw_info['cpf'],
34
35
  mother_name: raw_info['mother_name'],
35
36
  father_name: raw_info['father_name'],
36
- sex: raw_info['sex'],
37
+ sex: raw_info['sex']
37
38
  }
38
39
  end
39
40
 
@@ -57,11 +58,13 @@ module OmniAuth
57
58
  environment = options.environment || :production
58
59
  options.client_options[:site] = ENVIRONMENTS[environment.to_sym]
59
60
  options.client_options[:authorize_url] = "#{ENVIRONMENTS[environment.to_sym]}/api/v1/oauth2/authorize"
60
- options.client_options[:connection_opts] = {
61
- headers: {
62
- 'User-Agent' => options.user_agent,
61
+ if options.user_agent
62
+ options.client_options[:connection_opts] = {
63
+ headers: {
64
+ 'User-Agent' => options.user_agent
65
+ }
63
66
  }
64
- } if options.user_agent
67
+ end
65
68
  end
66
69
 
67
70
  def raw_info
@@ -79,12 +82,13 @@ module OmniAuth
79
82
  end
80
83
 
81
84
  private
82
- def load_identity
83
- access_token.options[:mode] = :query
84
- access_token.options[:param_name] = :access_token
85
- access_token.options[:grant_type] = :authorization_code
86
- access_token.get('/api/v1/userinfo').parsed
87
- end
85
+
86
+ def load_identity
87
+ access_token.options[:mode] = :query
88
+ access_token.options[:param_name] = :access_token
89
+ access_token.options[:grant_type] = :authorization_code
90
+ access_token.get('/api/v1/userinfo').parsed
91
+ end
88
92
  end
89
93
  end
90
94
  end
@@ -1,5 +1,6 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
3
4
  require 'omniauth/boletosimples/version'
4
5
 
5
6
  Gem::Specification.new do |s|
@@ -16,8 +17,8 @@ Gem::Specification.new do |s|
16
17
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
17
18
  s.require_paths = ['lib']
18
19
 
19
- s.add_runtime_dependency 'omniauth-oauth2', '~> 1.4.0'
20
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1.6'
20
21
 
21
- s.add_development_dependency 'rspec'
22
22
  s.add_development_dependency 'rake'
23
- end
23
+ s.add_development_dependency 'rspec'
24
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'omniauth-boletosimples'
3
5
 
@@ -15,7 +17,7 @@ describe OmniAuth::Strategies::BoletoSimples do
15
17
  end
16
18
 
17
19
  it 'has correct BoletoSimples sandbox site' do
18
- @options = { :environment => :sandbox }
20
+ @options = { environment: :sandbox }
19
21
  subject.setup_phase
20
22
  expect(subject.client.site).to eq('https://sandbox.boletosimples.com.br')
21
23
  end
@@ -26,7 +28,7 @@ describe OmniAuth::Strategies::BoletoSimples do
26
28
  end
27
29
 
28
30
  it 'has correct sandbox authorize url' do
29
- @options = { :environment => :sandbox }
31
+ @options = { environment: :sandbox }
30
32
  subject.setup_phase
31
33
  expect(subject.client.options[:authorize_url]).to eq('https://sandbox.boletosimples.com.br/api/v1/oauth2/authorize')
32
34
  end
@@ -36,17 +38,15 @@ describe OmniAuth::Strategies::BoletoSimples do
36
38
  end
37
39
 
38
40
  it 'has correct connection_opts' do
39
- @options = { :user_agent => 'email@example.com' }
41
+ @options = { user_agent: 'email@example.com' }
40
42
  subject.setup_phase
41
- expect(subject.client.options[:connection_opts]).to eq({:headers=>{:"User-Agent"=>"email@example.com"}})
43
+ expect(subject.client.options[:connection_opts]).to eq(headers: { "User-Agent": 'email@example.com' })
42
44
  end
43
-
44
45
  end
45
46
 
46
47
  describe '#callback_path' do
47
- it "has the correct callback path" do
48
+ it 'has the correct callback path' do
48
49
  expect(subject.callback_path).to eq('/auth/boletosimples/callback')
49
50
  end
50
51
  end
51
-
52
52
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'rspec'
3
5
  require 'omniauth'
4
- Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
6
+ Dir[File.expand_path('support/**/*', __dir__)].each { |f| require f }
5
7
 
6
- RSpec.configure do |config|
8
+ RSpec.configure do |_config|
7
9
  OmniAuth.config.test_mode = true
8
10
  end
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # NOTE it would be useful if this lived in omniauth-oauth2 eventually
2
4
  shared_examples 'an oauth2 strategy' do
3
5
  describe '#client' do
4
6
  it 'should be initialized with symbolized client_options' do
5
- @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
7
+ @options = { client_options: { 'authorize_url' => 'https://example.com' } }
6
8
  expect(subject.client.options[:authorize_url]).to eq('https://example.com')
7
9
  end
8
10
  end
9
11
 
10
12
  describe '#authorize_params' do
11
13
  it 'should include any authorize params passed in the :authorize_params option' do
12
- @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
14
+ @options = { authorize_params: { foo: 'bar', baz: 'zip' } }
13
15
  expect(subject.authorize_params['foo']).to eq('bar')
14
16
  expect(subject.authorize_params['baz']).to eq('zip')
15
17
  end
16
18
 
17
19
  it 'should include top-level options that are marked as :authorize_options' do
18
- @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
20
+ @options = { authorize_options: %i[scope foo], scope: 'bar', foo: 'baz' }
19
21
  expect(subject.authorize_params['scope']).to eq('bar')
20
22
  expect(subject.authorize_params['foo']).to eq('baz')
21
23
  end
@@ -23,15 +25,15 @@ shared_examples 'an oauth2 strategy' do
23
25
 
24
26
  describe '#token_params' do
25
27
  it 'should include any token params passed in the :token_params option' do
26
- @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
28
+ @options = { token_params: { foo: 'bar', baz: 'zip' } }
27
29
  expect(subject.token_params['foo']).to eq('bar')
28
30
  expect(subject.token_params['baz']).to eq('zip')
29
31
  end
30
32
 
31
33
  it 'should include top-level options that are marked as :token_options' do
32
- @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
34
+ @options = { token_options: %i[scope foo], scope: 'bar', foo: 'baz' }
33
35
  expect(subject.token_params['scope']).to eq('bar')
34
36
  expect(subject.token_params['foo']).to eq('baz')
35
37
  end
36
38
  end
37
- end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-boletosimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Lima
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-22 00:00:00.000000000 Z
12
+ date: 2019-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2
@@ -17,16 +17,16 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.4.0
20
+ version: '1.6'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.4.0
27
+ version: '1.6'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rspec
29
+ name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
@@ -40,7 +40,7 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rake
43
+ name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
@@ -98,8 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.7.3
101
+ rubygems_version: 3.0.3
103
102
  signing_key:
104
103
  specification_version: 4
105
104
  summary: BoletoSimples strategy for OmniAuth