class Slack::Notifier::Config

def defaults new_defaults=nil

def defaults new_defaults=nil
  return @defaults if new_defaults.nil?
  raise ArgumentError, "the defaults must be a Hash" unless new_defaults.is_a?(Hash)
  @defaults = new_defaults
end

def http_client client=nil

def http_client client=nil
  return @http_client if client.nil?
  raise ArgumentError, "the http client must respond to ::post" unless client.respond_to?(:post)
  @http_client = client
end

def initialize

def initialize
  @http_client = Util::HTTPClient
  @defaults    = {}
  @middleware  = %i[
    format_message
    format_attachments
    at
    channels
  ]
end

def middleware *args

def middleware *args
  return @middleware if args.empty?
  @middleware =
    if args.length == 1 && args.first.is_a?(Array) || args.first.is_a?(Hash)
      args.first
    else
      args
    end
end