Class: Doorkeeper::OAuth::Client
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::Client
- Defined in:
- lib/doorkeeper.rb,
lib/doorkeeper/oauth/client.rb,
lib/doorkeeper/oauth/client/credentials.rb
Defined Under Namespace
Classes: Credentials
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
Class Method Summary collapse
- .authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret)) ⇒ Object
- .find(uid, method = Doorkeeper.config.application_model.method(:by_uid)) ⇒ Object
Instance Method Summary collapse
-
#initialize(application) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(application) ⇒ Client
Returns a new instance of Client.
10 11 12 |
# File 'lib/doorkeeper/oauth/client.rb', line 10 def initialize(application) @application = application end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
6 7 8 |
# File 'lib/doorkeeper/oauth/client.rb', line 6 def application @application end |
Class Method Details
.authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret)) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/doorkeeper/oauth/client.rb', line 20 def self.authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret)) return if credentials.blank? return unless (application = method.call(credentials.uid, credentials.secret)) new(application) end |
.find(uid, method = Doorkeeper.config.application_model.method(:by_uid)) ⇒ Object
14 15 16 17 18 |
# File 'lib/doorkeeper/oauth/client.rb', line 14 def self.find(uid, method = Doorkeeper.config.application_model.method(:by_uid)) return unless (application = method.call(uid)) new(application) end |