lib/mailgun/client.rb in mailgun-ruby-1.2.6 vs lib/mailgun/client.rb in mailgun-ruby-1.2.7
- old
+ new
@@ -9,16 +9,16 @@
#
# See the Github documentation for full examples.
class Client
def initialize(api_key = Mailgun.api_key,
- api_host = 'api.mailgun.net',
- api_version = 'v3',
+ api_host = Mailgun.api_host || 'api.mailgun.net',
+ api_version = Mailgun.api_version || 'v3',
ssl = true,
test_mode = false,
timeout = nil,
- proxy_url = nil)
+ proxy_url = Mailgun.proxy_url)
rest_client_params = {
user: 'api',
password: api_key,
user_agent: "mailgun-sdk-ruby/#{Mailgun::VERSION}"
@@ -41,9 +41,14 @@
# Disable test mode
#
# Reverts the test_mode flag and allows the client to send messages.
def disable_test_mode!
@test_mode = false
+ end
+
+ # Change API key
+ def set_api_key(api_key)
+ @http_client.options[:password] = api_key
end
# Client is in test mode?
#
# @return [Boolean] Is the client set in test mode?