omniauth-square-oauth2 0.0.3 → 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 +4 -4
- data/Gemfile.lock +23 -17
- data/lib/omniauth/strategies/square.rb +15 -21
- data/lib/omniauth-square/version.rb +1 -1
- data/omniauth-square-oauth2.gemspec +1 -1
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e3ce6302878b604dad6faa187f8c010076d71e20f3af41511da76f145475590
|
4
|
+
data.tar.gz: de9b2e8a453015ab750becdb0c8bc82adc3f1c469fc6bfaf25bbe0ab180a23cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f258bdfe36130dc3b56d87c4fd952e71a1f72ca40c3573e520e7ba6ba808e54cfee9ece431f347a99a3f4c9708bf88efe35c3cf68b5f3bf42311726cefe77545
|
7
|
+
data.tar.gz: a50c2e2d11fbeae5c8d3b553e60eb30734ff38973e12cbb1af12c618889f33091700dc00a96636ba11dc9cade30e388ac09faf38c728858c796bc6f7e45a03b7
|
data/Gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
omniauth-square-oauth2 (0.0.2)
|
5
|
-
omniauth-oauth2 (>= 1.
|
5
|
+
omniauth-oauth2 (>= 1.7.3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
@@ -13,37 +13,41 @@ GEM
|
|
13
13
|
crack (0.4.4)
|
14
14
|
diff-lcs (1.4.4)
|
15
15
|
docile (1.3.2)
|
16
|
-
faraday (
|
17
|
-
|
16
|
+
faraday (2.5.2)
|
17
|
+
faraday-net_http (>= 2.0, < 3.1)
|
18
|
+
ruby2_keywords (>= 0.0.4)
|
19
|
+
faraday-net_http (3.0.0)
|
18
20
|
hashdiff (1.0.1)
|
19
|
-
hashie (
|
20
|
-
jwt (2.
|
21
|
-
multi_json (1.15.0)
|
21
|
+
hashie (5.0.0)
|
22
|
+
jwt (2.5.0)
|
22
23
|
multi_xml (0.6.0)
|
23
|
-
|
24
|
-
|
25
|
-
faraday (>= 0.8, < 2.0)
|
24
|
+
oauth2 (2.0.7)
|
25
|
+
faraday (>= 0.17.3, < 3.0)
|
26
26
|
jwt (>= 1.0, < 3.0)
|
27
|
-
multi_json (~> 1.3)
|
28
27
|
multi_xml (~> 0.5)
|
29
28
|
rack (>= 1.2, < 3)
|
30
|
-
|
29
|
+
rash_alt (>= 0.4, < 1)
|
30
|
+
version_gem (~> 1.1)
|
31
|
+
omniauth (2.1.0)
|
31
32
|
hashie (>= 3.4.6)
|
32
|
-
rack (>=
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
omniauth (~> 1.2)
|
33
|
+
rack (>= 2.2.3)
|
34
|
+
rack-protection
|
35
|
+
omniauth-oauth2 (1.8.0)
|
36
|
+
oauth2 (>= 1.4, < 3)
|
37
|
+
omniauth (~> 2.0)
|
38
38
|
parallel (1.19.2)
|
39
39
|
parser (2.7.2.0)
|
40
40
|
ast (~> 2.4.1)
|
41
41
|
public_suffix (4.0.6)
|
42
42
|
rack (2.2.3)
|
43
|
+
rack-protection (2.2.2)
|
44
|
+
rack
|
43
45
|
rack-test (1.1.0)
|
44
46
|
rack (>= 1.0, < 3)
|
45
47
|
rainbow (3.0.0)
|
46
48
|
rake (10.5.0)
|
49
|
+
rash_alt (0.4.12)
|
50
|
+
hashie (>= 3.4)
|
47
51
|
regexp_parser (1.8.1)
|
48
52
|
rexml (3.2.4)
|
49
53
|
rspec (2.99.0)
|
@@ -66,11 +70,13 @@ GEM
|
|
66
70
|
rubocop-ast (0.7.1)
|
67
71
|
parser (>= 2.7.1.5)
|
68
72
|
ruby-progressbar (1.10.1)
|
73
|
+
ruby2_keywords (0.0.5)
|
69
74
|
simplecov (0.19.0)
|
70
75
|
docile (~> 1.1)
|
71
76
|
simplecov-html (~> 0.11)
|
72
77
|
simplecov-html (0.12.3)
|
73
78
|
unicode-display_width (1.7.0)
|
79
|
+
version_gem (1.1.0)
|
74
80
|
webmock (3.9.1)
|
75
81
|
addressable (>= 2.3.6)
|
76
82
|
crack (>= 0.3.2)
|
@@ -7,10 +7,9 @@ module OmniAuth
|
|
7
7
|
class Square < OmniAuth::Strategies::OAuth2
|
8
8
|
option :name, 'square'
|
9
9
|
option :client_options, {
|
10
|
-
site: 'https://squareup.com
|
11
|
-
|
12
|
-
|
13
|
-
token_url: '/oauth2/token'
|
10
|
+
site: 'https://connect.squareup.com',
|
11
|
+
authorize_url: 'oauth2/authorize',
|
12
|
+
token_url: 'oauth2/token'
|
14
13
|
}
|
15
14
|
|
16
15
|
uid { raw_info['merchant'][0]['id'] }
|
@@ -18,7 +17,8 @@ module OmniAuth
|
|
18
17
|
info do
|
19
18
|
prune!(
|
20
19
|
name: raw_info['merchant'][0]['business_name'],
|
21
|
-
country: raw_info['merchant'][0]['country']
|
20
|
+
country: raw_info['merchant'][0]['country'],
|
21
|
+
email: raw_info['email']
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
@@ -26,28 +26,22 @@ module OmniAuth
|
|
26
26
|
{ raw_info: raw_info }
|
27
27
|
end
|
28
28
|
|
29
|
+
def callback_url
|
30
|
+
full_host + script_name + callback_path
|
31
|
+
end
|
32
|
+
|
29
33
|
def build_access_token
|
30
|
-
|
31
|
-
|
32
|
-
auth_params = {
|
33
|
-
redirect_uri: callback_url,
|
34
|
-
client_id: options.client_id,
|
35
|
-
client_secret: options.client_secret,
|
36
|
-
grant_type: 'authorization_code'
|
37
|
-
}.merge(token_params.to_hash(symbolize_keys: true))
|
38
|
-
connect_client.auth_code.get_token(
|
39
|
-
request.params['code'],
|
40
|
-
auth_params.merge(
|
41
|
-
token_params.to_hash(symbolize_keys: true)
|
42
|
-
),
|
43
|
-
deep_symbolize(options.auth_token_params)
|
44
|
-
)
|
34
|
+
options.token_params.merge!({client_id: options.client_id, client_secret: options.client_secret})
|
35
|
+
super
|
45
36
|
end
|
46
37
|
|
47
|
-
|
38
|
+
private
|
48
39
|
|
49
40
|
def raw_info
|
50
41
|
@raw_info ||= access_token.get('/v2/merchants').parsed
|
42
|
+
main_location_id = @raw_info['merchant'][0]['main_location_id']
|
43
|
+
location_data = access_token.get("/v2/locations/#{main_location_id}").parsed
|
44
|
+
@raw_info.merge!({email: location_data['location']['business_email']})
|
51
45
|
end
|
52
46
|
|
53
47
|
def prune!(hash)
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
|
-
s.add_runtime_dependency 'omniauth-oauth2', '>= 1.
|
21
|
+
s.add_runtime_dependency 'omniauth-oauth2', '>= 1.7.3'
|
22
22
|
s.add_development_dependency 'rack-test'
|
23
23
|
s.add_development_dependency 'rake', '~> 10.0'
|
24
24
|
s.add_development_dependency 'rspec', '~> 2.7'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-square-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.3.0
|
19
|
+
version: 1.7.3
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.3.0
|
26
|
+
version: 1.7.3
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rack-test
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|