Class: OmniAuth::Strategies::Dropbox
- Defined in:
- lib/omniauth/strategies/oauth/dropbox.rb
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) ⇒ Dropbox
constructor
A new instance of Dropbox.
- #user_data ⇒ 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) ⇒ Dropbox
Returns a new instance of Dropbox.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/omniauth/strategies/oauth/dropbox.rb', line 7 def initialize(app, consumer_key=nil, consumer_secret=nil, ={}, &block) = { :authorize_url => 'https://www.dropbox.com/0/oauth/authorize', :access_token_url => 'https://api.dropbox.com/0/oauth/access_token', :proxy => ENV['HTTP_PROXY'] || ENV['http_proxy'], :request_token_url => 'https://api.dropbox.com/0/oauth/request_token', :site => 'https://api.dropbox.com', } super(app, :dropbox, consumer_key, consumer_secret, , , &block) end |
Instance Method Details
#auth_hash ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/omniauth/strategies/oauth/dropbox.rb', line 18 def auth_hash OmniAuth::Utils.deep_merge( super, { 'uid' => user_data['uid'], 'user_info' => user_info, } ) end |
#user_data ⇒ Object
27 28 29 |
# File 'lib/omniauth/strategies/oauth/dropbox.rb', line 27 def user_data @data ||= MultiJson.decode(@access_token.get('/0/account/info').body) end |
#user_info ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/omniauth/strategies/oauth/dropbox.rb', line 31 def user_info { 'name' => user_data['display_name'], 'uid' => user_data['uid'], 'email' => user_data['email'] } end |