Sha256: d252ca4fe3822e89b1ac1b316a209fbd53bc20f3845a8a8cec9a3e953b25b67c

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 Bytes

Contents

module HttpMailer
  class MailgunServiceHandler < ServiceHandler
    attr_accessor :sevice_api

    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

    def configured?
      super && !self.service_configuration.settings.subdomain.nil?
    end

    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

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
http_mailer-1.0.0 lib/http_mailer/mailgun/mailgun_service_handler.rb
http_mailer-0.0.5 lib/http_mailer/mailgun/mailgun_service_handler.rb
http_mailer-0.0.4 lib/http_mailer/mailgun/mailgun_service_handler.rb
http_mailer-0.0.3 lib/http_mailer/mailgun/mailgun_service_handler.rb