trusty 0.2.5 → 0.2.6

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: da402961c1200966ab167b95e1bc978534018ec5
4
- data.tar.gz: bb8dfa60b4fae41ca354fb975ff7d1e7ba409c88
3
+ metadata.gz: 57e1e69812a9eff269cfb035d3581c7c54b4aa85
4
+ data.tar.gz: 8e0a6b6d11ef2f74565ecd417ec5163353775bd6
5
5
  SHA512:
6
- metadata.gz: 554ac7e31363efa90cea9a2eef425036146d8ac35bf7c2ee1d6d574168ae58f70a8cc00051b8094deee5d3aa8603ac3973bd08df0887d13f7a109fa1abac581c
7
- data.tar.gz: 7e7795d47f04e934856e64f683764264c05ff68ae21d71c3cf582e25f00817f110b50d8479dd29a92135f433b946ca0348a75f2eac197e531de1d6ae860e366b
6
+ metadata.gz: fbd241c9a26ec21105da1a400da7ae367750bffc81aba9f82f18da4a34de22d0e7b57dbf89ca1eb101dacab14effeef1294973f385543852cdad81fe393315de
7
+ data.tar.gz: 8e3f8dfc7b0d7661d489a994ff3186843fb11d204934a8852558202f69b5e96652e27f5cc38cb3fe2489691f14aa5d6cbe935bfa241c48253fa757d5eee5d1d0
@@ -122,26 +122,29 @@ module Trusty
122
122
 
123
123
  def attributes(*filter_attribute_names)
124
124
  unless @attributes
125
- info = provider_attributes.fetch('info', {})
126
- credentials = provider_attributes['credentials']
125
+ raw_info = provider_attributes['extra']['raw_info'] || provider_attributes['extra']
126
+ info = provider_attributes.fetch('info', raw_info)
127
+ credentials = provider_attributes['credentials']
127
128
 
128
- name = clean(info['name']) { [info['first_name'], info['last_name']].join(" ").strip }
129
- first_name = clean(info['first_name']) { name.split(/\s+/, 2).first }
130
- last_name = clean(info['last_name']) { name.split(/\s+/, 2).last }
129
+ name = clean(info['name']) { [info['first_name'], info['last_name']].join(" ").strip }
130
+ first_name = clean(info['first_name']) { name.split(/\s+/, 2).first }
131
+ last_name = clean(info['last_name']) { name.split(/\s+/, 2).last }
132
+ urls = info.fetch('urls', {})
131
133
 
132
134
  @attributes = {
133
135
  :provider => provider_name,
134
136
  :uid => clean(provider_attributes['uid']),
135
137
  :name => name,
138
+ :company => info['company'] || raw_info['company'],
136
139
  :email => clean(info['email'], :downcase, :strip),
137
- :verified => provider_attributes['extra']['raw_info']['verified_email'] == true,
140
+ :verified => !!(raw_info['verified_email'] || raw_info['verified']),
138
141
  :username => clean(info['nickname']),
139
142
  :first_name => first_name,
140
143
  :middle_name => clean(info['middle_name']),
141
144
  :last_name => last_name,
142
- :phone => clean(info['phone']),
145
+ :phone => clean(info['phone'] || raw_info['sms_number']),
143
146
  :image_url => info['image'],
144
- :profile_url => info.fetch('urls', {})['public_profile'],
147
+ :profile_url => urls['public_profile'] || urls['GitHub'] || raw_info['blog'],
145
148
  :token_type => clean(credentials['token_type']),
146
149
  :token => clean(credentials['token']),
147
150
  :secret => clean(credentials['secret']),
@@ -150,7 +153,7 @@ module Trusty
150
153
  :expires_at => (Time.at(credentials['expires_at']) rescue nil),
151
154
  :raw_info => provider_attributes['extra'].except('access_token').as_json,
152
155
  # extra
153
- :location => info['location'],
156
+ :location => info['location'] || raw_info['location'],
154
157
  :time_zone => info['time_zone'] || Time.zone.name,
155
158
  :locale => info['locale'] || I18n.locale
156
159
  }.with_indifferent_access
@@ -1,3 +1,3 @@
1
1
  module Trusty
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Van Horn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2017-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.6.8
212
+ rubygems_version: 2.6.12
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Trusty allows you to manage environment variables and other common configuration