Class: MailBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/extensions/mailbuilder.rb

Instance Method Summary collapse

Instance Method Details

#description(a_description) ⇒ Object



19
20
21
22
# File 'lib/sinatra/extensions/mailbuilder.rb', line 19

def description(a_description)
  @description = a_description
  return self
end

#from(sender) ⇒ Object



9
10
11
12
# File 'lib/sinatra/extensions/mailbuilder.rb', line 9

def from(sender)
  @from = "#{sender.hxt_id}@hexacta.com"
  return self
end


24
25
26
27
# File 'lib/sinatra/extensions/mailbuilder.rb', line 24

def link(a_link)
  @link = a_link
  return self
end

#sendObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/sinatra/extensions/mailbuilder.rb', line 29

def send
  @from ||= "[email protected]"
  if @link.nil?
    GeneralMailNoLink.new({ :to => @to,
                      :from => @from,
                      :subject => @subject,
                      :description => @description
                    }).send
  else
    GeneralMail.new({ :to => @to,
                      :from => @from,
                      :subject => @subject,
                      :description => @description,
                      :link => @link
                    }).send

  end
end

#subject(a_subject) ⇒ Object



14
15
16
17
# File 'lib/sinatra/extensions/mailbuilder.rb', line 14

def subject(a_subject)
  @subject = a_subject
  return self
end

#to(receivers) ⇒ Object



4
5
6
7
# File 'lib/sinatra/extensions/mailbuilder.rb', line 4

def to(receivers)
  @to = receivers
  return self
end