Class: Howitzer::MailgunApi::Connector
- Inherits:
-
Object
- Object
- Howitzer::MailgunApi::Connector
- Includes:
- Singleton
- Defined in:
- lib/howitzer/mailgun_api/connector.rb
Overview
This class represent connector to Mailgun service
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#domain ⇒ Object
Returns the value of attribute domain.
Instance Method Summary collapse
-
#client(api_key = Howitzer.mailgun_key) ⇒ Client
A mailgun client.
-
#initialize ⇒ Connector
constructor
Assigns default value for a domain.
Constructor Details
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/howitzer/mailgun_api/connector.rb', line 11 def api_key @api_key end |
#domain ⇒ Object
Returns the value of attribute domain.
12 13 14 |
# File 'lib/howitzer/mailgun_api/connector.rb', line 12 def domain @domain end |
Instance Method Details
#client(api_key = Howitzer.mailgun_key) ⇒ Client
Returns a mailgun client.
23 24 25 26 27 28 29 |
# File 'lib/howitzer/mailgun_api/connector.rb', line 23 def client(api_key = Howitzer.mailgun_key) check_api_key(api_key) return @client if @api_key == api_key && @api_key @api_key = api_key @client = Client.new(api_key: @api_key) end |