Class: PactBroker::Client::Hal::ErrorEntity
- Inherits:
-
Entity
- Object
- Entity
- PactBroker::Client::Hal::ErrorEntity
show all
- Defined in:
- lib/pact_broker/client/hal/entity.rb
Instance Method Summary
collapse
Methods inherited from Entity
#_link, #_link!, #_links, #_links!, #can?, #embedded_entities, #embedded_entities!, #embedded_entity, #fetch, #follow, #get, #get!, #method_missing, #patch, #patch!, #post, #post!, #put, #put!, #relation_not_found_error_message, #respond_to_missing?, #response, #self_href
Constructor Details
#initialize(href, data, http_client, response = nil) ⇒ ErrorEntity
Returns a new instance of ErrorEntity.
171
172
173
174
175
176
177
|
# 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
|
Instance Method Details
#assert_success!(messages = {}) ⇒ Object
196
197
198
|
# 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? ⇒ Boolean
179
180
181
|
# File 'lib/pact_broker/client/hal/entity.rb', line 179
def does_not_exist?
response && response.status == 404
end
|
#error_message(messages = {}) ⇒ Object
187
188
189
190
191
192
193
194
|
# 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? ⇒ Boolean
183
184
185
|
# File 'lib/pact_broker/client/hal/entity.rb', line 183
def success?
false
end
|