Exception: BookingSync::API::Error
- Inherits:
-
StandardError
- Object
- StandardError
- BookingSync::API::Error
- Defined in:
- lib/bookingsync/api/error.rb
Overview
Class for rescuing all BS API errors
Direct Known Subclasses
Forbidden, NotFound, RateLimitExceeded, Unauthorized, UnprocessableEntity, UnsupportedResponse
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
- #message(message = self.class) ⇒ Object
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 |
# File 'lib/bookingsync/api/error.rb', line 6 def initialize(response) @status = response.status @headers = response.headers @body = response.body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/bookingsync/api/error.rb', line 4 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/bookingsync/api/error.rb', line 4 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/bookingsync/api/error.rb', line 4 def status @status end |
Instance Method Details
#message(message = self.class) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/bookingsync/api/error.rb', line 12 def ( = self.class) %{#{} HTTP status code : #{status} Headers : #{headers} Body : #{body}} end |