mailgun/mailgun-ruby

Use config block in Mailgun::Client

Closed this issue · 1 comments

Currently, the only thing from the config block passed to the client is the api_key. Other settings such a test_mode, domain, etc. are not populated in Mailgun::Client. Is there a specific reason we are not passing these as the defaults for Mailgun::Client?

module Mailgun
  class Client

    def initialize(api_key = Mailgun.api_key,
                   api_host = 'api.mailgun.net',
                   api_version = 'v3',
                   ssl = true,
                   test_mode = false,
                   timeout = nil,
                   proxy_url = nil)

Why not something like the following so we can override the defaults?

module Mailgun
  class Client

    def initialize(api_key = Mailgun.api_key,
                   api_host = Mailgun.api_host || 'api.mailgun.net',
                   api_version = Mailgun.api_version  || 'v3',
                   test_mode = Mailgun.test_mode || false,
                   etc...)