Sha256: 194fffa0cb0deb2cfe531aeaac202ae3338a058636d7a807cec4071afcbbceea

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

require 'logger'
require 'chillout/version'


module Chillout
  class Config

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

    attr_accessor :environment
    attr_accessor :notifier_name
    attr_accessor :notifier_url
    attr_accessor :version
    attr_accessor :platform
    attr_accessor :hostname
    attr_accessor :port
    attr_accessor :api_key
    attr_writer   :authentication_user
    attr_writer   :authentication_password
    attr_accessor :logger
    attr_accessor :ssl

    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

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

    def authentication_user
      @authentication_user || api_key
    end

    def authentication_password
      @authentication_password || api_key
    end

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

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
chillout-0.6.0 lib/chillout/config.rb
chillout-0.5.4 lib/chillout/config.rb
chillout-0.5.3 lib/chillout/config.rb
chillout-0.5.2 lib/chillout/config.rb
chillout-0.5.1 lib/chillout/config.rb
chillout-0.5.0 lib/chillout/config.rb
chillout-0.4.1 lib/chillout/config.rb
chillout-0.4.0 lib/chillout/config.rb