Sha256: bdd4aa5d765dd033e3b812c197d35a50e34040e1d4b24145763ac7f0e140bb52
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module Passport module Oauth module Consumable def self.included(base) base.extend ClassMethods base.send :include, InstanceMethods end module ClassMethods def consumer_settings(options = {}) settings.merge(credentials[:options] || {}).merge(options) end def access_token(token, secret, version = 1.0, options = {}) if version == 1.0 OAuth::AccessToken.new(consumer, token, secret) else OAuth2::AccessToken.new(consumer, token) end end def consumer(options = {}) if version == 1.0 OAuth::Consumer.new(credentials[:key], credentials[:secret], consumer_settings(options)) else OAuth2::Client.new(credentials[:key], credentials[:secret], consumer_settings(options)) end end end module InstanceMethods def access_token @access_token ||= self.class.access_token(token, secret, version) @access_token end def consumer(options = {}) self.class.consumer(options) end def clear @access_token = nil end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
passport-0.1.1 | lib/passport/oauth/client/consumable.rb |