Class: Zedkit::Configuration
- Inherits:
-
Object
- Object
- Zedkit::Configuration
- Defined in:
- lib/zedkit/client/configuration.rb
Constant Summary collapse
- API_HOSTNAME =
"api.zedapi.com"
- API_PORT =
80
- PROJECT_KEY_LENGTH =
18
- LOCALES_KEY_LENGTH =
18
Instance Attribute Summary collapse
-
#api_host ⇒ Object
Returns the value of attribute api_host.
-
#api_port ⇒ Object
Returns the value of attribute api_port.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#exceptions ⇒ Object
Returns the value of attribute exceptions.
-
#locales_key ⇒ Object
Returns the value of attribute locales_key.
-
#project_key ⇒ Object
Returns the value of attribute project_key.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#user_key ⇒ Object
Returns the value of attribute user_key.
Instance Method Summary collapse
- #api_url ⇒ Object
- #debug? ⇒ Boolean
- #exceptions? ⇒ Boolean
- #has_locales_key? ⇒ Boolean
- #has_project_key? ⇒ Boolean
- #has_user_key? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #ssl? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 |
# File 'lib/zedkit/client/configuration.rb', line 27 def initialize @project_key, @user_key, @locales_key = nil, nil, nil @debug = false @ssl = false @exceptions = false @api_host, @api_port = API_HOSTNAME, API_PORT end |
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def api_host @api_host end |
#api_port ⇒ Object
Returns the value of attribute api_port.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def api_port @api_port end |
#debug ⇒ Object
Returns the value of attribute debug.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def debug @debug end |
#exceptions ⇒ Object
Returns the value of attribute exceptions.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def exceptions @exceptions end |
#locales_key ⇒ Object
Returns the value of attribute locales_key.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def locales_key @locales_key end |
#project_key ⇒ Object
Returns the value of attribute project_key.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def project_key @project_key end |
#ssl ⇒ Object
Returns the value of attribute ssl.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def ssl @ssl end |
#user_key ⇒ Object
Returns the value of attribute user_key.
20 21 22 |
# File 'lib/zedkit/client/configuration.rb', line 20 def user_key @user_key end |
Instance Method Details
#api_url ⇒ Object
55 56 57 |
# File 'lib/zedkit/client/configuration.rb', line 55 def api_url ssl? ? "https://#{api_host}:#{api_port}" : "http://#{api_host}:#{api_port}" end |
#debug? ⇒ Boolean
45 46 47 |
# File 'lib/zedkit/client/configuration.rb', line 45 def debug? debug end |
#exceptions? ⇒ Boolean
51 52 53 |
# File 'lib/zedkit/client/configuration.rb', line 51 def exceptions? exceptions end |
#has_locales_key? ⇒ Boolean
41 42 43 |
# File 'lib/zedkit/client/configuration.rb', line 41 def has_locales_key? (not locales_key.nil?) && locales_key.is_a?(String) && locales_key.length == LOCALES_KEY_LENGTH end |
#has_project_key? ⇒ Boolean
35 36 37 |
# File 'lib/zedkit/client/configuration.rb', line 35 def has_project_key? (not project_key.nil?) && project_key.is_a?(String) && project_key.length == PROJECT_KEY_LENGTH end |
#has_user_key? ⇒ Boolean
38 39 40 |
# File 'lib/zedkit/client/configuration.rb', line 38 def has_user_key? (not user_key.nil?) && user_key.is_a?(String) end |
#ssl? ⇒ Boolean
48 49 50 |
# File 'lib/zedkit/client/configuration.rb', line 48 def ssl? ssl end |