class BluepanClient::BaseResponse

Private Instance Methods

default_body() click to toggle source
# File lib/bluepan_client/responses/base_response.rb, line 22
def default_body
  raw_response.body
end
default_error_message() click to toggle source
# File lib/bluepan_client/responses/base_response.rb, line 32
def default_error_message
  return nil if success?
  return parsed_body[:error] if parsed_body.present? && parsed_body[:error]
  "Status: #{raw_response.code}; Error message not found in `#{body}`"
end
default_parsed_body() click to toggle source
# File lib/bluepan_client/responses/base_response.rb, line 26
def default_parsed_body
  JSON.parse(body)
rescue JSON::ParserError
  nil
end
default_success() click to toggle source
# File lib/bluepan_client/responses/base_response.rb, line 16
def default_success
  return false if !raw_response.success?
  return true if !parsed_body.respond_to?(:keys)
  parsed_body[:error].nil?
end