Sha256: ea3723284c4036b6cfa0c4fb83d43ac42fca115c8a6d751a699ecac527f5a293
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
require 'yaml' module MonkeyWrench class Config < MonkeyWrench::Base # Establishes a connection to the Mailchimp API. # # Can be called with either a path to a file containing credentials, or # a hash of credentials. The formats of each are: # # File: # mailchimp: # datacenter: us1 # Or whatever DC you use # apikey: your-api-key-goes-here # Hash: # { :datacenter => "us1", :apikey => "your-api-key-goes-here"} # # @example # MonkeyWrench::Config.new(:datacenter => "us1", # :apikey => "your-api-key-goes-here") # # @param [String, Hash] credentials accepts either a String pointing to a file # containing the credentials, or a hash of credentials. def initialize(credentials) if credentials.is_a?(String) config = YAML.load_file(credentials)["mailchimp"] config.collect_kv!{|k,v| [k.to_sym, v]} else config = credentials end @@apikey = config[:apikey] @@datacenter = config[:datacenter] @@dryrun = config[:dryrun] || false super({}) end end end
Version data entries
5 entries across 5 versions & 2 rubygems