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



181
182
183
184
185
186
187
188
# File 'lib/pact_broker/client/hal/http_client.rb', line 181

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

#header(name) ⇒ Object



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

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

#headersObject



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

def headers
  __getobj__().to_hash
end

#raw_bodyObject



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

def raw_body
  __getobj__().body
end

#statusObject



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

def status
  code.to_i
end

#success?Boolean

Returns:

  • (Boolean)


206
207
208
# File 'lib/pact_broker/client/hal/http_client.rb', line 206

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