class VerizonApi::Config

Public Class Methods

[](key) click to toggle source
# File lib/verizon_api/config.rb, line 23
def self.[](key)
  return nil unless @config
  @config[key]
end
include?(key) click to toggle source
# File lib/verizon_api/config.rb, line 19
def self.include?(key)
  @config.include?(key)
end
load(source) click to toggle source
# File lib/verizon_api/config.rb, line 2
def self.load(source)
  @config = {
    :api_host           => 'api.edgecast.com',
    :api_token          => nil,
  }

  if source.is_a?(String)
    raise "Config file #{source} not found" unless File.exist?(source)

    config = YAML.load_file(source)
    @config.merge! config if config

  elsif source.is_a?(Hash)
    @config.merge! source
  end
end
to_yaml() click to toggle source
# File lib/verizon_api/config.rb, line 28
def self.to_yaml
  return nil unless @config
  @config.to_yaml
end