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 = '') ⇒ Config

Returns a new instance of Config.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/chillout/config.rb', line 30

def initialize(api_key = '')
  self.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
  @strategy = :thread
  @max_queue = 5_000
  @creations_tracking = true
  @requests_tracking = true

  @authentication_user = nil
  @authentication_password = nil
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



80
81
82
# File 'lib/chillout/config.rb', line 80

def authentication_password
  @authentication_password || api_key
end

#authentication_userObject



76
77
78
# File 'lib/chillout/config.rb', line 76

def authentication_user
  @authentication_user || api_key
end

#creations_trackingObject

Returns the value of attribute creations_tracking.



27
28
29
# File 'lib/chillout/config.rb', line 27

def creations_tracking
  @creations_tracking
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

#max_queueObject

Returns the value of attribute max_queue.



26
27
28
# File 'lib/chillout/config.rb', line 26

def max_queue
  @max_queue
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

#requests_trackingObject

Returns the value of attribute requests_tracking.



28
29
30
# File 'lib/chillout/config.rb', line 28

def requests_tracking
  @requests_tracking
end

#sslObject

Returns the value of attribute ssl.



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

def ssl
  @ssl
end

#strategyObject

Returns the value of attribute strategy.



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

def strategy
  @strategy
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

#secret=(value) ⇒ Object



62
63
64
# File 'lib/chillout/config.rb', line 62

def secret=(value)
  self.api_key = value
end

#to_sObject



84
85
86
87
88
89
90
# File 'lib/chillout/config.rb', line 84

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

#update(options) ⇒ Object



48
49
50
51
52
# File 'lib/chillout/config.rb', line 48

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