Class: Mindee::Parsing::V2::ErrorResponse
- Inherits:
-
Object
- Object
- Mindee::Parsing::V2::ErrorResponse
- Defined in:
- lib/mindee/parsing/v2/error_response.rb
Overview
Encapsulates information returned by the API when an error occurs.
Instance Attribute Summary collapse
-
#detail ⇒ String
readonly
Error detail.
-
#status ⇒ Integer
readonly
HTTP status code.
Instance Method Summary collapse
-
#as_hash ⇒ Hash
Hash representation.
-
#initialize(server_response) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(server_response) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
14 15 16 17 |
# File 'lib/mindee/parsing/v2/error_response.rb', line 14 def initialize(server_response) @status = server_response['status'] @detail = server_response['detail'] end |
Instance Attribute Details
#detail ⇒ String (readonly)
Returns Error detail.
11 12 13 |
# File 'lib/mindee/parsing/v2/error_response.rb', line 11 def detail @detail end |
#status ⇒ Integer (readonly)
Returns HTTP status code.
9 10 11 |
# File 'lib/mindee/parsing/v2/error_response.rb', line 9 def status @status end |
Instance Method Details
#as_hash ⇒ Hash
Hash representation
27 28 29 30 31 32 |
# File 'lib/mindee/parsing/v2/error_response.rb', line 27 def as_hash { status: @status, detail: @detail, } end |
#to_s ⇒ String
String representation.
21 22 23 |
# File 'lib/mindee/parsing/v2/error_response.rb', line 21 def to_s "Error\n=====\n:Status: #{@status}\n:Detail: #{@detail}" end |