class Rack::OAuth2::Server::Abstract::Error

Attributes

description[RW]
error[RW]
realm[RW]
status[RW]
uri[RW]

Public Class Methods

new(status, error, description = nil, options = {}) click to toggle source
Calls superclass method
# File lib/rack/oauth2/server/abstract/error.rb, line 8
def initialize(status, error, description = nil, options = {})
  @status      = status
  @error       = error
  @description = description
  @uri         = options[:uri]
  @realm       = options[:realm]
  super [error, description].compact.join(' :: ')
end

Public Instance Methods

finish() { |response| ... } click to toggle source
# File lib/rack/oauth2/server/abstract/error.rb, line 25
def finish
  response = Rack::Response.new
  response.status = status
  yield response if block_given?
  unless response.redirect?
    response.headers['Content-Type'] = 'application/json'
    response.write Util.compact_hash(protocol_params).to_json
  end
  response.finish
end
protocol_params() click to toggle source
# File lib/rack/oauth2/server/abstract/error.rb, line 17
def protocol_params
  {
    error:             error,
    error_description: description,
    error_uri:         uri
  }
end