Module: SendhubMethods

Included in:
ActionMailer::Base
Defined in:
lib/sendhub/rails2.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



20
21
22
23
24
25
# File 'lib/sendhub/rails2.rb', line 20

def self.included(base)
  base.extend(ClassMethods)
  base.class_eval do
    alias_method_chain :create_mail, :tag
  end
end

Instance Method Details

#create_mail_with_tagObject



27
28
29
30
31
# File 'lib/sendhub/rails2.rb', line 27

def create_mail_with_tag
  returning create_mail_without_tag do |mail|
    mail.tag = @tag if @tag
  end
end

#perform_delivery_sendhub(message) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/sendhub/rails2.rb', line 2

def perform_delivery_sendhub(message)
  client = Sendhub::Client.new(
    :api_key => SENDHUB_API_KEY,
    :secret_key => SENDHUB_SECRET_KEY
  )
  res = client.send_email(
    :from => message.from,
    :to => message.to,
    :subject => message.subject,
    :body => message.body,
    :content_type => message.content_type
  )
end

#tag(value) ⇒ Object



16
17
18
# File 'lib/sendhub/rails2.rb', line 16

def tag(value)
  @tag = value
end