Class: Grenache::Http::HttpClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/grenache/http/http_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HttpClient

Returns a new instance of HttpClient.



6
7
8
# File 'lib/grenache/http/http_client.rb', line 6

def initialize config
  @config = config
end

Instance Method Details

#request(uri, body, params = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/grenache/http/http_client.rb', line 10

def request uri, body, params = {}
  options = {body: body}

  if params[:timeout]
    options[:timeout] = params[:timeout]
  else
    options[:timeout] = timeout if timeout
  end

  if tls?
    options[:pem]         = pem
    options[:ssl_ca_file] = ssl_ca_file
  end

  self.class.post uri, options
end