Exception: Rack::OAuth2::Server::Abstract::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rack/oauth2/server/abstract/error.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Error) initialize(status, error, description = nil, options = {})



8
9
10
11
12
13
14
15
# 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

Instance Attribute Details

- (Object) description

Returns the value of attribute description



6
7
8
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6

def description
  @description
end

- (Object) error

Returns the value of attribute error



6
7
8
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6

def error
  @error
end

- (Object) realm

Returns the value of attribute realm



6
7
8
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6

def realm
  @realm
end

- (Object) status

Returns the value of attribute status



6
7
8
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6

def status
  @status
end

- (Object) uri

Returns the value of attribute uri



6
7
8
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6

def uri
  @uri
end

Instance Method Details

- (Object) finish {|response| ... }

Yields:

  • (response)


25
26
27
28
29
30
31
32
33
34
# 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.header['Content-Type'] = 'application/json'
    response.write MultiJson.dump(Util.compact_hash(protocol_params))
  end
  response.finish
end

- (Object) protocol_params



17
18
19
20
21
22
23
# File 'lib/rack/oauth2/server/abstract/error.rb', line 17

def protocol_params
  {
    :error             => error,
    :error_description => description,
    :error_uri         => uri
  }
end