lib/testingbot/api.rb in testingbot-0.1.5 vs lib/testingbot/api.rb in testingbot-0.1.6
- old
+ new
@@ -51,11 +51,11 @@
def get(url)
uri = URI(API_URL + '/v' + VERSION.to_s + url)
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth @config[:client_key], @config[:client_secret]
- res = Net::HTTP.start(uri.host, uri.port) {|http|
+ res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) {|http|
http.request(req)
}
parsed = JSON.parse(res.body)
@@ -69,11 +69,11 @@
def put(url, params = {})
uri = URI(API_URL + '/v' + VERSION.to_s + url)
req = Net::HTTP::Put.new(uri.request_uri)
req.basic_auth @config[:client_key], @config[:client_secret]
req.set_form_data(params)
- res = Net::HTTP.start(uri.host, uri.port) {|http|
+ res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) {|http|
http.request(req)
}
parsed = JSON.parse(res.body)
@@ -87,11 +87,11 @@
def delete(url, params = {})
uri = URI(API_URL + '/v' + VERSION.to_s + url)
req = Net::HTTP::Delete.new(uri.request_uri)
req.basic_auth @config[:client_key], @config[:client_secret]
req.set_form_data(params)
- res = Net::HTTP.start(uri.host, uri.port) {|http|
+ res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) {|http|
http.request(req)
}
parsed = JSON.parse(res.body)
@@ -103,9 +103,10 @@
end
def post(url, params = {})
url = URI.parse(API_URL + '/v' + VERSION + url)
http = Net::HTTP.new(url.host, url.port)
+ http.use_ssl = true
http.basic_auth @config[:client_key], @config[:client_secret]
response = http.post(url.path, params.map { |k, v| "#{k.to_s}=#{v}" }.join("&"))
end
end
end