lib/nds_api/http.rb in nds_api-0.1.17 vs lib/nds_api/http.rb in nds_api-0.1.18
- old
+ new
@@ -31,12 +31,13 @@
req = http_verb_object(post_or_put).new(
url,
'Content-Type' => 'application/json'
)
req.basic_auth api_user, api_password
- req.use_ssl = true
req.body = data.to_json
- response = Net::HTTP.new(url.host, url.port).request(req)
+ http = Net::HTTP.new(url.host, url.port)
+ http.use_ssl = true
+ response = http.request(req)
JSON.parse(response.body)
rescue StandardError => error
puts "NDS API ERROR: #{error} (#{post_or_put}:#{url})"
raise e
end