Module: Makeleaps::ErrorHandler
- Included in:
- Request::BasicAuth, Request::RequestHandler
- Defined in:
- lib/makeleaps/errors.rb
Instance Method Summary collapse
Instance Method Details
#handle_api_response(success: 200, &block) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/makeleaps/errors.rb', line 14 def handle_api_response(success: 200, &block) response = block.call return response if [success].flatten.include? response.status = response.respond_to?(:resource) ? response.resource : response.inspect # 'Makeleaps API error' raise Makeleaps::APIError.new(, response.status) end |