Class: Syntropy::HTTP::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/syntropy/http/client.rb

Overview

HTTP Client class.

Instance Method Summary collapse

Constructor Details

#initialize(machine) ⇒ Client

Returns a new instance of Client.



10
11
12
# File 'lib/syntropy/http/client.rb', line 10

def initialize(machine)
  @machine = machine
end

Instance Method Details

#get(url, **headers) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/syntropy/http/client.rb', line 14

def get(url, **headers, &)
  uri = URI.parse(url)
  headers = headers.merge(
    ':method' => 'GET',
    ':path' => uri.request_uri
  )
  req(uri, **headers, &)
end