lib/telephone_appointments/api.rb in telephone_appointments-0.1.0 vs lib/telephone_appointments/api.rb in telephone_appointments-0.1.1
- old
+ new
@@ -1,16 +1,19 @@
require 'open-uri'
module TelephoneAppointments
class Api
+ SSL_PORT = 443
+
def post(path, form_data)
uri = URI.parse("#{api_uri}#{path}")
http = Net::HTTP.new(uri.host, uri.port)
http.read_timeout = read_timeout
+ http.use_ssl = true if uri.port == SSL_PORT
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.set_form_data(form_data)
- Response.new(http.request(request))
+ TelephoneAppointments::Response.new(http.request(request))
end
private
def headers