class HttpMailer::MailgunServiceHandler

Attributes

sevice_api[RW]

Public Class Methods

new(settings) click to toggle source
Calls superclass method
# 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

Public Instance Methods

configured?() click to toggle source
Calls superclass method
# 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='') click to toggle source
# File lib/http_mailer/mailgun/mailgun_service_handler.rb, line 17
def send_message(from, to, subject, text, from_name='', to_name='')
  ::RestClient.post self.service_api.send_messages_url,
    :from => from,
    :to => to,
    :subject => subject,
    :text => text
rescue => e
  puts e.inspect
  e.response
end