Class: Nylas::NylasApiError
Overview
Base class to inflate the standard errors returned from the Nylas API.
Instance Attribute Summary collapse
-
#provider_error ⇒ Object
Returns the value of attribute provider_error.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.parse_error_response(response, status_code) ⇒ Object
Parses the error response.
Instance Method Summary collapse
-
#initialize(type, message, status_code, provider_error = nil, request_id = nil) ⇒ NylasApiError
constructor
Initializes an error and assigns the given attributes to it.
Constructor Details
#initialize(type, message, status_code, provider_error = nil, request_id = nil) ⇒ NylasApiError
Initializes an error and assigns the given attributes to it.
19 20 21 22 23 24 25 |
# File 'lib/nylas/errors.rb', line 19 def initialize(type, , status_code, provider_error = nil, request_id = nil) super() self.type = type self.status_code = status_code self.provider_error = provider_error self.request_id = request_id end |
Instance Attribute Details
#provider_error ⇒ Object
Returns the value of attribute provider_error.
10 11 12 |
# File 'lib/nylas/errors.rb', line 10 def provider_error @provider_error end |
#request_id ⇒ Object
Returns the value of attribute request_id.
10 11 12 |
# File 'lib/nylas/errors.rb', line 10 def request_id @request_id end |
#status_code ⇒ Object
Returns the value of attribute status_code.
10 11 12 |
# File 'lib/nylas/errors.rb', line 10 def status_code @status_code end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/nylas/errors.rb', line 10 def type @type end |
Class Method Details
.parse_error_response(response, status_code) ⇒ Object
Parses the error response.
31 32 33 34 35 36 37 38 |
# File 'lib/nylas/errors.rb', line 31 def self.parse_error_response(response, status_code) new( response["type"], response["message"], status_code, response["provider_error"] ) end |