Class: Grenache::Http::HttpClient
- Inherits:
-
Object
- Object
- Grenache::Http::HttpClient
- Includes:
- HTTParty
- Defined in:
- lib/grenache/http/http_client.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #request(uri, body, params = {}) ⇒ Object
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 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/grenache/http/http_client.rb', line 10 def request uri, body, params = {} uri = URI.parse(uri) = {body: body} if params[:timeout] [:timeout] = params[:timeout] else [:timeout] = timeout if timeout end if pem? or p12? uri.scheme = "https" end if pem? [:pem] = pem [:pem_password] = @config.cert_pem_password [:ssl_ca_file] = ssl_ca_file elsif p12? [:p12] = IO.binread @config.cert_p12 [:p12_password] = @config.cert_p12_password [:ssl_ca_file] = ssl_ca_file end self.class.post uri.to_s, end |