Class: Calendlyr::ResponseErrorHandler
- Inherits:
-
Object
- Object
- Calendlyr::ResponseErrorHandler
- Defined in:
- lib/calendlyr/error.rb
Constant Summary collapse
- ERROR_TYPES =
{ "400" => BadRequest, "401" => Unauthenticated, "403" => PermissionDenied, "404" => NotFound, "424" => ExternalCalendarError, "429" => TooManyRequests, "500" => InternalServerError }
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(code, body) ⇒ ResponseErrorHandler
constructor
A new instance of ResponseErrorHandler.
Constructor Details
#initialize(code, body) ⇒ ResponseErrorHandler
Returns a new instance of ResponseErrorHandler.
31 32 33 34 |
# File 'lib/calendlyr/error.rb', line 31 def initialize(code, body) @code = code @body = body end |
Instance Method Details
#error ⇒ Object
36 37 38 39 40 |
# File 'lib/calendlyr/error.rb', line 36 def error return too_many_requests_error if @code == "429" error_type.new("[Error #{@code}] #{@body["title"]}. #{@body["message"]}") end |