Class: OmniAuth::Strategies::Miso
- Defined in:
- lib/omniauth/strategies/oauth/miso.rb
Overview
Authenticate to Miso via OAuth and retrieve basic user information.
Usage:
use OmniAuth::Strategies::Miso, 'consumerkey', 'consumersecret'
Instance Attribute Summary
Attributes inherited from OAuth
#consumer_key, #consumer_options, #consumer_secret, #name
Instance Method Summary collapse
- #auth_hash ⇒ Object
-
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Miso
constructor
A new instance of Miso.
- #user_hash ⇒ Object
- #user_info ⇒ Object
Methods inherited from OAuth
#callback_phase, #consumer, #request_phase, #unique_id
Constructor Details
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Miso
Returns a new instance of Miso.
15 16 17 18 19 20 |
# File 'lib/omniauth/strategies/oauth/miso.rb', line 15 def initialize(app, consumer_key=nil, consumer_secret=nil, ={}, &block) = { :site => 'https://gomiso.com', } super(app, :miso, consumer_key, consumer_secret, , , &block) end |
Instance Method Details
#auth_hash ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/omniauth/strategies/oauth/miso.rb', line 22 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_hash['id'], 'user_info' => user_info, 'extra' => { 'user_hash' => user_hash, }, } ) end |
#user_hash ⇒ Object
43 44 45 |
# File 'lib/omniauth/strategies/oauth/miso.rb', line 43 def user_hash @user_hash ||= MultiJson.decode(@access_token.get('/api/oauth/v1/users/show.json').body)['user'] end |
#user_info ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/omniauth/strategies/oauth/miso.rb', line 34 def user_info { 'nickname' => user_hash['username'], 'name' => user_hash['full_name'], 'image' => user_hash['profile_image_url'], 'description' => user_hash['tagline'], } end |