Exception: PusherPlatform::ErrorResponse
- Defined in:
- lib/pusher-platform/error_response.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#error_description ⇒ Object
readonly
Returns the value of attribute error_description.
-
#error_uri ⇒ Object
readonly
Returns the value of attribute error_uri.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(options) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
- #to_json(*options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
8 9 10 11 12 13 14 |
# File 'lib/pusher-platform/error_response.rb', line 8 def initialize() @status = [:status] @headers = [:headers] || {} @error = [:error] @error_description = [:error_description] @error_uri = [:error_uri] end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'lib/pusher-platform/error_response.rb', line 6 def error @error end |
#error_description ⇒ Object (readonly)
Returns the value of attribute error_description.
6 7 8 |
# File 'lib/pusher-platform/error_response.rb', line 6 def error_description @error_description end |
#error_uri ⇒ Object (readonly)
Returns the value of attribute error_uri.
6 7 8 |
# File 'lib/pusher-platform/error_response.rb', line 6 def error_uri @error_uri end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/pusher-platform/error_response.rb', line 6 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/pusher-platform/error_response.rb', line 6 def status @status end |
Instance Method Details
#as_json(options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pusher-platform/error_response.rb', line 22 def as_json( = {}) json = { status: @status, headers: @headers, error: @error, error_description: @error_description, } json[:error_uri] = @error_uri unless @error_uri.nil? json end |
#to_json(*options) ⇒ Object
33 34 35 |
# File 'lib/pusher-platform/error_response.rb', line 33 def to_json(*) as_json(*).to_json(*) end |
#to_s ⇒ Object
16 17 18 19 20 |
# File 'lib/pusher-platform/error_response.rb', line 16 def to_s output = "PusherPlatform::ErrorResponse - status: #{@status} description: #{@error_description}." output += " Find out more at #{@error_uri}" if @error_uri output end |