Class: Sekken::HTTPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/sekken/httpclient.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHTTPClient

Returns a new instance of HTTPClient.



6
7
8
# File 'lib/sekken/httpclient.rb', line 6

def initialize
  @client = ::HTTPClient.new
end

Instance Attribute Details

#clientObject (readonly)

Public: Returns the HTTPClient instance to configure.



11
12
13
# File 'lib/sekken/httpclient.rb', line 11

def client
  @client
end

Instance Method Details

#get(url) ⇒ Object

Public: Executes an HTTP GET request to a given url.

Returns the raw HTTP response body as a String.



16
17
18
# File 'lib/sekken/httpclient.rb', line 16

def get(url)
  request(:get, url, {}, nil)
end

#post(url, headers, body) ⇒ Object

Public: Executes an HTTP POST request to a given url with headers and body.

Returns the raw HTTP response body as a String.



23
24
25
# File 'lib/sekken/httpclient.rb', line 23

def post(url, headers, body)
  request(:post, url, headers, body)
end