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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c433403ee6a5a8336bfd361259dfefa176138e54
4
- data.tar.gz: 2e27a8831978bb6e4e404c20ee4067d75b13a35d
3
+ metadata.gz: 2de75de45baf1b335765369cd1b064583b61402b
4
+ data.tar.gz: 4c8da80aa0fa68d5313ca41c281e50df641f2483
5
5
  SHA512:
6
- metadata.gz: f42e6ed8d7ae1fa6cee3b35706c98e6271f30556729f8868132d3a534ab9370177e2f0d5c987d0ad7fdcc549b6cd1718732ac2ddf5ddc64965993b6452ba27f4
7
- data.tar.gz: fd90e3f753f1fe382d92b5d7788615faf4645714a8d4cc8d1a9f9f423e8faae875c4de55d37aa7080d7e5a5e97e2d0857a4b321e68134b99cca5310471c6f9e0
6
+ metadata.gz: 7ba2ff0b986734c45b28a79cb2b7ba531c119c392937ba13749e381551116a98c0b8da2687b26b8c229fcf4e43e2d737bc2911c80259617a38e0ec77e342d9ec
7
+ data.tar.gz: f81b4bbc001f5be28b61e88a24d27b46a62fa460ce90b863d19cd87e007b4e73c8ff9ef2f6735234ba727646f268a0d1c945bc3cff90620f06b575177fef657c
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Orcid
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
5
5
  end
@@ -123,23 +123,21 @@ module OmniAuth
123
123
  end
124
124
 
125
125
  def request_info
126
- @request_info || client.request(:get, "#{api_base_url}/#{uid}/person", headers: { accept: 'application/json' }).parsed || {}
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
- # retrieve all verified email addresses and include visibility (LIMITED vs. PUBLIC)
131
- # and whether this is the primary email address
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: emails.find { |e| e.fetch('primary') }.to_h.fetch('email', nil),
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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-orcid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gudmundur A. Thorisson