Class: PactBroker::Client::Hal::ErrorEntity

Inherits:
Entity
  • Object
show all
Defined in:
lib/pact_broker/client/hal/entity.rb

Instance Method Summary collapse

Methods inherited from Entity

#_link, #_link!, #can?, #fetch, #follow, #get, #method_missing, #patch, #post, #put, #respond_to_missing?, #response

Constructor Details

#initialize(href, data, http_client, response = nil) ⇒ ErrorEntity

Returns a new instance of ErrorEntity.



94
95
96
97
98
99
100
# File 'lib/pact_broker/client/hal/entity.rb', line 94

def initialize(href, data, http_client, response = nil)
  @href = href
  @data = data
  @links = {}
  @client = http_client
  @response = response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PactBroker::Client::Hal::Entity

Instance Method Details

#assert_success!Object



110
111
112
# File 'lib/pact_broker/client/hal/entity.rb', line 110

def assert_success!
  raise ErrorResponseReturned.new("Error retrieving #{@href} status=#{response ? response.code: nil} #{response ? response.raw_body : ''}")
end

#does_not_exist?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/pact_broker/client/hal/entity.rb', line 102

def does_not_exist?
  response && response.status == 404
end

#success?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/pact_broker/client/hal/entity.rb', line 106

def success?
  false
end