class StreamData::Config

Constants

ALLOWED_SERVICE_TYPES

Public Class Methods

read_config() click to toggle source
# File lib/config.rb, line 6
def self.read_config
        @config = YAML.load_file('lib/stream_config.yml')
end
validate_config() click to toggle source
# File lib/config.rb, line 12
def self.validate_config
        begin
                @config["type_of_service"] || raise(StandardError.new('Specify the servcie type'))
                @config["service_key"] || raise(StandardError.new('Service Key is missing, please specify in config'))
                @config["service_secret"] || raise(StandardError.new('Service Secret is missing, please specify in config'))
                @config["delivery_stream_name"] || raise(StandardError.new('Delivery Stream Name is missing, please specify in config'))
                @config["region"] || raise(StandardError.new('Specify the Region'))
                raise(StandardError.new('This type of servcie is not supported')) unless ALLOWED_SERVICE_TYPES.include?(@config["type_of_service"])
        rescue Exception => e
                raise(StandardError.new("Not a valid config, #{e.message}"))
        end
end