Exception: Latitude::APIError
- Defined in:
- lib/latitude/api/errors.rb
Direct Known Subclasses
AuthenticationError, BadRequestError, ConflictError, NotFoundError, PermissionError, RateLimitError, ServerError, UnprocessableEntityError
Defined Under Namespace
Classes: Entry
Instance Attribute Summary collapse
-
#entries ⇒ Object
(also: #errors)
readonly
Returns the value of attribute entries.
-
#http_body ⇒ Object
readonly
Returns the value of attribute http_body.
-
#http_headers ⇒ Object
readonly
Returns the value of attribute http_headers.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#json_body ⇒ Object
readonly
Returns the value of attribute json_body.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
Instance Method Summary collapse
- #code ⇒ Object
- #detail ⇒ Object
-
#initialize(message = nil, http_status: nil, http_headers: nil, http_body: nil, json_body: nil, request_id: nil) ⇒ APIError
constructor
A new instance of APIError.
- #title ⇒ Object
Constructor Details
#initialize(message = nil, http_status: nil, http_headers: nil, http_body: nil, json_body: nil, request_id: nil) ⇒ APIError
Returns a new instance of APIError.
44 45 46 47 48 49 50 51 52 |
# File 'lib/latitude/api/errors.rb', line 44 def initialize( = nil, http_status: nil, http_headers: nil, http_body: nil, json_body: nil, request_id: nil) @http_status = http_status @http_headers = http_headers || {} @http_body = http_body @json_body = json_body @request_id = request_id @entries = Array(json_body.is_a?(Hash) ? json_body["errors"] : nil).map { |h| Entry.new(h) } super( || ) end |
Instance Attribute Details
#entries ⇒ Object (readonly) Also known as: errors
Returns the value of attribute entries.
42 43 44 |
# File 'lib/latitude/api/errors.rb', line 42 def entries @entries end |
#http_body ⇒ Object (readonly)
Returns the value of attribute http_body.
42 43 44 |
# File 'lib/latitude/api/errors.rb', line 42 def http_body @http_body end |
#http_headers ⇒ Object (readonly)
Returns the value of attribute http_headers.
42 43 44 |
# File 'lib/latitude/api/errors.rb', line 42 def http_headers @http_headers end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
42 43 44 |
# File 'lib/latitude/api/errors.rb', line 42 def http_status @http_status end |
#json_body ⇒ Object (readonly)
Returns the value of attribute json_body.
42 43 44 |
# File 'lib/latitude/api/errors.rb', line 42 def json_body @json_body end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
42 43 44 |
# File 'lib/latitude/api/errors.rb', line 42 def request_id @request_id end |
Instance Method Details
#code ⇒ Object
56 57 58 |
# File 'lib/latitude/api/errors.rb', line 56 def code entries.first&.code end |
#detail ⇒ Object
64 65 66 |
# File 'lib/latitude/api/errors.rb', line 64 def detail entries.first&.detail end |
#title ⇒ Object
60 61 62 |
# File 'lib/latitude/api/errors.rb', line 60 def title entries.first&.title end |