class MailchimpMarketing::Configuration

def self.default

The default Configuration object.
def self.default
  @@default ||= Configuration.new
end

def api_key_with_prefix(param_name)

Parameters:
  • param_name (String) -- the parameter name of API key auth
def api_key_with_prefix(param_name)
  if @api_key_prefix[param_name]
    "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
  else
    @api_key[param_name]
  end
end

def auth_settings

Returns Auth Settings hash for api client.
def auth_settings
  {
    'basicAuth' =>
      {
        type: 'basic',
        in: 'header',
        key: 'Authorization',
        value: basic_auth_token
      },
  }
end

def base_path=(base_path)

def base_path=(base_path)
  # Add leading and trailing slashes to base_path
  @base_path = "/#{base_path}".gsub(/\/+/, '/')
  @base_path = '' if @base_path == '/'
end

def base_url

def base_url
  url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
  URI.encode(url)
end

def basic_auth_token

Gets Basic Auth token string
def basic_auth_token
  'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
end

def configure

def configure
  yield(self) if block_given?
end

def host=(host)

def host=(host)
  # remove http(s):// and anything after a slash
  @host = host.sub(/https?:\/\//, '').split('/').first
end

def initialize

def initialize
  @scheme = 'https'
  @host = 'server.api.mailchimp.com'
  @base_path = '/3.0'
  @api_key = {}
  @api_key_prefix = {}
  @timeout = 0
  @client_side_validation = true
  @verify_ssl = true
  @verify_ssl_host = true
  @params_encoding = nil
  @cert_file = nil
  @key_file = nil
  @debugging = false
  @inject_format = false
  @force_ending_format = false
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
  yield(self) if block_given?
end

def scheme=(scheme)

def scheme=(scheme)
  # remove :// from scheme
  @scheme = scheme.sub(/:\/\//, '')
end