Module: XeroGateway::Http

Included in:
Gateway
Defined in:
lib/xero_gateway/http.rb

Constant Summary collapse

OPEN_TIMEOUT =
10
READ_TIMEOUT =
60
ROOT_CA_FILE =
File.join(File.dirname(__FILE__), 'ca-certificates.crt')

Instance Method Summary collapse

Instance Method Details

#http_get(client, url, extra_params = {}, headers = {}) ⇒ Object



11
12
13
14
# File 'lib/xero_gateway/http.rb', line 11

def http_get(client, url, extra_params = {}, headers = {})
  log "get  | #{url} :: #{extra_params.inspect}"
  http_request(client, :get, url, nil, extra_params, headers)
end

#http_post(client, url, body, extra_params = {}, headers = {}) ⇒ Object



16
17
18
19
# File 'lib/xero_gateway/http.rb', line 16

def http_post(client, url, body, extra_params = {}, headers = {})
  log "post | #{url} :: #{extra_params.inspect}"
  http_request(client, :post, url, body, extra_params, headers)
end

#http_put(client, url, body, extra_params = {}, headers = {}) ⇒ Object



21
22
23
24
# File 'lib/xero_gateway/http.rb', line 21

def http_put(client, url, body, extra_params = {}, headers = {})
  log "put | #{url} :: #{extra_params.inspect}"
  http_request(client, :put, url, body, extra_params, headers)
end

#log(str) ⇒ Object



7
8
9
# File 'lib/xero_gateway/http.rb', line 7

def log(str)
  XeroGateway.log("HTTP : "+str)
end