omniauth-mapsme 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60878dea9c9ac5271ba296199ee84492569496ea
|
4
|
+
data.tar.gz: 95f466ca93b9e2ec17143434a4d178123c63198c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c5c31b1ada72fd7f3385733351e541d2b262cb08748cd5b08aee98a51060437c60890b682c475a85c3d0c6dab431d8b36231b120de9eba78fba937f811c188
|
7
|
+
data.tar.gz: 9c826898ff1efa97881230c59f90e987ba80c1a9f232fed680d72140eb74bd63c0e230d3b9afa71e1c4912d1de7e5c6448f7def3e77d961735bc1067dedb57bb
|
@@ -2,12 +2,30 @@ module OmniAuth
|
|
2
2
|
module Strategies
|
3
3
|
module MapsMeBase
|
4
4
|
MAPSME_BASE = 'https://passport.maps.me'
|
5
|
+
MAPSME_DEFAULT_SCOPE = 'read'
|
6
|
+
MAPSME_USER_DETAILS = '/user_details/'
|
5
7
|
|
6
8
|
MAPSME_CLIENT_OPTIONS = {
|
7
9
|
:site => MAPSME_BASE,
|
8
10
|
:authorize_url => "#{MAPSME_BASE}/oauth/authorize",
|
9
|
-
:token_url => "#{MAPSME_BASE}/oauth/token"
|
11
|
+
:token_url => "#{MAPSME_BASE}/oauth/token/"
|
10
12
|
}
|
13
|
+
|
14
|
+
def extract_name(raw_info)
|
15
|
+
first_name = raw_info['first_name']
|
16
|
+
last_name = raw_info['last_name']
|
17
|
+
username = raw_info['username']
|
18
|
+
|
19
|
+
if first_name
|
20
|
+
if last_name
|
21
|
+
"#{first_name} #{last_name}"
|
22
|
+
else
|
23
|
+
first_name
|
24
|
+
end
|
25
|
+
else
|
26
|
+
username
|
27
|
+
end
|
28
|
+
end
|
11
29
|
end
|
12
30
|
end
|
13
31
|
end
|
@@ -24,12 +24,12 @@ module OmniAuth
|
|
24
24
|
|
25
25
|
attr_accessor :access_token
|
26
26
|
|
27
|
-
uid { raw_info['
|
27
|
+
uid { raw_info['username'] }
|
28
28
|
|
29
29
|
info do
|
30
30
|
prune!({
|
31
31
|
'email' => raw_info['email'],
|
32
|
-
'name' => raw_info
|
32
|
+
'name' => extract_name(raw_info)
|
33
33
|
})
|
34
34
|
end
|
35
35
|
|
@@ -47,12 +47,12 @@ module OmniAuth
|
|
47
47
|
|
48
48
|
def authorize_params
|
49
49
|
super.tap do |params|
|
50
|
-
params[:scope] =
|
50
|
+
params[:scope] = MAPSME_DEFAULT_SCOPE
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def raw_info
|
55
|
-
@raw_info ||= access_token.get(
|
55
|
+
@raw_info ||= access_token.get(MAPSME_USER_DETAILS).parsed || {}
|
56
56
|
end
|
57
57
|
|
58
58
|
def info_options
|
@@ -10,12 +10,12 @@ module OmniAuth
|
|
10
10
|
|
11
11
|
option :client_options, MAPSME_CLIENT_OPTIONS
|
12
12
|
|
13
|
-
uid { raw_info['
|
13
|
+
uid { raw_info['username'] }
|
14
14
|
|
15
15
|
info do
|
16
16
|
{
|
17
17
|
'email' => raw_info['email'],
|
18
|
-
'name' => raw_info
|
18
|
+
'name' => extract_name(raw_info)
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
@@ -25,12 +25,12 @@ module OmniAuth
|
|
25
25
|
|
26
26
|
def authorize_params
|
27
27
|
super.tap do |params|
|
28
|
-
params[:scope] =
|
28
|
+
params[:scope] = MAPSME_DEFAULT_SCOPE
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
def raw_info
|
33
|
-
@raw_info ||= access_token.get(
|
33
|
+
@raw_info ||= access_token.get(MAPSME_USER_DETAILS).parsed || {}
|
34
34
|
end
|
35
35
|
|
36
36
|
# Fix omniauth-oauth2 issue https://github.com/intridea/omniauth-oauth2/issues/76
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-mapsme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Zverev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|