Class: HttpMailer::MailgunServiceHandler
- Inherits:
-
ServiceHandler
- Object
- ServiceHandler
- HttpMailer::MailgunServiceHandler
- Defined in:
- lib/http_mailer/mailgun/mailgun_service_handler.rb
Instance Attribute Summary collapse
-
#sevice_api ⇒ Object
Returns the value of attribute sevice_api.
Attributes inherited from ServiceHandler
#service_api, #service_configuration
Instance Method Summary collapse
- #configured? ⇒ Boolean
-
#initialize(settings) ⇒ MailgunServiceHandler
constructor
A new instance of MailgunServiceHandler.
- #send_message(from, to, subject, text, from_name = '', to_name = '') ⇒ Object
Constructor Details
#initialize(settings) ⇒ MailgunServiceHandler
Returns a new instance of MailgunServiceHandler.
5 6 7 8 9 10 11 |
# File 'lib/http_mailer/mailgun/mailgun_service_handler.rb', line 5 def initialize(settings) super(settings) @service_api = ::HttpMailer::MailgunServiceApi.new(self.service_configuration.settings.host, self.service_configuration.settings.api_key, self.service_configuration.settings.subdomain ) end |
Instance Attribute Details
#sevice_api ⇒ Object
Returns the value of attribute sevice_api.
3 4 5 |
# File 'lib/http_mailer/mailgun/mailgun_service_handler.rb', line 3 def sevice_api @sevice_api end |
Instance Method Details
#configured? ⇒ Boolean
13 14 15 |
# File 'lib/http_mailer/mailgun/mailgun_service_handler.rb', line 13 def configured? super && !self.service_configuration.settings.subdomain.nil? end |
#send_message(from, to, subject, text, from_name = '', to_name = '') ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/http_mailer/mailgun/mailgun_service_handler.rb', line 17 def (from, to, subject, text, from_name='', to_name='') ::RestClient.post self.service_api., :from => from, :to => to, :subject => subject, :text => text rescue => e puts e.inspect e.response end |