3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/kount/request.rb', line 3
def transmit(service_type,endpoint_url,get_or_post,query_params={})
url = [Kount::KOUNT_SERVER_URLS[service_type][Kount.mode],endpoint_url].join
Rails.logger.info ["Kount request: ",url].join if defined?(Rails)
c = Curl::Easy.new(url) do |curl|
curl.certtype = 'PEM'
if service_type == :api
curl.cert = Kount.api_cert
curl.cert_key = Kount.api_cert_key
elsif service_type == :risk
curl.cert = Kount.ris_cert
curl.cert_key = Kount.ris_cert_key
end
curl.connect_timeout = 5
end
if get_or_post.downcase == 'get'
c.http_get
elsif get_or_post.downcase == 'post'
c.http_post(get_post_fields(query_params))
end
Kount::Response.new(service_type,c)
rescue Exception => e
Kount::Error.new(e)
end
|