class PactBroker::Client::Hal::ErrorEntity

Public Class Methods

new(href, data, http_client, response = nil) click to toggle source
# File lib/pact_broker/client/hal/entity.rb, line 171
def initialize(href, data, http_client, response = nil)
  @href = href
  @data = data
  @links = {}
  @client = http_client
  @response = response
end

Public Instance Methods

assert_success!(messages = {}) click to toggle source
# File lib/pact_broker/client/hal/entity.rb, line 196
def assert_success!(messages = {})
  raise ErrorResponseReturned.new(error_message(messages), self)
end
does_not_exist?() click to toggle source
# File lib/pact_broker/client/hal/entity.rb, line 179
def does_not_exist?
  response && response.status == 404
end
error_message(messages = {}) click to toggle source
# File lib/pact_broker/client/hal/entity.rb, line 187
def error_message(messages = {})
  default_message = "Error making request to #{@href} status=#{response ? response.status: nil} #{response ? response.raw_body : ''}".strip
  message = if response && messages[response.status]
    (messages[response.status] || "") + " (#{default_message})"
  else
    default_message
  end
end
success?() click to toggle source
# File lib/pact_broker/client/hal/entity.rb, line 183
def success?
  false
end