omniauth-orcid 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/orcid/version.rb +1 -1
- data/lib/omniauth/strategies/orcid.rb +8 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2de75de45baf1b335765369cd1b064583b61402b
|
4
|
+
data.tar.gz: 4c8da80aa0fa68d5313ca41c281e50df641f2483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba2ff0b986734c45b28a79cb2b7ba531c119c392937ba13749e381551116a98c0b8da2687b26b8c229fcf4e43e2d737bc2911c80259617a38e0ec77e342d9ec
|
7
|
+
data.tar.gz: f81b4bbc001f5be28b61e88a24d27b46a62fa460ce90b863d19cd87e007b4e73c8ff9ef2f6735234ba727646f268a0d1c945bc3cff90620f06b575177fef657c
|
@@ -123,23 +123,21 @@ module OmniAuth
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def request_info
|
126
|
-
@request_info
|
126
|
+
@request_info ||= client.request(:get, "#{api_base_url}/#{uid}/person", headers: { accept: 'application/json' }).parsed || {}
|
127
127
|
end
|
128
128
|
|
129
|
+
# retrieve all verified email addresses and include visibility (LIMITED vs. PUBLIC)
|
130
|
+
# and whether this is the primary email address
|
131
|
+
# all other information will in almost all cases be PUBLIC
|
129
132
|
def raw_info
|
130
|
-
|
131
|
-
|
132
|
-
# all other information will in almost all cases be PUBLIC
|
133
|
-
emails = request_info.dig('emails', 'email')
|
134
|
-
.select { |e| e.fetch('verified') }
|
135
|
-
.map { |e| e.select { |k, | %w(email visibility primary).include? k } }
|
136
|
-
|
137
|
-
{ first_name: request_info.dig('name', 'given-names', 'value'),
|
133
|
+
@raw_info ||= {
|
134
|
+
first_name: request_info.dig('name', 'given-names', 'value'),
|
138
135
|
last_name: request_info.dig('name', 'family-name', 'value'),
|
139
136
|
other_names: request_info.dig('other-names', 'other-name').map { |o| o.fetch('content') },
|
140
137
|
description: request_info.dig('biography', 'content'),
|
141
138
|
location: request_info.dig('addresses', 'address').map { |a| a.dig('country', 'value') }.first,
|
142
|
-
email:
|
139
|
+
email: request_info.dig('emails', 'email')
|
140
|
+
.select { |e| e.fetch('verified') }.find { |e| e.fetch('primary') }.to_h.fetch('email', nil),
|
143
141
|
urls: request_info.dig('researcher-urls', 'researcher-url').map do |r|
|
144
142
|
{ r.fetch("url-name", nil) => r.dig('url', 'value') }
|
145
143
|
end,
|