Sha256: 4a236a5de90a5bf9eb28c96dcf629a0c0ee5f81f597ee0f8cc3e391d9029cf98
Contents?: true
Size: 859 Bytes
Versions: 4
Compression:
Stored size: 859 Bytes
Contents
require 'logger' module Hubspot class Config CONFIG_KEYS = [:hapikey, :base_url, :portal_id, :logger] DEFAULT_LOGGER = Logger.new('/dev/null') class << self attr_accessor *CONFIG_KEYS def configure(config) config.stringify_keys! @hapikey = config["hapikey"] @base_url = config["base_url"] || "https://api.hubapi.com" @portal_id = config["portal_id"] @logger = config['logger'] || DEFAULT_LOGGER self end def reset! @hapikey = nil @base_url = "https://api.hubapi.com" @portal_id = nil @logger = DEFAULT_LOGGER end def ensure!(*params) params.each do |p| raise Hubspot::ConfigurationError.new("'#{p}' not configured") unless instance_variable_get "@#{p}" end end end reset! end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hubspot-ruby-0.4.0 | lib/hubspot/config.rb |
hubspot-ruby-0.3.0 | lib/hubspot/config.rb |
hubspot-ruby-0.2.1 | lib/hubspot/config.rb |
hubspot-ruby-0.2.0 | lib/hubspot/config.rb |