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
-
#description ⇒ Object
Returns the value of attribute description.
-
#error ⇒ Object
Returns the value of attribute error.
-
#realm ⇒ Object
Returns the value of attribute realm.
-
#status ⇒ Object
Returns the value of attribute status.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #finish {|response| ... } ⇒ Object
-
#initialize(status, error, description = nil, options = {}) ⇒ Error
constructor
A new instance of Error.
- #protocol_params ⇒ Object
Constructor Details
#initialize(status, error, description = nil, options = {}) ⇒ Error
Returns 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
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6 def description @description end |
#error ⇒ Object
Returns the value of attribute error.
6 7 8 |
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6 def error @error end |
#realm ⇒ Object
Returns the value of attribute realm.
6 7 8 |
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6 def realm @realm end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/rack/oauth2/server/abstract/error.rb', line 6 def status @status end |
#uri ⇒ Object
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
#finish {|response| ... } ⇒ Object
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.headers['Content-Type'] = 'application/json' response.write Util.compact_hash(protocol_params).to_json end response.finish end |
#protocol_params ⇒ Object
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 |