Class: OmniAuth::Strategies::Instapaper

Inherits:
XAuth
  • Object
show all
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

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, options={}, &block)
  client_options = {
    :token_url => 'https://www.instapaper.com/api/1/oauth/access_token',
  }
  super(app, :instapaper, consumer_key, consumer_secret, client_options, options, &block)
end

Instance Method Details

#auth_hashObject



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' => ,
    }
  )
end

#user_dataObject



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_infoObject



18
19
20
21
22
23
# File 'lib/omniauth/strategies/xauth/instapaper.rb', line 18

def 
  {
    'nickname' => user_data['username'],
    'name' => user_data['username'],
  }
end