Class: DashamailTransactional::Composer

Inherits:
Object
  • Object
show all
Defined in:
lib/dashamail/composer.rb

Instance Method Summary collapse

Constructor Details

#initializeComposer

Returns a new instance of Composer.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dashamail/composer.rb', line 5

def initialize
  @config = DashaMail.config
  @container = {
    to: nil,
    from_name: @config.from_name,
    from_email: @config.from_email,
    ignore_delivery_policy: @config.ignore_delivery_policy,
    no_track_clicks: @config.no_track_clicks,
    no_track_opens: @config.no_track_opens
  }
end

Instance Method Details

#add_attachment(file_path) ⇒ Object



73
74
75
76
# File 'lib/dashamail/composer.rb', line 73

def add_attachment(file_path)
  @container[:attachments] = [] unless @container.key?(:attachments)
  @container[:attachments].push Utils.build_attachment(file_path)
end

#add_inline(file_path, cid) ⇒ Object



78
79
80
81
# File 'lib/dashamail/composer.rb', line 78

def add_inline(file_path, cid)
  @container[:inline] = [] unless @container.key?(:inline)
  @container[:inline].push Utils.build_inline(file_path, cid)
end

#bcc=(bcc) ⇒ Object



25
26
27
# File 'lib/dashamail/composer.rb', line 25

def bcc=(bcc)
  @container[:bcc] = bcc
end

#callObject



99
100
101
# File 'lib/dashamail/composer.rb', line 99

def call
  @container
end

#campaign_id=(campaign_id) ⇒ Object



95
96
97
# File 'lib/dashamail/composer.rb', line 95

def campaign_id=(campaign_id)
  @container[:campaign_id] = campaign_id
end

#cc=(cc) ⇒ Object



21
22
23
# File 'lib/dashamail/composer.rb', line 21

def cc=(cc)
  @container[:cc] = cc
end

#delivery_time=(delivery_time) ⇒ Object



53
54
55
# File 'lib/dashamail/composer.rb', line 53

def delivery_time=(delivery_time)
  @container[:delivery_time] = delivery_time
end

#domain=(domain) ⇒ Object



61
62
63
# File 'lib/dashamail/composer.rb', line 61

def domain=(domain)
  @container[:domain] = domain
end

#from_email=(from_email) ⇒ Object



29
30
31
# File 'lib/dashamail/composer.rb', line 29

def from_email=(from_email)
  @container[:from_email] = from_email
end

#from_name=(from_name) ⇒ Object



33
34
35
# File 'lib/dashamail/composer.rb', line 33

def from_name=(from_name)
  @container[:from_name] = from_name
end

#headers=(headers) ⇒ Object



65
66
67
# File 'lib/dashamail/composer.rb', line 65

def headers=(headers)
  @container[:headers] = headers
end

#ignore_delivery_policy=(ignore_delivery_policy) ⇒ Object



91
92
93
# File 'lib/dashamail/composer.rb', line 91

def ignore_delivery_policy=(ignore_delivery_policy)
  @container[:ignore_delivery_policy] = ignore_delivery_policy
end

#message=(message) ⇒ Object



41
42
43
# File 'lib/dashamail/composer.rb', line 41

def message=(message)
  @container[:message] = message
end

#message_id=(message_id) ⇒ Object



49
50
51
# File 'lib/dashamail/composer.rb', line 49

def message_id=(message_id)
  @container[:message_id] = message_id
end

#no_track_clicks=(no_track_clicks) ⇒ Object



87
88
89
# File 'lib/dashamail/composer.rb', line 87

def no_track_clicks=(no_track_clicks)
  @container[:no_track_clicks] = no_track_clicks
end

#no_track_opens=(no_track_opens) ⇒ Object



83
84
85
# File 'lib/dashamail/composer.rb', line 83

def no_track_opens=(no_track_opens)
  @container[:no_track_opens] = no_track_opens
end

#plain_text=(plain_text) ⇒ Object



45
46
47
# File 'lib/dashamail/composer.rb', line 45

def plain_text=(plain_text)
  @container[:plain_text] = plain_text
end

#replace=(replace) ⇒ Object



57
58
59
# File 'lib/dashamail/composer.rb', line 57

def replace=(replace)
  @container[:replace] = replace
end

#subject=(subject) ⇒ Object



37
38
39
# File 'lib/dashamail/composer.rb', line 37

def subject=(subject)
  @container[:subject] = subject
end

#template_data=(template_data) ⇒ Object



69
70
71
# File 'lib/dashamail/composer.rb', line 69

def template_data=(template_data)
  @container[:template_data] = template_data
end

#to=(to) ⇒ Object



17
18
19
# File 'lib/dashamail/composer.rb', line 17

def to=(to)
  @container[:to] = to
end