Class: Chillout::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/chillout/config.rb

Constant Summary collapse

DEFAULT_HOSTNAME =
"api.chillout.io"
DEFAULT_PORT =
443
DEFAULT_NOTIFIER_NAME =
"Chillout"
DEFAULT_NOTIFIER_URL =
"http://github.com/chilloutio/chillout"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil) ⇒ Config

Returns a new instance of Config.



26
27
28
29
30
31
32
33
34
35
# File 'lib/chillout/config.rb', line 26

def initialize(api_key = nil)
  @api_key = api_key
  @hostname = DEFAULT_HOSTNAME
  @port = DEFAULT_PORT
  @notifier_name = DEFAULT_NOTIFIER_NAME
  @notifier_url = DEFAULT_NOTIFIER_URL
  @version = VERSION
  @logger = Logger.new(STDOUT)
  @ssl = true
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



20
21
22
# File 'lib/chillout/config.rb', line 20

def api_key
  @api_key
end

#authentication_passwordObject



47
48
49
# File 'lib/chillout/config.rb', line 47

def authentication_password
  @authentication_password || api_key
end

#authentication_userObject



43
44
45
# File 'lib/chillout/config.rb', line 43

def authentication_user
  @authentication_user || api_key
end

#environmentObject

Returns the value of attribute environment.



13
14
15
# File 'lib/chillout/config.rb', line 13

def environment
  @environment
end

#hostnameObject

Returns the value of attribute hostname.



18
19
20
# File 'lib/chillout/config.rb', line 18

def hostname
  @hostname
end

#loggerObject

Returns the value of attribute logger.



23
24
25
# File 'lib/chillout/config.rb', line 23

def logger
  @logger
end

#notifier_nameObject

Returns the value of attribute notifier_name.



14
15
16
# File 'lib/chillout/config.rb', line 14

def notifier_name
  @notifier_name
end

#notifier_urlObject

Returns the value of attribute notifier_url.



15
16
17
# File 'lib/chillout/config.rb', line 15

def notifier_url
  @notifier_url
end

#platformObject

Returns the value of attribute platform.



17
18
19
# File 'lib/chillout/config.rb', line 17

def platform
  @platform
end

#portObject

Returns the value of attribute port.



19
20
21
# File 'lib/chillout/config.rb', line 19

def port
  @port
end

#sslObject

Returns the value of attribute ssl.



24
25
26
# File 'lib/chillout/config.rb', line 24

def ssl
  @ssl
end

#versionObject

Returns the value of attribute version.



16
17
18
# File 'lib/chillout/config.rb', line 16

def version
  @version
end

Instance Method Details

#to_sObject



51
52
53
54
55
56
57
# File 'lib/chillout/config.rb', line 51

def to_s
  <<-eos
 * hostname: #{hostname}
 * port: #{port}
 * ssl: #{ssl}
  eos
end

#update(options) ⇒ Object



37
38
39
40
41
# File 'lib/chillout/config.rb', line 37

def update(options)
  options.each do |name, value|
    send("#{name}=", value)
  end
end