Exception: Rack::OAuth2::Server::Abstract::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Rack::OAuth2::Server::Abstract::Error
- Defined in:
- lib/rack/oauth2/server/abstract/error.rb
Direct Known Subclasses
BadRequest, Forbidden, ServerError, TemporarilyUnavailable, Unauthorized
Instance Attribute Summary (collapse)
-
- (Object) description
Returns the value of attribute description.
-
- (Object) error
Returns the value of attribute error.
-
- (Object) realm
Returns the value of attribute realm.
-
- (Object) status
Returns the value of attribute status.
-
- (Object) uri
Returns the value of attribute uri.
Instance Method Summary (collapse)
- - (Object) finish {|response| ... }
-
- (Error) initialize(status, error, description = nil, options = {})
constructor
A new instance of Error.
- - (Object) protocol_params
Constructor Details
- (Error) initialize(status, error, description = nil, options = {})
A new instance of Error
8 9 10 11 12 13 14 15 |
# File 'lib/rack/oauth2/server/abstract/error.rb', line 8 def initialize(status, error, description = nil, = {}) @status = status @error = error @description = description @uri = [:uri] @realm = [: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| ... }
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 |