omniauth 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of omniauth might be problematic. Click here for more details.
- data/.gitignore +49 -29
- data/.travis.yml +2 -0
- data/Gemfile +4 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/{README.markdown → README.md} +11 -5
- data/Rakefile +2 -1
- data/lib/omniauth/version.rb +1 -1
- data/oa-basic/Gemfile +7 -0
- data/oa-basic/lib/omniauth/version.rb +1 -1
- data/oa-basic/oa-basic.gemspec +1 -2
- data/oa-core/Gemfile +3 -0
- data/oa-core/lib/omniauth/form.rb +5 -3
- data/oa-core/lib/omniauth/strategy.rb +5 -5
- data/oa-core/lib/omniauth/version.rb +1 -1
- data/oa-core/oa-core.gemspec +1 -1
- data/oa-core/spec/omniauth/strategy_spec.rb +5 -0
- data/oa-enterprise/Gemfile +7 -0
- data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +13 -6
- data/oa-enterprise/lib/omniauth/version.rb +1 -1
- data/oa-enterprise/oa-enterprise.gemspec +1 -2
- data/oa-enterprise/spec/omniauth/strategies/ldap_spec.rb +41 -0
- data/oa-more/Gemfile +7 -0
- data/oa-more/lib/omniauth/more.rb +2 -0
- data/oa-more/lib/omniauth/strategies/draugiem.rb +104 -0
- data/oa-more/lib/omniauth/strategies/ign.rb +93 -0
- data/oa-more/lib/omniauth/strategies/yupoo.rb +8 -8
- data/oa-more/lib/omniauth/version.rb +1 -1
- data/oa-more/oa-more.gemspec +1 -2
- data/oa-more/spec/omniauth/strategies/draugiem_spec.rb +51 -0
- data/oa-more/spec/spec_helper.rb +1 -1
- data/oa-oauth/Gemfile +7 -0
- data/oa-oauth/lib/omniauth/oauth.rb +3 -0
- data/oa-oauth/lib/omniauth/strategies/facebook.rb +1 -1
- data/oa-oauth/lib/omniauth/strategies/google.rb +2 -2
- data/oa-oauth/lib/omniauth/strategies/gowalla.rb +9 -1
- data/oa-oauth/lib/omniauth/strategies/linked_in.rb +17 -16
- data/oa-oauth/lib/omniauth/strategies/mailru.rb +107 -0
- data/oa-oauth/lib/omniauth/strategies/oauth.rb +2 -4
- data/oa-oauth/lib/omniauth/strategies/oauth2.rb +5 -12
- data/oa-oauth/lib/omniauth/strategies/plurk.rb +58 -0
- data/oa-oauth/lib/omniauth/strategies/taobao.rb +79 -0
- data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +7 -4
- data/oa-oauth/lib/omniauth/version.rb +1 -1
- data/oa-oauth/oa-oauth.gemspec +1 -2
- data/oa-oauth/spec/omniauth/strategies/mailru_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/plurk_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/taobao_spec.rb +5 -0
- data/oa-openid/Gemfile +7 -0
- data/oa-openid/lib/omniauth/openid.rb +1 -0
- data/oa-openid/lib/omniauth/strategies/steam.rb +55 -0
- data/oa-openid/lib/omniauth/version.rb +1 -1
- data/oa-openid/oa-openid.gemspec +1 -2
- data/omniauth.gemspec +8 -8
- data/tasks/all.rb +1 -1
- metadata +34 -18
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'omniauth/core'
|
2
|
+
require 'digest/md5'
|
3
|
+
require 'rest-client'
|
4
|
+
require 'multi_json'
|
5
|
+
|
6
|
+
module OmniAuth
|
7
|
+
module Strategies
|
8
|
+
#
|
9
|
+
# Authenticate to draugiem.lv and frype.com and others.
|
10
|
+
#
|
11
|
+
# @example Basic Rails Usage
|
12
|
+
#
|
13
|
+
# Add this to config/initializers/omniauth.rb
|
14
|
+
#
|
15
|
+
# Rails.application.config.middleware.use OmniAuth::Builder do
|
16
|
+
# provider :draugiem, 'App id', 'API Key'
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# @example Basic Rack example
|
20
|
+
#
|
21
|
+
# use Rack::Session::Cookie
|
22
|
+
# use OmniAuth::Strategies::Draugiem, 'App id', 'API Key'
|
23
|
+
#
|
24
|
+
class Draugiem
|
25
|
+
include OmniAuth::Strategy
|
26
|
+
attr_accessor :app_id, :api_key
|
27
|
+
|
28
|
+
def initialize(app, app_id, api_key)
|
29
|
+
super(app, :draugiem)
|
30
|
+
@app_id = app_id
|
31
|
+
@api_key = api_key
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def request_phase
|
37
|
+
params = {
|
38
|
+
:app => @app_id,
|
39
|
+
:redirect => callback_url,
|
40
|
+
:hash => Digest::MD5.hexdigest("#{@api_key}#{callback_url}")
|
41
|
+
}
|
42
|
+
query_string = params.collect{ |key,value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
|
43
|
+
redirect "http://api.draugiem.lv/authorize/?#{query_string}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def callback_phase
|
47
|
+
if request.params['dr_auth_status'] == 'ok' && request.params['dr_auth_code']
|
48
|
+
response = RestClient.get('http://api.draugiem.lv/json/', { :params => draugiem_authorize_params(request.params['dr_auth_code']) })
|
49
|
+
auth = MultiJson.decode(response.to_s)
|
50
|
+
unless auth['error']
|
51
|
+
@auth_data = auth
|
52
|
+
super
|
53
|
+
else
|
54
|
+
fail!(auth['error']['code'].to_s,auth["error"]["description"].to_s)
|
55
|
+
end
|
56
|
+
else
|
57
|
+
fail!(:invalid_request)
|
58
|
+
end
|
59
|
+
rescue Exception => e
|
60
|
+
fail!(:invalid_response, e)
|
61
|
+
end
|
62
|
+
|
63
|
+
def auth_hash
|
64
|
+
OmniAuth::Utils.deep_merge(super, {
|
65
|
+
'uid' => @auth_data['uid'],
|
66
|
+
'user_info' => get_user_info,
|
67
|
+
'credentials' => {
|
68
|
+
'apikey' => @auth_data['apikey']
|
69
|
+
},
|
70
|
+
'extra' => { 'user_hash' => @auth_data }
|
71
|
+
})
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def get_user_info
|
77
|
+
if @auth_data['users'] && @auth_data['users'][@auth_data['uid']]
|
78
|
+
user = @auth_data['users'][@auth_data['uid']]
|
79
|
+
{
|
80
|
+
'name' => "#{user['name']} #{user['surname']}",
|
81
|
+
'nickname' => user['nick'],
|
82
|
+
'first_name' => user['name'],
|
83
|
+
'last_name' => user['surname'],
|
84
|
+
'location' => user['place'],
|
85
|
+
'age' => user['age'] =~ /^0-9$/ ? user['age'] : nil,
|
86
|
+
'adult' => user['adult'] == '1' ? true : false,
|
87
|
+
'image' => user['img'],
|
88
|
+
'sex' => user['sex']
|
89
|
+
}
|
90
|
+
else
|
91
|
+
{}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def draugiem_authorize_params code
|
96
|
+
{
|
97
|
+
:action => 'authorize',
|
98
|
+
:app => @api_key,
|
99
|
+
:code => code
|
100
|
+
}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'omniauth/core'
|
2
|
+
require 'openssl'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Ign
|
7
|
+
include OmniAuth::Strategy
|
8
|
+
IDENTIFIER_URL_PARAMETER = ""
|
9
|
+
|
10
|
+
class CallbackError < StandardError
|
11
|
+
attr_accessor :error, :error_reason
|
12
|
+
def initialize(error, error_reason)
|
13
|
+
self.error = error
|
14
|
+
self.error_reason = error_reason
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(app, api_key, hostname=nil, options = {})
|
19
|
+
options[:name] ||= "ign"
|
20
|
+
super(app, :ign)
|
21
|
+
@api_key = api_key
|
22
|
+
@hostname = hostname
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def request_phase
|
28
|
+
OmniAuth::Form.build(:title => 'IGN Authentication', :header_info=>js) do
|
29
|
+
label_field('Identifying you with the IGN server', IDENTIFIER_URL_PARAMETER)
|
30
|
+
end.to_response
|
31
|
+
end
|
32
|
+
|
33
|
+
def callback_phase
|
34
|
+
signature = OpenSSL::HMAC.hexdigest('sha1', @api_key, ("#{request.params["username"]}::#{request.params["timestamp"]}"))
|
35
|
+
|
36
|
+
raise CallbackError.new("Invalid Signature","The supplied and calculated signature did not match, user not approved.") if signature != request.params["signature"]
|
37
|
+
|
38
|
+
super
|
39
|
+
rescue CallbackError => e
|
40
|
+
fail!(:invalid_response, e)
|
41
|
+
end
|
42
|
+
|
43
|
+
def auth_hash
|
44
|
+
OmniAuth::Utils.deep_merge(super, {
|
45
|
+
'uid' => "ign-" + request.params["username"],
|
46
|
+
'credentials' => { 'token' => request.params["signature"] },
|
47
|
+
'user_info' => user_info,
|
48
|
+
'extra' => { 'user_hash' => request.params }
|
49
|
+
})
|
50
|
+
end
|
51
|
+
|
52
|
+
def user_info
|
53
|
+
{
|
54
|
+
'nickname' => request.params["username"],
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def js
|
59
|
+
@js = <<-JS
|
60
|
+
$(document).ready(function() {
|
61
|
+
$.ajax({
|
62
|
+
url: "http://#{@hostname}/users/current.json?callback=z33k",
|
63
|
+
type: "get",
|
64
|
+
dataType:"jsonp",
|
65
|
+
success: function(data) {
|
66
|
+
if(typeof data.error == 'undefined'){
|
67
|
+
// There is a current My IGN user
|
68
|
+
var username = data.my_ign_username;
|
69
|
+
var signature = data.signature;
|
70
|
+
var timestamp = data.timestamp;
|
71
|
+
window.location = "/auth/ign/callback?username=" +username+"&signature="+signature+"×tamp=" + timestamp;
|
72
|
+
}
|
73
|
+
else{
|
74
|
+
nouser();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
});
|
78
|
+
return false;
|
79
|
+
});
|
80
|
+
function nouser() {
|
81
|
+
var url = "http://my.ign.com/login?r="+window.location;
|
82
|
+
top.location = url;
|
83
|
+
window.location = url;
|
84
|
+
}
|
85
|
+
JS
|
86
|
+
"\n<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js' type='text/javascript'></script>" +
|
87
|
+
"\n<script type='text/javascript'>#{@js}</script>" +
|
88
|
+
"\n<style type='text/css'>button {visibility:hidden;}</style>"
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -8,7 +8,7 @@ module OmniAuth
|
|
8
8
|
class Yupoo
|
9
9
|
include OmniAuth::Strategy
|
10
10
|
attr_accessor :api_key, :secret_key, :options
|
11
|
-
|
11
|
+
|
12
12
|
|
13
13
|
class CallbackError < StandardError
|
14
14
|
attr_accessor :error, :error_reason
|
@@ -26,30 +26,30 @@ module OmniAuth
|
|
26
26
|
end
|
27
27
|
|
28
28
|
protected
|
29
|
-
|
29
|
+
|
30
30
|
def request_phase
|
31
31
|
params = { :api_key => api_key, :perms => options[:scope] }
|
32
32
|
params[:api_sig] = yupoo_sign(params)
|
33
33
|
query_string = params.collect{ |key,value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
|
34
34
|
redirect "http://www.yupoo.com/services/auth/?#{query_string}"
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def callback_phase
|
38
38
|
params = { :api_key => api_key, :method => 'yupoo.auth.getToken', :frob => request.params['frob'], :format => 'json', :nojsoncallback => '1' }
|
39
39
|
params[:api_sig] = yupoo_sign(params)
|
40
|
-
|
40
|
+
|
41
41
|
response = RestClient.get('http://www.yupoo.com/api/rest/', { :params => params })
|
42
42
|
auth = MultiJson.decode(response.to_s)
|
43
43
|
raise CallbackError.new(auth['code'],auth['message']) if auth['stat'] == 'fail'
|
44
|
-
|
44
|
+
|
45
45
|
@user = auth['auth']['user']
|
46
46
|
@access_token = auth['auth']['token']['_content']
|
47
|
-
|
47
|
+
|
48
48
|
super
|
49
49
|
rescue CallbackError => e
|
50
50
|
fail!(:invalid_response, e)
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def auth_hash
|
54
54
|
OmniAuth::Utils.deep_merge(super, {
|
55
55
|
'uid' => @user['nsid'],
|
@@ -58,7 +58,7 @@ module OmniAuth
|
|
58
58
|
'extra' => { 'user_hash' => @user }
|
59
59
|
})
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def yupoo_sign(params)
|
63
63
|
Digest::MD5.hexdigest(secret_key + params.sort{|a,b| a[0].to_s <=> b[0].to_s }.flatten.join)
|
64
64
|
end
|
data/oa-more/oa-more.gemspec
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require File.expand_path('../lib/omniauth/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
|
6
5
|
gem.add_runtime_dependency 'multi_json', '~> 1.0.0'
|
7
6
|
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
|
8
7
|
gem.add_runtime_dependency 'rest-client', '~> 1.6.0'
|
@@ -13,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
13
12
|
gem.add_development_dependency 'rspec', '~> 2.5'
|
14
13
|
gem.add_development_dependency 'simplecov', '~> 0.4'
|
15
14
|
gem.add_development_dependency 'webmock', '~> 1.6'
|
16
|
-
gem.add_development_dependency 'yard', '~> 0.
|
15
|
+
gem.add_development_dependency 'yard', '~> 0.7'
|
17
16
|
gem.add_development_dependency 'ZenTest', '~> 4.5'
|
18
17
|
gem.name = 'oa-more'
|
19
18
|
gem.version = OmniAuth::Version::STRING
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'OmniAuth::Strategies::Draugiem', :type => :strategy do
|
4
|
+
|
5
|
+
include OmniAuth::Test::StrategyTestCase
|
6
|
+
|
7
|
+
def strategy
|
8
|
+
[OmniAuth::Strategies::Draugiem, '123', "abc"]
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should initialize with api key and app id' do
|
12
|
+
lambda{OmniAuth::Strategies::Draugiem.new({},'123','abc')}.should_not raise_error
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '/auth/draugiem' do
|
16
|
+
|
17
|
+
it 'should redirect to api.draugiem.lv' do
|
18
|
+
get '/auth/draugiem'
|
19
|
+
last_response.should be_redirect
|
20
|
+
last_response.headers['Location'].should match %r{http://api\.draugiem\.lv/authorize/}
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should gather user data after success authorization' do
|
24
|
+
stub_request(:get, "http://api.draugiem.lv/json/?action=authorize&app=abc&code=123456").
|
25
|
+
to_return(:body => MultiJson.encode({
|
26
|
+
'apikey'=>"123456789",
|
27
|
+
'uid'=>"100",
|
28
|
+
'language'=>"lv",
|
29
|
+
'users'=>{
|
30
|
+
'100'=>{
|
31
|
+
'uid'=>"100",
|
32
|
+
'name'=>"John",
|
33
|
+
'surname'=>"Lenon",
|
34
|
+
'nick'=>"johnybravo",
|
35
|
+
'place'=>"Durbe",
|
36
|
+
'age'=>"false",
|
37
|
+
'adult'=>"1",
|
38
|
+
'img'=>"http://4.bp.blogspot.com/_ZmXOoYjxXog/Sg2jby1RFSI/AAAAAAAAE_Q/1LpfjimAz50/s400/JohnnyBravo3.gif",
|
39
|
+
'sex'=>"M"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}))
|
43
|
+
get '/auth/draugiem/callback?dr_auth_status=ok&dr_auth_code=123456'
|
44
|
+
|
45
|
+
last_request.env['omniauth.auth']['credentials']['apikey'].should == "123456789"
|
46
|
+
last_request.env['omniauth.auth']['user_info']['location'].should == "Durbe"
|
47
|
+
last_request.env['omniauth.auth']['user_info']['age'].should be_nil
|
48
|
+
last_request.env['omniauth.auth']['user_info']['adult'].should be_true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/oa-more/spec/spec_helper.rb
CHANGED
data/oa-oauth/Gemfile
ADDED
@@ -28,12 +28,14 @@ module OmniAuth
|
|
28
28
|
autoload :Mixi, 'omniauth/strategies/mixi'
|
29
29
|
autoload :Netflix, 'omniauth/strategies/netflix'
|
30
30
|
autoload :Qzone, 'omniauth/strategies/qzone'
|
31
|
+
autoload :Plurk, 'omniauth/strategies/plurk'
|
31
32
|
autoload :Rdio, 'omniauth/strategies/rdio'
|
32
33
|
autoload :Renren, 'omniauth/strategies/renren'
|
33
34
|
autoload :Salesforce, 'omniauth/strategies/salesforce'
|
34
35
|
autoload :SmugMug, 'omniauth/strategies/smug_mug'
|
35
36
|
autoload :SoundCloud, 'omniauth/strategies/sound_cloud'
|
36
37
|
autoload :T163, 'omniauth/strategies/t163'
|
38
|
+
autoload :TB, 'omniauth/strategies/taobao'
|
37
39
|
autoload :Teambox, 'omniauth/strategies/teambox'
|
38
40
|
autoload :ThirtySevenSignals, 'omniauth/strategies/thirty_seven_signals'
|
39
41
|
autoload :Tqq, 'omniauth/strategies/tqq'
|
@@ -49,5 +51,6 @@ module OmniAuth
|
|
49
51
|
autoload :Yahoo, 'omniauth/strategies/yahoo'
|
50
52
|
autoload :Yammer, 'omniauth/strategies/yammer'
|
51
53
|
autoload :YouTube, 'omniauth/strategies/you_tube'
|
54
|
+
autoload :Mailru, 'omniauth/strategies/mailru'
|
52
55
|
end
|
53
56
|
end
|
@@ -45,7 +45,7 @@ module OmniAuth
|
|
45
45
|
|
46
46
|
def user_info
|
47
47
|
{
|
48
|
-
'nickname' => user_data["
|
48
|
+
'nickname' => user_data["username"],
|
49
49
|
'email' => (user_data["email"] if user_data["email"]),
|
50
50
|
'first_name' => user_data["first_name"],
|
51
51
|
'last_name' => user_data["last_name"],
|
@@ -20,9 +20,9 @@ module OmniAuth
|
|
20
20
|
:authorize_path => '/accounts/OAuthAuthorizeToken'
|
21
21
|
}
|
22
22
|
|
23
|
-
google_contacts_auth = "
|
23
|
+
google_contacts_auth = "www.google.com/m8/feeds"
|
24
24
|
options[:scope] ||= google_contacts_auth
|
25
|
-
options[:scope] << "
|
25
|
+
options[:scope] << " http://#{google_contacts_auth}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_contacts_auth}]
|
26
26
|
|
27
27
|
super(app, :google, consumer_key, consumer_secret, client_options, options)
|
28
28
|
end
|
@@ -30,6 +30,14 @@ module OmniAuth
|
|
30
30
|
@data ||= MultiJson.decode(@access_token.get("/users/me.json"))
|
31
31
|
end
|
32
32
|
|
33
|
+
def refresh_token
|
34
|
+
@refresh_token ||= @access_token.refresh_token
|
35
|
+
end
|
36
|
+
|
37
|
+
def token_expires_at
|
38
|
+
@expires_at ||= @access_token.expires_at
|
39
|
+
end
|
40
|
+
|
33
41
|
def request_phase
|
34
42
|
options[:scope] ||= "read"
|
35
43
|
super
|
@@ -56,7 +64,7 @@ module OmniAuth
|
|
56
64
|
OmniAuth::Utils.deep_merge(super, {
|
57
65
|
'uid' => user_data["url"].split('/').last,
|
58
66
|
'user_info' => user_info,
|
59
|
-
'extra' => {'user_hash' => user_data}
|
67
|
+
'extra' => {'user_hash' => user_data, 'refresh_token' => refresh_token, 'token_expires_at' => token_expires_at}
|
60
68
|
})
|
61
69
|
end
|
62
70
|
end
|
@@ -28,26 +28,27 @@ module OmniAuth
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def user_hash(access_token)
|
31
|
-
|
31
|
+
person = MultiXml.parse(@access_token.get('/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url)').body)['person']
|
32
32
|
|
33
33
|
hash = {
|
34
|
-
'id' => person
|
35
|
-
'first_name' => person
|
36
|
-
'last_name' => person
|
37
|
-
'nickname' => person
|
38
|
-
'location' => person
|
39
|
-
'image' => person
|
40
|
-
'description' => person
|
41
|
-
'public_profile_url' => person
|
42
|
-
'urls' => person.css('member-url-resources member-url').inject({}) do |h,element|
|
43
|
-
h[element.xpath('name').text] = element.xpath('url').text
|
44
|
-
h
|
45
|
-
end
|
34
|
+
'id' => person['id'],
|
35
|
+
'first_name' => person['first_name'],
|
36
|
+
'last_name' => person['last_name'],
|
37
|
+
'nickname' => person['public_profile_url'].split('/').last,
|
38
|
+
'location' => person['location']['name'],
|
39
|
+
'image' => person['picture_url'],
|
40
|
+
'description' => person['headline'],
|
41
|
+
'public_profile_url' => person['public_profile_url']
|
46
42
|
}
|
47
|
-
|
48
|
-
|
43
|
+
hash['urls']={}
|
44
|
+
member_urls = person['member_url_resources']['member_url']
|
45
|
+
if (!member_urls.nil?) and (!member_urls.empty?)
|
46
|
+
[member_urls].flatten.each do |url|
|
47
|
+
hash['urls']["#{url['name']}"]=url['url']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
hash['urls']['LinkedIn'] = person['public_profile_url']
|
49
51
|
hash['name'] = "#{hash['first_name']} #{hash['last_name']}"
|
50
|
-
|
51
52
|
hash
|
52
53
|
end
|
53
54
|
end
|