omniauth-boletosimples 0.1.0 → 0.1.1

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: b0060b4ecb03a3d5ca498fec9ed35b8cd5efd2a09176aad4f4edc4907dd0471e
4
- data.tar.gz: 9f653f20372ee7e87bfffb0026c340d3a3e4f5cea7dd7389e16016a3d13fb0a2
3
+ metadata.gz: d7fab2120bc0f923910c4a0e8cbe9b2e8fd01f5bca3862a41837261f289e9d6b
4
+ data.tar.gz: d99836911a51afcb1c86842d7ef79045c92b4b7cee52c9d54a22c470e967a124
5
5
  SHA512:
6
- metadata.gz: ddb8e8d2309e00ca27ee4ae84c140a25dda8fdf7b654656e965a91600d808cf6be9eb8889618d1fdbe73fada3a45c96f8cd0c0fdaf71a02fff94b23365aff1cc
7
- data.tar.gz: e529b3e2762e57790ef2b10f13baa481dc2cc071ed6a2ff2f9d028514ec355e5d521634d4780379d2074fe6e5b39931cca5bfe6dba4809da9ec3d139e773268e
6
+ metadata.gz: ccc83583be35f54546050a7e3af1d2fae79556978d4a4eaf17e074ff5cec25781a9469b6244653a75c9ca6387a3ede8ce48ca27f242764f7690fddbd77bb5d14
7
+ data.tar.gz: fd32fcbaec477e1c5ec38453e487dac801c089137579d5f542f058d00c9d4cd59e528aead9a98644aba558ee138c9173e63be39aff8701da292f1b245abe8068
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ AllCops:
2
+ NewCops: enable
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.3
1
+ 3.0.1
data/Gemfile CHANGED
@@ -5,3 +5,6 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  gem 'json'
8
+ gem 'rubocop'
9
+ gem 'rubocop-rake'
10
+ gem 'rubocop-rspec'
data/Gemfile.lock CHANGED
@@ -1,48 +1,80 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-boletosimples (0.1.0)
4
+ omniauth-boletosimples (0.1.1)
5
5
  omniauth-oauth2 (~> 1.6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- diff-lcs (1.3)
11
- faraday (0.15.4)
10
+ ast (2.4.2)
11
+ diff-lcs (1.4.4)
12
+ faraday (1.3.0)
13
+ faraday-net_http (~> 1.0)
12
14
  multipart-post (>= 1.2, < 3)
13
- hashie (3.6.0)
14
- json (2.2.0)
15
- jwt (2.2.1)
16
- multi_json (1.13.1)
15
+ ruby2_keywords
16
+ faraday-net_http (1.0.1)
17
+ hashie (4.1.0)
18
+ json (2.5.1)
19
+ jwt (2.2.2)
20
+ multi_json (1.15.0)
17
21
  multi_xml (0.6.0)
18
22
  multipart-post (2.1.1)
19
- oauth2 (1.4.1)
20
- faraday (>= 0.8, < 0.16.0)
23
+ oauth2 (1.4.7)
24
+ faraday (>= 0.8, < 2.0)
21
25
  jwt (>= 1.0, < 3.0)
22
26
  multi_json (~> 1.3)
23
27
  multi_xml (~> 0.5)
24
28
  rack (>= 1.2, < 3)
25
- omniauth (1.9.0)
26
- hashie (>= 3.4.6, < 3.7.0)
29
+ omniauth (2.0.4)
30
+ hashie (>= 3.4.6)
27
31
  rack (>= 1.6.2, < 3)
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)
32
+ rack-protection
33
+ omniauth-oauth2 (1.7.1)
34
+ oauth2 (~> 1.4)
35
+ omniauth (>= 1.9, < 3)
36
+ parallel (1.20.1)
37
+ parser (3.0.1.0)
38
+ ast (~> 2.4.1)
39
+ rack (2.2.3)
40
+ rack-protection (2.1.0)
41
+ rack
42
+ rainbow (3.0.0)
43
+ rake (13.0.3)
44
+ regexp_parser (2.1.1)
45
+ rexml (3.2.5)
46
+ rspec (3.10.0)
47
+ rspec-core (~> 3.10.0)
48
+ rspec-expectations (~> 3.10.0)
49
+ rspec-mocks (~> 3.10.0)
50
+ rspec-core (3.10.1)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-expectations (3.10.1)
40
53
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.8.0)
42
- rspec-mocks (3.8.1)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-mocks (3.10.2)
43
56
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.8.0)
45
- rspec-support (3.8.2)
57
+ rspec-support (~> 3.10.0)
58
+ rspec-support (3.10.2)
59
+ rubocop (1.12.1)
60
+ parallel (~> 1.10)
61
+ parser (>= 3.0.0.0)
62
+ rainbow (>= 2.2.2, < 4.0)
63
+ regexp_parser (>= 1.8, < 3.0)
64
+ rexml
65
+ rubocop-ast (>= 1.2.0, < 2.0)
66
+ ruby-progressbar (~> 1.7)
67
+ unicode-display_width (>= 1.4.0, < 3.0)
68
+ rubocop-ast (1.4.1)
69
+ parser (>= 2.7.1.5)
70
+ rubocop-rake (0.5.1)
71
+ rubocop
72
+ rubocop-rspec (2.2.0)
73
+ rubocop (~> 1.0)
74
+ rubocop-ast (>= 1.1.0)
75
+ ruby-progressbar (1.11.0)
76
+ ruby2_keywords (0.0.4)
77
+ unicode-display_width (2.0.0)
46
78
 
47
79
  PLATFORMS
48
80
  ruby
@@ -52,6 +84,9 @@ DEPENDENCIES
52
84
  omniauth-boletosimples!
53
85
  rake
54
86
  rspec
87
+ rubocop
88
+ rubocop-rake
89
+ rubocop-rspec
55
90
 
56
91
  BUNDLED WITH
57
- 2.0.2
92
+ 2.2.15
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module BoletoSimples
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -58,13 +58,14 @@ module OmniAuth
58
58
  environment = options.environment || :production
59
59
  options.client_options[:site] = ENVIRONMENTS[environment.to_sym]
60
60
  options.client_options[:authorize_url] = "#{ENVIRONMENTS[environment.to_sym]}/api/v1/oauth2/authorize"
61
- if options.user_agent
62
- options.client_options[:connection_opts] = {
63
- headers: {
64
- 'User-Agent' => options.user_agent
65
- }
61
+
62
+ return unless options.user_agent
63
+
64
+ options.client_options[:connection_opts] = {
65
+ headers: {
66
+ 'User-Agent' => options.user_agent
66
67
  }
67
- end
68
+ }
68
69
  end
69
70
 
70
71
  def raw_info
@@ -84,9 +85,6 @@ module OmniAuth
84
85
  private
85
86
 
86
87
  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
88
  access_token.get('/api/v1/userinfo').parsed
91
89
  end
92
90
  end
@@ -10,43 +10,58 @@ describe OmniAuth::Strategies::BoletoSimples do
10
10
 
11
11
  it_should_behave_like 'an oauth2 strategy'
12
12
 
13
- describe '#client' do
14
- it 'has correct BoletoSimples site' do
15
- subject.setup_phase
16
- expect(subject.client.site).to eq('https://boletosimples.com.br')
17
- end
13
+ it 'has correct BoletoSimples site' do
14
+ subject.setup_phase
15
+ expect(subject.client.site).to eq('https://boletosimples.com.br')
16
+ end
18
17
 
19
- it 'has correct BoletoSimples sandbox site' do
20
- @options = { environment: :sandbox }
21
- subject.setup_phase
22
- expect(subject.client.site).to eq('https://sandbox.boletosimples.com.br')
23
- end
18
+ it 'has correct BoletoSimples sandbox site' do
19
+ @options = { environment: :sandbox }
20
+ subject.setup_phase
21
+ expect(subject.client.site).to eq('https://sandbox.boletosimples.com.br')
22
+ end
24
23
 
25
- it 'has correct authorize url' do
26
- subject.setup_phase
27
- expect(subject.client.options[:authorize_url]).to eq('https://boletosimples.com.br/api/v1/oauth2/authorize')
28
- end
24
+ it 'has correct authorize url' do
25
+ subject.setup_phase
26
+ expect(subject.client.options[:authorize_url]).to eq('https://boletosimples.com.br/api/v1/oauth2/authorize')
27
+ end
29
28
 
30
- it 'has correct sandbox authorize url' do
31
- @options = { environment: :sandbox }
32
- subject.setup_phase
33
- expect(subject.client.options[:authorize_url]).to eq('https://sandbox.boletosimples.com.br/api/v1/oauth2/authorize')
34
- end
29
+ it 'has correct sandbox authorize url' do
30
+ @options = { environment: :sandbox }
31
+ subject.setup_phase
32
+ expect(subject.client.options[:authorize_url]).to eq('https://sandbox.boletosimples.com.br/api/v1/oauth2/authorize')
33
+ end
34
+
35
+ it 'has correct token url' do
36
+ expect(subject.client.options[:token_url]).to eq('/api/v1/oauth2/token')
37
+ end
35
38
 
36
- it 'has correct token url' do
37
- expect(subject.client.options[:token_url]).to eq('/api/v1/oauth2/token')
39
+ it 'has correct connection_opts' do
40
+ @options = { user_agent: 'email@example.com' }
41
+ subject.setup_phase
42
+ expect(subject.client.options[:connection_opts]).to eq(headers: { "User-Agent": 'email@example.com' })
43
+ end
44
+
45
+ describe '#callback_url' do
46
+ let(:base_url) { 'https://example.com' }
47
+
48
+ it 'has the correct default callback path' do
49
+ allow(subject).to receive(:full_host) { base_url }
50
+ allow(subject).to receive(:script_name) { '' }
51
+ expect(subject.send(:callback_url)).to eq("#{base_url}/auth/boletosimples/callback")
38
52
  end
39
53
 
40
- it 'has correct connection_opts' do
41
- @options = { user_agent: 'email@example.com' }
42
- subject.setup_phase
43
- expect(subject.client.options[:connection_opts]).to eq(headers: { "User-Agent": 'email@example.com' })
54
+ it 'should set the callback path with script_name if present' do
55
+ allow(subject).to receive(:full_host) { base_url }
56
+ allow(subject).to receive(:script_name) { '/v1' }
57
+ expect(subject.send(:callback_url)).to eq("#{base_url}/v1/v1/auth/boletosimples/callback")
44
58
  end
45
- end
46
59
 
47
- describe '#callback_path' do
48
- it 'has the correct callback path' do
49
- expect(subject.callback_path).to eq('/auth/boletosimples/callback')
60
+ it 'should set the callback_path parameter if present' do
61
+ @options = { callback_path: '/auth/foo/callback' }
62
+ allow(subject).to receive(:full_host) { base_url }
63
+ allow(subject).to receive(:script_name) { '' }
64
+ expect(subject.send(:callback_url)).to eq("#{base_url}/auth/foo/callback")
50
65
  end
51
66
  end
52
67
  end
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'bundler/setup'
4
4
  require 'rspec'
5
5
  require 'omniauth'
6
- Dir[File.expand_path('support/**/*', __dir__)].each { |f| require f }
6
+ Dir[File.expand_path('support/**/*', __dir__)].sort.each { |f| require f }
7
7
 
8
8
  RSpec.configure do |_config|
9
9
  OmniAuth.config.test_mode = true
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # NOTE it would be useful if this lived in omniauth-oauth2 eventually
3
+ # NOTE: it would be useful if this lived in omniauth-oauth2 eventually
4
4
  shared_examples 'an oauth2 strategy' do
5
5
  describe '#client' do
6
6
  it 'should be initialized with symbolized client_options' do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-boletosimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Lima
8
8
  - Kivanio Barbosa
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-10 00:00:00.000000000 Z
12
+ date: 2021-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2
@@ -53,7 +53,7 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- description:
56
+ description:
57
57
  email:
58
58
  - contato@rafael.adm.br
59
59
  - kivanio@gmail.com
@@ -62,6 +62,7 @@ extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
64
  - ".gitignore"
65
+ - ".rubocop.yml"
65
66
  - ".ruby-gemset"
66
67
  - ".ruby-version"
67
68
  - CHANGELOG.md
@@ -83,7 +84,7 @@ homepage: https://github.com/BoletoSimples/omniauth-boletosimples
83
84
  licenses:
84
85
  - MIT
85
86
  metadata: {}
86
- post_install_message:
87
+ post_install_message:
87
88
  rdoc_options: []
88
89
  require_paths:
89
90
  - lib
@@ -98,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  requirements: []
101
- rubygems_version: 3.0.3
102
- signing_key:
102
+ rubygems_version: 3.2.15
103
+ signing_key:
103
104
  specification_version: 4
104
105
  summary: BoletoSimples strategy for OmniAuth
105
106
  test_files: