Represents information needed for connection to studio. In common case it is just needed once initialize and then pass it to classes.
SSL attributes which can be set into ssl attributes. For more details see openssl library
Represents API key for studio API
Represents proxy object needed for connection to studio API. nil represents that no proxy needed
Represents settings for SSL verification in case of uri is https. It is Hash with keys from SSL_ATTRIBUTES
Represents timeout for connection in seconds.
Represents URI pointing to studio site including path to API @example
connection.uri == URI.parse "http://susestudio.com/api/v1/user/"
Represents login name for studio API
Creates new object @example
StudioApi::Connection.new "user","pwd","https://susestudio.com//api/v1/user/", :timeout => 120, :proxy => "http://user:pwd@proxy", :ssl => { :verify_mode => OpenSSL::SSL::VERIFY_PEER, :ca_path => "/etc/studio.cert"}
@param [String] user login to studio API @param (String) password API key for studio @param (String,URI) uri pointing to studio site including path to api @param (Hash) options hash of additional options. Represents other attributes. @option options [URI,String] :proxy (nil) see proxy attribute @option options [String, Fixnum] :timeout (45) see timeout attribute. Specified in seconds @option options [Hash] :ssl ( {:verify_mode = OpenSSL::SSL::VERIFY_NONE}) see ssl attribute
# File lib/studio_api/connection.rb, line 61 def initialize(user, password, uri, options={}) @user = user @password = password self.uri = uri self.proxy = options[:proxy] #nil as default is OK @timeout = (options[:timeout] || 45).to_i @ssl = options[:ssl] || { :verify_mode => OpenSSL::SSL::VERIFY_NONE } # don't verify as default end
# File lib/studio_api/connection.rb, line 70 def api_version @version ||= version_detect end
Overwritte proxy object. @param (String,URI,nil) value new proxy to site. If String is passed then it is parsed by URI.parse, which can throw exception. If nil is passed then it means disable proxy.
# File lib/studio_api/connection.rb, line 87 def proxy=(value) if value.is_a? String @proxy = URI.parse value else @proxy = value end end
Overwritte uri object. @param (String,URI) value new uri to site. If String is passed then it is parsed by URI.parse, which can throw exception
# File lib/studio_api/connection.rb, line 77 def uri=(value) if value.is_a? String @uri = URI.parse value else @uri = value end end