Module: Desmos::Configuration

Defined in:
lib/desmos/configuration.rb

Class Method Summary collapse

Class Method Details

.debug_modeObject



60
61
62
# File 'lib/desmos/configuration.rb', line 60

def debug_mode
  @debug_mode || false
end

.debug_mode=(debug_mode) ⇒ Object



55
56
57
# File 'lib/desmos/configuration.rb', line 55

def debug_mode=(debug_mode)
  @debug_mode = debug_mode
end

.domainObject



14
15
16
# File 'lib/desmos/configuration.rb', line 14

def domain
  @domain || raise(ConfigurationError, 'Desmos::Configuration.domain is a required configuration value.')
end

.domain=(domain) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/desmos/configuration.rb', line 4

def domain=(domain)
  @domain = case domain
  when String
    domain.match(/https?\:\/\//) ? ('https://' + domain.split('://')[1]) : 'https://' + domain
  else
    domain
  end
end

.keyObject



40
41
42
# File 'lib/desmos/configuration.rb', line 40

def key
  @key || raise(ConfigurationError, 'Desmos::Configuration.key is a required configuration value.')
end

.key=(key) ⇒ Object



35
36
37
# File 'lib/desmos/configuration.rb', line 35

def key=(key)
  @key = key.nil? ? key : key.to_s
end

.secretObject



50
51
52
# File 'lib/desmos/configuration.rb', line 50

def secret
  @secret || raise(ConfigurationError, 'Desmos::Configuration.secret is a required configuration value.')
end

.secret=(secret) ⇒ Object



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

def secret=(secret)
  @secret = secret
end

.versionObject



30
31
32
# File 'lib/desmos/configuration.rb', line 30

def version
  @version || raise(ConfigurationError, 'Desmos::Configuration.version is a required configuration value.')
end

.version=(version) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/desmos/configuration.rb', line 19

def version=(version)
  @version = case version
  when String, Numeric
    version  = version.to_s
    version.match(/api_v\d+/) ? version : 'api_v' + version.match(/\d+/)[0]
  else
    version
  end
end