Class: Zedkit::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_hostObject

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_portObject

Returns the value of attribute api_port.



20
21
22
# File 'lib/zedkit/client/configuration.rb', line 20

def api_port
  @api_port
end

#debugObject

Returns the value of attribute debug.



20
21
22
# File 'lib/zedkit/client/configuration.rb', line 20

def debug
  @debug
end

#exceptionsObject

Returns the value of attribute exceptions.



20
21
22
# File 'lib/zedkit/client/configuration.rb', line 20

def exceptions
  @exceptions
end

#locales_keyObject

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_keyObject

Returns the value of attribute project_key.



20
21
22
# File 'lib/zedkit/client/configuration.rb', line 20

def project_key
  @project_key
end

#sslObject

Returns the value of attribute ssl.



20
21
22
# File 'lib/zedkit/client/configuration.rb', line 20

def ssl
  @ssl
end

#user_keyObject

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_urlObject



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

Returns:

  • (Boolean)


45
46
47
# File 'lib/zedkit/client/configuration.rb', line 45

def debug?
  debug
end

#exceptions?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/zedkit/client/configuration.rb', line 51

def exceptions?
  exceptions
end

#has_locales_key?Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


48
49
50
# File 'lib/zedkit/client/configuration.rb', line 48

def ssl?
  ssl
end