omniauth-parallelmarkets 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/README.md +5 -2
- data/lib/omniauth-parallelmarkets/version.rb +1 -1
- data/lib/omniauth/strategies/parallelmarkets.rb +11 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6b382d351a845a0e8b4edb867ca7b49fee4ea70bff43092ff4996766900478
|
4
|
+
data.tar.gz: 27eb701bbeffaf81d32ed6090f73dd79b181fd393b984b80a9a51e5f477b9331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab7b0e609c87ac035242a887879d8a150039ab6e58d55fea0ceec816e3736a6d40e26679d3c239e6eb7e11b3a9040a4f2fd6f7ad110b6d4b2899e74581b6688b
|
7
|
+
data.tar.gz: 2c70c949e15ad49b3e37004c4c97f34c7123e929a1fdce5b6d7e9613628e8c122d5220b52928fbcc395a3b0b1dc892c128dc3584699697b3d331c29f1739385a
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
This gem contains the [Parallel Markets](https://parallelmarkets.com) strategy for OmniAuth.
|
7
7
|
|
8
|
-
ParallelMarkets uses the OAuth2 flow, you can read about at [
|
8
|
+
ParallelMarkets uses the OAuth2 flow, you can read about at [developer.parallelmarkets.com/api](https://developer.parallelmarkets.com).
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -28,6 +28,7 @@ Or install it yourself as:
|
|
28
28
|
You'll need to register your application with [Parallel Markets Support](mailto:help@parallelmarkets.com) and get `client_id` & `client_secret`.
|
29
29
|
|
30
30
|
Here's an example for adding the middleware to a Rails app in config/initializers/omniauth.rb:
|
31
|
+
|
31
32
|
```ruby
|
32
33
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
33
34
|
provider :parallelmarkets, ENV["CLIENT_ID"], ENV["CLIENT_SECRET"]
|
@@ -40,7 +41,7 @@ See the documentation for [OmniAuth](https://github.com/omniauth/omniauth) for m
|
|
40
41
|
```ruby
|
41
42
|
{
|
42
43
|
"provider"=>"parallelmarkets",
|
43
|
-
"uid"=>"
|
44
|
+
"uid"=>"VXNlcjox",
|
44
45
|
"info"=> {
|
45
46
|
"name"=>"Snake Plissken",
|
46
47
|
"email"=>"snake@example.com",
|
@@ -54,6 +55,8 @@ See the documentation for [OmniAuth](https://github.com/omniauth/omniauth) for m
|
|
54
55
|
"expires"=>true
|
55
56
|
},
|
56
57
|
"extra"=> {
|
58
|
+
"type"=>"individual",
|
59
|
+
"user_id"=>"VXNlcjox",
|
57
60
|
"accreditations"=>[
|
58
61
|
{
|
59
62
|
"id"=>321,
|
@@ -10,21 +10,23 @@ module OmniAuth
|
|
10
10
|
authorize_url: '/v1/oauth/authorize',
|
11
11
|
token_url: '/v1/oauth/token'
|
12
12
|
|
13
|
-
uid { raw_info['
|
13
|
+
uid { raw_info['id'] }
|
14
14
|
|
15
15
|
info do
|
16
16
|
{
|
17
|
-
name:
|
18
|
-
first_name:
|
19
|
-
last_name:
|
20
|
-
email:
|
17
|
+
name: profile['name'] || "#{profile['first_name']} #{profile['last_name']}",
|
18
|
+
first_name: profile['first_name'],
|
19
|
+
last_name: profile['last_name'],
|
20
|
+
email: profile['email']
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
24
24
|
extra do
|
25
25
|
{
|
26
26
|
accreditations: raw_info['accreditations'],
|
27
|
+
business_type: profile['business_type'],
|
27
28
|
type: raw_info['type'],
|
29
|
+
user_id: raw_info['user_id'],
|
28
30
|
raw_info: raw_info
|
29
31
|
}
|
30
32
|
end
|
@@ -40,6 +42,10 @@ module OmniAuth
|
|
40
42
|
def raw_info
|
41
43
|
@raw_info ||= access_token.get('/v1/me').parsed
|
42
44
|
end
|
45
|
+
|
46
|
+
def profile
|
47
|
+
@profile ||= raw_info.fetch('profile', {})
|
48
|
+
end
|
43
49
|
end
|
44
50
|
end
|
45
51
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Muller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|