Class: OmniAuth::Strategies::Instapaper
- Defined in:
- lib/omniauth/strategies/xauth/instapaper.rb
Instance Attribute Summary
Attributes inherited from XAuth
#consumer_key, #consumer_options, #consumer_secret, #name
Instance Method Summary collapse
- #auth_hash ⇒ Object
-
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Instapaper
constructor
A new instance of Instapaper.
- #user_data ⇒ Object
- #user_info ⇒ Object
Methods inherited from XAuth
#callback_phase, #consumer, #get_credentials, #request_phase
Constructor Details
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Instapaper
Returns a new instance of Instapaper.
7 8 9 10 11 12 |
# File 'lib/omniauth/strategies/xauth/instapaper.rb', line 7 def initialize(app, consumer_key=nil, consumer_secret=nil, ={}, &block) = { :token_url => 'https://www.instapaper.com/api/1/oauth/access_token', } super(app, :instapaper, consumer_key, consumer_secret, , , &block) end |
Instance Method Details
#auth_hash ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/omniauth/strategies/xauth/instapaper.rb', line 25 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_data['user_id'], 'user_info' => user_info, } ) end |
#user_data ⇒ Object
14 15 16 |
# File 'lib/omniauth/strategies/xauth/instapaper.rb', line 14 def user_data @data ||= MultiJson.decode(@access_token.get('/api/1/account/verify_credentials').body)[0] end |
#user_info ⇒ Object
18 19 20 21 22 23 |
# File 'lib/omniauth/strategies/xauth/instapaper.rb', line 18 def user_info { 'nickname' => user_data['username'], 'name' => user_data['username'], } end |