Class: OmniAuth::Strategies::Ourkudos
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Ourkudos
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/ourkudos/strategies/strategy.rb
Instance Method Summary collapse
- #auth_hash ⇒ Object
-
#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ Ourkudos
constructor
A new instance of Ourkudos.
- #request_phase ⇒ Object
- #user_data ⇒ Object
- #user_info ⇒ Object
Constructor Details
#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ Ourkudos
Returns a new instance of Ourkudos.
9 10 11 |
# File 'lib/ourkudos/strategies/strategy.rb', line 9 def initialize(app, client_id = nil, client_secret = nil, = {}, &block) super app, :ourkudos, client_id, client_secret, {:site => 'http://localhost:3000'}, , &block end |
Instance Method Details
#auth_hash ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/ourkudos/strategies/strategy.rb', line 31 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_data["user"]["id"], 'user_info' => user_info, 'extra' => {'user_hash' => user_data} }) end |
#request_phase ⇒ Object
13 14 15 16 |
# File 'lib/ourkudos/strategies/strategy.rb', line 13 def request_phase [:response_type] ||= 'code' super end |
#user_data ⇒ Object
18 19 20 |
# File 'lib/ourkudos/strategies/strategy.rb', line 18 def user_data @data ||= MultiJson.decode(@access_token.get(client.site + '/oauth/user', {'oauth_token' => @access_token.token})) end |
#user_info ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/ourkudos/strategies/strategy.rb', line 22 def user_info { 'email' => (user_data["email"] if user_data["email"]), 'first_name' => user_data["first_name"], 'last_name' => user_data["last_name"], 'name' => "#{user_data['first_name']} #{user_data['last_name']}" } end |