omniauth-boletosimples 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/Gemfile +3 -0
- data/Gemfile.lock +63 -28
- data/lib/omniauth/boletosimples/version.rb +1 -1
- data/lib/omniauth/strategies/boletosimples.rb +7 -9
- data/spec/omniauth/strategies/boletosimples_spec.rb +44 -29
- data/spec/spec_helper.rb +1 -1
- data/spec/support/shared_examples.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7fab2120bc0f923910c4a0e8cbe9b2e8fd01f5bca3862a41837261f289e9d6b
|
4
|
+
data.tar.gz: d99836911a51afcb1c86842d7ef79045c92b4b7cee52c9d54a22c470e967a124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccc83583be35f54546050a7e3af1d2fae79556978d4a4eaf17e074ff5cec25781a9469b6244653a75c9ca6387a3ede8ce48ca27f242764f7690fddbd77bb5d14
|
7
|
+
data.tar.gz: fd32fcbaec477e1c5ec38453e487dac801c089137579d5f542f058d00c9d4cd59e528aead9a98644aba558ee138c9173e63be39aff8701da292f1b245abe8068
|
data/.rubocop.yml
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,48 +1,80 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-boletosimples (0.1.
|
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
|
-
|
11
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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.
|
20
|
-
faraday (>= 0.8, <
|
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 (
|
26
|
-
hashie (>= 3.4.6
|
29
|
+
omniauth (2.0.4)
|
30
|
+
hashie (>= 3.4.6)
|
27
31
|
rack (>= 1.6.2, < 3)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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.
|
42
|
-
rspec-mocks (3.
|
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.
|
45
|
-
rspec-support (3.
|
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.
|
92
|
+
2.2.15
|
@@ -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
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
37
|
-
|
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 '
|
41
|
-
|
42
|
-
subject.
|
43
|
-
expect(subject.
|
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
|
-
|
48
|
-
|
49
|
-
|
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.
|
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:
|
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.
|
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:
|