omniauth-parallelmarkets 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth-parallelmarkets/version.rb +1 -1
- data/lib/omniauth/strategies/parallelmarkets.rb +34 -23
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 116a4e6f6b528976b72de3ea0fe9b1fbdb49789abf02fe1ec140596554cedbb9
|
4
|
+
data.tar.gz: a609f558e13b46498bbe870c94873846a13a33a012700d78c261c76826995aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd138b8aab041a68b18601f66602b5b5753f5f7b820c1def738a024da32471ab72d81711a18ce53d64e4bc421e52d8d1e2d5e4167d52071551f4463d08aa3bb1
|
7
|
+
data.tar.gz: 5487cb23b4ba7b1e4213634ac645b3525f894dfe4e693c7cb9414448d892a6cf400d5f9968db5c48c7b435723635b2691b49ee0347db7110c56694d38094ebba
|
@@ -13,29 +13,22 @@ module OmniAuth
|
|
13
13
|
|
14
14
|
uid { raw_info['id'] }
|
15
15
|
|
16
|
-
info
|
17
|
-
{
|
18
|
-
name: profile['name'] || "#{profile['first_name']} #{profile['last_name']}",
|
19
|
-
first_name: profile['first_name'],
|
20
|
-
last_name: profile['last_name'],
|
21
|
-
email: profile['email']
|
22
|
-
}
|
23
|
-
end
|
16
|
+
info { to_contact_details(profile) }
|
24
17
|
|
25
18
|
extra do
|
26
19
|
{
|
27
|
-
|
28
|
-
|
20
|
+
authorize_scopes: authorize_scopes,
|
21
|
+
# from /api/v1/me
|
29
22
|
business_type: profile['business_type'],
|
30
|
-
primary_contact: profile['primary_contact']
|
31
|
-
|
32
|
-
first_name: profile['primary_contact']['first_name'],
|
33
|
-
last_name: profile['primary_contact']['last_name'],
|
34
|
-
email: profile['primary_contact']['email']
|
35
|
-
},
|
23
|
+
primary_contact: to_contact_details(profile['primary_contact']),
|
24
|
+
raw_info: raw_info,
|
36
25
|
type: raw_info['type'],
|
37
26
|
user_id: raw_info['user_id'],
|
38
|
-
|
27
|
+
user_profile: to_contact_details(user_profile),
|
28
|
+
user_providing_for: raw_info['user_providing_for'],
|
29
|
+
# from /api/v1/accreditations
|
30
|
+
accreditations: accreditations,
|
31
|
+
indicated_unaccredited: raw_accreditations['indicated_unaccredited']
|
39
32
|
}
|
40
33
|
end
|
41
34
|
|
@@ -52,24 +45,42 @@ module OmniAuth
|
|
52
45
|
options[:redirect_uri] || (full_host + script_name + callback_path)
|
53
46
|
end
|
54
47
|
|
48
|
+
def scope?(single_scope)
|
49
|
+
authorize_scopes.include?(single_scope.to_s)
|
50
|
+
end
|
51
|
+
|
52
|
+
# if given ?scope query parameter, use that. otherwise, use server-side provider configuration
|
53
|
+
def authorize_scopes
|
54
|
+
@authorize_scopes ||= (env['omniauth.params']['scope'] || authorize_params['scope']).split(' ')
|
55
|
+
end
|
56
|
+
|
55
57
|
def raw_info
|
56
|
-
@raw_info ||= access_token.get('/v1/me').parsed
|
58
|
+
@raw_info ||= scope?(:profile) ? access_token.get('/v1/me').parsed : {}
|
57
59
|
end
|
58
60
|
|
59
61
|
def profile
|
60
62
|
@profile ||= raw_info.fetch('profile', {})
|
61
63
|
end
|
62
64
|
|
63
|
-
def
|
64
|
-
@
|
65
|
+
def user_profile
|
66
|
+
@user_profile ||= raw_info.fetch('user_profile', {})
|
65
67
|
end
|
66
68
|
|
67
|
-
def
|
68
|
-
raw_accreditations
|
69
|
+
def raw_accreditations
|
70
|
+
@raw_accreditations ||= scope?(:accreditation_status) ? access_token.get('/v1/accreditations').parsed : {}
|
69
71
|
end
|
70
72
|
|
71
73
|
def accreditations
|
72
|
-
raw_accreditations
|
74
|
+
@accreditations ||= raw_accreditations.fetch('accreditations', [])
|
75
|
+
end
|
76
|
+
|
77
|
+
def to_contact_details(contact)
|
78
|
+
(contact.nil? || contact.empty?) ? {} : {
|
79
|
+
name: contact['name'] || "#{contact['first_name']} #{contact['last_name']}",
|
80
|
+
first_name: contact['first_name'],
|
81
|
+
last_name: contact['last_name'],
|
82
|
+
email: contact['email']
|
83
|
+
}
|
73
84
|
end
|
74
85
|
end
|
75
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-parallelmarkets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Muller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.2
|
92
|
+
rubygems_version: 3.1.2
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Parallel Markets OAuth strategy for OmniAuth
|