Class: PactBroker::Client::Hal::ErrorEntity
- Defined in:
- lib/pact_broker/client/hal/entity.rb
Instance Method Summary collapse
- #assert_success!(messages = {}) ⇒ Object
- #does_not_exist? ⇒ Boolean
-
#initialize(href, data, http_client, response = nil) ⇒ ErrorEntity
constructor
A new instance of ErrorEntity.
- #success? ⇒ Boolean
Methods inherited from Entity
#_link, #_link!, #_links, #_links!, #can?, #embedded_entities, #embedded_entity, #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.
129 130 131 132 133 134 135 |
# File 'lib/pact_broker/client/hal/entity.rb', line 129 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!(messages = {}) ⇒ Object
145 146 147 148 149 150 151 152 153 |
# File 'lib/pact_broker/client/hal/entity.rb', line 145 def assert_success!( = {}) = "Error retrieving #{@href} status=#{response ? response.status: nil} #{response ? response.raw_body : ''}".strip = if response && [response.status] ([response.status] || "") + " (#{})" else end raise ErrorResponseReturned.new() end |
#does_not_exist? ⇒ Boolean
137 138 139 |
# File 'lib/pact_broker/client/hal/entity.rb', line 137 def does_not_exist? response && response.status == 404 end |
#success? ⇒ Boolean
141 142 143 |
# File 'lib/pact_broker/client/hal/entity.rb', line 141 def success? false end |