Class: StudioApi::Connection
- Inherits:
-
Object
- Object
- StudioApi::Connection
- Defined in:
- lib/studio_api/connection.rb
Overview
Represents information needed for connection to studio. In common case it is just needed once initialize and then pass it to classes.
Constant Summary collapse
- SSL_ATTRIBUTES =
SSL attributes which can be set into ssl attributes. For more details see openssl library
[ :key, :cert, :ca_file, :ca_path, :verify_mode, :verify_callback, :verify_depth, :cert_store ]
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Represents API key for studio API.
-
#proxy ⇒ Object
readonly
Represents proxy object needed for connection to studio API.
-
#ssl ⇒ Object
readonly
Represents settings for SSL verification in case of uri is https.
-
#timeout ⇒ Object
readonly
Represents timeout for connection in seconds.
-
#uri ⇒ Object
readonly
Represents URI pointing to studio site including path to API.
-
#user ⇒ Object
readonly
Represents login name for studio API.
Instance Method Summary collapse
- #api_version ⇒ Object
-
#initialize(user, password, uri, options = {}) ⇒ Connection
constructor
Creates new object.
Constructor Details
#initialize(user, password, uri, options = {}) ⇒ Connection
Creates new object
61 62 63 64 65 66 67 68 |
# File 'lib/studio_api/connection.rb', line 61 def initialize(user, password, uri, ={}) @user = user @password = password self.uri = uri self.proxy = [:proxy] #nil as default is OK @timeout = ([:timeout] || 45).to_i @ssl = [:ssl] || { :verify_mode => OpenSSL::SSL::VERIFY_NONE } # don't verify as default end |
Instance Attribute Details
#password ⇒ Object (readonly)
Represents API key for studio API
33 34 35 |
# File 'lib/studio_api/connection.rb', line 33 def password @password end |
#proxy ⇒ Object
Represents proxy object needed for connection to studio API. nil represents that no proxy needed
40 41 42 |
# File 'lib/studio_api/connection.rb', line 40 def proxy @proxy end |
#ssl ⇒ Object (readonly)
Represents settings for SSL verification in case of uri is https. It is Hash with keys from SSL_ATTRIBUTES
45 46 47 |
# File 'lib/studio_api/connection.rb', line 45 def ssl @ssl end |
#timeout ⇒ Object (readonly)
Represents timeout for connection in seconds.
42 43 44 |
# File 'lib/studio_api/connection.rb', line 42 def timeout @timeout end |
#uri ⇒ Object
Represents URI pointing to studio site including path to API
37 38 39 |
# File 'lib/studio_api/connection.rb', line 37 def uri @uri end |
#user ⇒ Object (readonly)
Represents login name for studio API
31 32 33 |
# File 'lib/studio_api/connection.rb', line 31 def user @user end |
Instance Method Details
#api_version ⇒ Object
70 71 72 |
# File 'lib/studio_api/connection.rb', line 70 def api_version @version ||= version_detect end |