lib/stripe_tester.rb in stripe_tester-0.3.3 vs lib/stripe_tester.rb in stripe_tester-0.4.0
- old
+ new
@@ -65,21 +65,22 @@
req.content_type = 'application/json'
req.body = data.to_json
http_object = Net::HTTP.new(post_url.hostname, post_url.port)
http_object.use_ssl = true if post_url.scheme == 'https'
+ http_object.verify_mode = OpenSSL::SSL::VERIFY_NONE if (!verify_ssl? && http_object.use_ssl?)
# send request
res = http_object.start do |http|
http.request(req)
end
case res
- when Net::HTTPSuccess, Net::HTTPRedirection
- true
- else
- res.value
+ when Net::HTTPSuccess, Net::HTTPRedirection
+ true
+ else
+ res.value
end
else
raise "Could not post to URL. Please set URL."
end
end
@@ -129,6 +130,15 @@
end
def self.stripe_version
@version ? @version : LATEST_STRIPE_VERSION
end
+
+ def self.verify_ssl=(verify)
+ @verify_ssl = verify
+ end
+
+ def self.verify_ssl?
+ !@verify_ssl.nil? ? @verify_ssl : true
+ end
+
end