lib/RightScaleAPIHelper.rb in RightScaleAPIHelper-0.4.5 vs lib/RightScaleAPIHelper.rb in RightScaleAPIHelper-0.4.6
- old
+ new
@@ -28,21 +28,24 @@
# Initialize the connection with account information.
# Return an object that can then later be used to make calls
# against the RightScale API without authenticating again.
# Inputs:
# format = xml or js
- # ersion = 1.0 # 1.5 to be supported soon
- def initialize(account, username, password, format = 'js', version = '1.0')
+ # version = 1.0 # 1.5 to be supported soon
+ # verify_ssl = true|false # For windows machines to prevent SSL error from being thrown.
+ def initialize(account, username, password, format = 'js', version = '1.0', verify_ssl = true)
# Set Default Variables
rs_url = "https://my.rightscale.com"
api_url = '/api/acct/'
@api_call = "#{api_url}#{account}"
@full_api_call = "#{rs_url}#{@api_call}"
@format=format
@formatting = "?format=#{format}"
@conn = Net::HTTP.new('my.rightscale.com', 443)
@conn.use_ssl=true
- #@conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ unless verify_ssl
+ @conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ end
if version != '1.0'
raise("Only version 1.0 is supported")
end
req = Net::HTTP::Get.new("#{@full_api_call}/login?api_version=#{version}")