Sha256: e36f892bd0f289b4d4816482071a3edb6a56872ca30b7020030d9732ca015e76

Contents?: true

Size: 768 Bytes

Versions: 3

Compression:

Stored size: 768 Bytes

Contents

require 'doorkeeper/oauth/client/methods'
require 'doorkeeper/oauth/client/credentials'

module Doorkeeper
  module OAuth
    class Client
      def self.find(uid, method = Doorkeeper::Application.method(:by_uid))
        if application = method.call(uid)
          new(application)
        end
      end

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

      delegate :id, :name, :uid, :redirect_uri, to: :@application

      def initialize(application)
        @application = application
      end

      attr_accessor :application
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-1.3.1 lib/doorkeeper/oauth/client.rb
doorkeeper-1.3.0 lib/doorkeeper/oauth/client.rb
doorkeeper-1.2.0 lib/doorkeeper/oauth/client.rb