Module: Passport::Oauth::Consumable::ClassMethods
- Defined in:
- lib/passport/oauth/client/consumable.rb
Instance Method Summary collapse
- #access_token(token, secret, version = 1.0, options = {}) ⇒ Object
- #consumer(options = {}) ⇒ Object
- #consumer_settings(options = {}) ⇒ Object
Instance Method Details
#access_token(token, secret, version = 1.0, options = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/passport/oauth/client/consumable.rb', line 14 def access_token(token, secret, version = 1.0, = {}) if version == 1.0 OAuth::AccessToken.new(consumer, token, secret) else OAuth2::AccessToken.new(consumer, token) end end |
#consumer(options = {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/passport/oauth/client/consumable.rb', line 22 def consumer( = {}) if version == 1.0 OAuth::Consumer.new(credentials[:key], credentials[:secret], consumer_settings()) else OAuth2::Client.new(credentials[:key], credentials[:secret], consumer_settings()) end end |
#consumer_settings(options = {}) ⇒ Object
10 11 12 |
# File 'lib/passport/oauth/client/consumable.rb', line 10 def consumer_settings( = {}) settings.merge(credentials[:options] || {}).merge() end |