Class: PactBroker::Client::Hal::HttpClient::Response

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/pact_broker/client/hal/http_client.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



177
178
179
180
181
182
183
184
# File 'lib/pact_broker/client/hal/http_client.rb', line 177

def body
  bod = raw_body
  if bod && bod != ''
    JSON.parse(bod)
  else
    nil
  end
end

#header(name) ⇒ Object



190
191
192
# File 'lib/pact_broker/client/hal/http_client.rb', line 190

def header(name)
  __getobj__()[name]
end

#headersObject



186
187
188
# File 'lib/pact_broker/client/hal/http_client.rb', line 186

def headers
  __getobj__().to_hash
end

#raw_bodyObject



194
195
196
# File 'lib/pact_broker/client/hal/http_client.rb', line 194

def raw_body
  __getobj__().body
end

#statusObject



198
199
200
# File 'lib/pact_broker/client/hal/http_client.rb', line 198

def status
  code.to_i
end

#success?Boolean

Returns:

  • (Boolean)


202
203
204
# File 'lib/pact_broker/client/hal/http_client.rb', line 202

def success?
  __getobj__().code.start_with?("2")
end