Class: Mailgun::Client
- Inherits:
-
Object
- Object
- Mailgun::Client
- Defined in:
- lib/mailgun/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
Instance Method Summary collapse
- #api_url ⇒ Object
-
#initialize(api_key, domain) ⇒ Client
constructor
A new instance of Client.
- #mailgun_url ⇒ Object
- #send_message(options) ⇒ Object
Constructor Details
#initialize(api_key, domain) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/mailgun/client.rb', line 8 def initialize(api_key, domain) @api_key = api_key @domain = domain end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/mailgun/client.rb', line 6 def api_key @api_key end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
6 7 8 |
# File 'lib/mailgun/client.rb', line 6 def domain @domain end |
Instance Method Details
#api_url ⇒ Object
21 22 23 |
# File 'lib/mailgun/client.rb', line 21 def api_url "https://api:#{api_key}@api.mailgun.net/v3/#{domain}" end |
#mailgun_url ⇒ Object
17 18 19 |
# File 'lib/mailgun/client.rb', line 17 def mailgun_url api_url+"/messages" end |
#send_message(options) ⇒ Object
13 14 15 |
# File 'lib/mailgun/client.rb', line 13 def () RestClient.post mailgun_url, end |