Class: OmniAuth::Strategies::Xing
- Defined in:
- lib/omniauth/strategies/oauth/xing.rb
Instance Attribute Summary
Attributes inherited from OAuth
#consumer_key, #consumer_options, #consumer_secret, #name
Instance Method Summary collapse
- #auth_hash ⇒ Object
- #callback_phase ⇒ Object
-
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Xing
constructor
A new instance of Xing.
- #user_hash(access_token) ⇒ Object
Methods inherited from OAuth
#consumer, #request_phase, #unique_id
Constructor Details
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Xing
Returns a new instance of Xing.
8 9 10 11 12 13 14 15 16 |
# File 'lib/omniauth/strategies/oauth/xing.rb', line 8 def initialize(app, consumer_key=nil, consumer_secret=nil, ={}, &block) = { :access_token_path => '/v1/access_token', :authorize_path => '/v1/authorize', :request_token_path => '/v1/request_token/', :site => 'https://api.xing.com' } super(app, :xing, consumer_key, consumer_secret, , , &block) end |
Instance Method Details
#auth_hash ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/omniauth/strategies/oauth/xing.rb', line 23 def auth_hash hash = user_hash(@access_token) OmniAuth::Utils.deep_merge(super, { 'uid' => @access_token.params[:user_id], 'user_info' => hash, } ) end |
#callback_phase ⇒ Object
18 19 20 21 |
# File 'lib/omniauth/strategies/oauth/xing.rb', line 18 def callback_phase session['oauth'][name.to_s]['callback_confirmed'] = true super end |
#user_hash(access_token) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/omniauth/strategies/oauth/xing.rb', line 34 def user_hash(access_token) person = JSON.parse( access_token.get('/v1/users/me').body )["users"].first hash = { 'id' => person['id'], 'first_name' => person['first_name'], 'last_name' => person['last_name'], 'image' => person["photo_urls"]["large"], 'email' => person["active_email"], } end |