Class: Restspec::Endpoints::Network::HTTPartyNetworkAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/restspec/endpoints/network.rb

Overview

It uses httparty to make a request.

Instance Method Summary collapse

Instance Method Details

#request(request_object) ⇒ Object

Returns Array of three values representing the status code, the response's headers and the response's body. The first one is a number and the last two are hashes.

Parameters:

Returns:

  • Array of three values representing the status code, the response's headers and the response's body. The first one is a number and the last two are hashes.



53
54
55
56
57
58
59
60
61
62
# File 'lib/restspec/endpoints/network.rb', line 53

def request(request_object)
  response = HTTParty.send(
    request_object.method,
    request_object.url,
    headers: request_object.headers,
    body: request_object.raw_payload
  )

  [response.code, response.headers, response.body]
end