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



119
120
121
122
123
124
125
126
# File 'lib/pact_broker/client/hal/http_client.rb', line 119

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

#headersObject



128
129
130
# File 'lib/pact_broker/client/hal/http_client.rb', line 128

def headers
  __getobj__().to_hash
end

#raw_bodyObject



132
133
134
# File 'lib/pact_broker/client/hal/http_client.rb', line 132

def raw_body
  __getobj__().body
end

#statusObject



136
137
138
# File 'lib/pact_broker/client/hal/http_client.rb', line 136

def status
  code.to_i
end

#success?Boolean

Returns:

  • (Boolean)


140
141
142
# File 'lib/pact_broker/client/hal/http_client.rb', line 140

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