Class: Doorkeeper::OAuth::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/doorkeeper/oauth/client.rb,
lib/doorkeeper/oauth/client/methods.rb,
lib/doorkeeper/oauth/client/credentials.rb

Defined Under Namespace

Modules: Methods Classes: Credentials

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ Client

Returns a new instance of Client.


22
23
24
# File 'lib/doorkeeper/oauth/client.rb', line 22

def initialize(application)
  @application = application
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application


26
27
28
# File 'lib/doorkeeper/oauth/client.rb', line 26

def application
  @application
end

Class Method Details

.authenticate(credentials, method = Application.method(:by_uid_and_secret)) ⇒ Object


13
14
15
16
17
18
# File 'lib/doorkeeper/oauth/client.rb', line 13

def self.authenticate(credentials, method = Application.method(:by_uid_and_secret))
  return false if credentials.blank?
  if application = method.call(credentials.uid, credentials.secret)
    new(application)
  end
end

.find(uid, method = Application.method(:by_uid)) ⇒ Object


7
8
9
10
11
# File 'lib/doorkeeper/oauth/client.rb', line 7

def self.find(uid, method = Application.method(:by_uid))
  if application = method.call(uid)
    new(application)
  end
end