Class: Bkblz::V1::ErrorResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/bkblz/v1/error_response.rb

Constant Summary collapse

ERROR_TYPE =
{
  400 => :BAD_REQUEST,
  401 => :UNAUTHORIZED,
  403 => :FORBIDDEN,
  408 => :REQUEST_TIMEOUT,
  429 => :TOO_MANY_REQUESTS,
  500 => :INTERNAL_ERROR,
  503 => :SERVICE_UNAVAILABLE
}

Constants inherited from Response

Response::MissingResponseError

Instance Attribute Summary

Attributes inherited from Response

#http_response, #parsed_body

Instance Method Summary collapse

Methods inherited from Response

#[], #initialize, #parse, response_accessor, response_accessors, response_model, #to_model

Constructor Details

This class inherits a constructor from Bkblz::V1::Response

Instance Method Details

#messageObject



17
18
19
20
21
# File 'lib/bkblz/v1/error_response.rb', line 17

def message
  model = self.to_model
  error_type = ERROR_TYPE[model.status]
  "[#{model.status}:#{error_type}:#{model.code}] #{model.message}"
end