Sha256: cc2780606f4a3789e50c6aa5113aeaa97bd92c6d77330e927fef688ff9bad770

Contents?: true

Size: 878 Bytes

Versions: 5

Compression:

Stored size: 878 Bytes

Contents

require 'active_model'

module Doorkeeper
  module OAuth
    class ClientCredentialsRequest
      class Response
        include ActiveModel::Serializers::JSON

        self.include_root_in_json = false

        delegate :token, :expires_in, :scopes_string, :to => :@token
        alias    :access_token :token
        alias    :scope :scopes_string

        def initialize(token)
          @token = token
        end

        def attributes
          {
            'access_token' => token,
            'token_type'   => token_type,
            'expires_in'   => expires_in,
            'scope'        => scopes_string
          }
        end

        def status
          :success
        end

        def token_type
          'bearer'
        end

        def headers
          { 'Cache-Control' => 'no-store', 'Pragma' => 'no-cache' }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
doorkeeper-0.5.0 lib/doorkeeper/oauth/client_credentials/response.rb
doorkeeper-0.5.0.rc1 lib/doorkeeper/oauth/client_credentials/response.rb
doorkeeper-0.4.2 lib/doorkeeper/oauth/client_credentials/response.rb
doorkeeper-0.4.1 lib/doorkeeper/oauth/client_credentials/response.rb
doorkeeper-0.4.0 lib/doorkeeper/oauth/client_credentials/response.rb