Exception: ViralLoops::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- ViralLoops::ApiError
- Defined in:
- lib/viral_loops/client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_symbol ⇒ Object
readonly
Returns the value of attribute status_symbol.
Instance Method Summary collapse
-
#initialize(status:, body: nil, message: nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(status:, body: nil, message: nil) ⇒ ApiError
Returns a new instance of ApiError.
52 53 54 55 56 57 58 59 |
# File 'lib/viral_loops/client.rb', line 52 def initialize(status:, body: nil, message: nil) @status = status @status_symbol = Rack::Utils::SYMBOL_TO_STATUS_CODE.key(status) @body = body = Rack::Utils::HTTP_STATUS_CODES[status] || 'API Error' super( || "#{} (#{status})") end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
50 51 52 |
# File 'lib/viral_loops/client.rb', line 50 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
50 51 52 |
# File 'lib/viral_loops/client.rb', line 50 def status @status end |
#status_symbol ⇒ Object (readonly)
Returns the value of attribute status_symbol.
50 51 52 |
# File 'lib/viral_loops/client.rb', line 50 def status_symbol @status_symbol end |