6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/syllabs-api/http_processor.rb', line 6
def self.post(api_key, api_url, params)
raise Exceptions::InvalidKey if api_key.nil?
= {'Api-Key' => api_key}
api_uri = URI.parse(api_url)
http_response = nil
Timeout::timeout(TIMEOUT) do
http = Net::HTTP.new(api_uri.host, api_uri.port)
post = Net::HTTP::Post.new(api_uri.request_uri, )
post.set_form_data(params)
http_response = http.request post
end
return http_response
rescue Exception => e
raise e
end
|