-
-
Save gschneider-r7/8f471638b023a240dcae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Nexpose | |
class APIRequest | |
include XMLUtils | |
# Execute an API request (5th param used for gem version 5.3.0+) | |
def self.execute(url, req, api_version='1.1', options = {}, trust_store = nil) | |
options = {timeout: 6000000} | |
obj = self.new(req.to_s, url, api_version, trust_store) | |
obj.execute(options) | |
return obj | |
end | |
end | |
module AJAX | |
def self.https(nsc, timeout = nil) | |
http = Net::HTTP.new(nsc.host, nsc.port) | |
http.use_ssl = true | |
# changes for gem version 5.3.0+ | |
if nsc.trust_store.nil? | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
else | |
http.cert_store = nsc.trust_store | |
end | |
http.read_timeout = 6000000 | |
http.open_timeout = 6000000 | |
http.continue_timeout = 6000000 | |
http | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment