Class: Workarea::Listrak::Models::MessageForm

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/listrak/models/message_form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_email:, from_name:, subject:, **options) ⇒ MessageForm

Returns a new instance of MessageForm.



7
8
9
10
11
12
# File 'app/services/workarea/listrak/models/message_form.rb', line 7

def initialize(from_email:, from_name:, subject:, **options)
  @from_email = from_email
  @from_name = from_name
  @subject = subject
  @options = options.symbolize_keys
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'app/services/workarea/listrak/models/message_form.rb', line 5

def options
  @options
end

Instance Method Details

#body_htmlString

HTML body that will be sent in the message.

Returns:

  • (String)


45
46
47
# File 'app/services/workarea/listrak/models/message_form.rb', line 45

def body_html
  options[:body_html]
end

#body_textString

Text body that will be sent in the message.

Returns:

  • (String)


53
54
55
# File 'app/services/workarea/listrak/models/message_form.rb', line 53

def body_text
  options[:body_text]
end

#campaign_idInteger

Identifier of the campaign associated with the message.

Returns:

  • (Integer)


37
38
39
# File 'app/services/workarea/listrak/models/message_form.rb', line 37

def campaign_id
  options[:campaign_id]
end

#code_pageInteger

Type of CodePage used in the message.

Returns:

  • (Integer)


61
62
63
# File 'app/services/workarea/listrak/models/message_form.rb', line 61

def code_page
  options[:code_page]
end

#enable_passalongBoolean

Whether passalong is enabled.

Returns:

  • (Boolean)


69
70
71
# File 'app/services/workarea/listrak/models/message_form.rb', line 69

def enable_passalong
  options[:enable_passalong]
end

#enable_trackingBoolean

Whether tracking is enabled.

Returns:

  • (Boolean)


77
78
79
# File 'app/services/workarea/listrak/models/message_form.rb', line 77

def enable_tracking
  options[:enable_tracking]
end

#from_emailString

The from email address that will be used for the message.

Returns:

  • (String)


85
86
87
# File 'app/services/workarea/listrak/models/message_form.rb', line 85

def from_email
  @from_email
end

#from_nameString

The from name that will be used for the message.

Returns:

  • (String)


93
94
95
# File 'app/services/workarea/listrak/models/message_form.rb', line 93

def from_name
  @from_name
end

#google_analytics_campaign_contentString

The Google Analytics campaign content to be used for message tracking.

Returns:

  • (String)


109
110
111
# File 'app/services/workarea/listrak/models/message_form.rb', line 109

def google_analytics_campaign_content
  options[:google_analytics_campaign_content]
end

#google_analytics_campaign_nameString

The Google Analytics campaign name to be used for message tracking.

Returns:

  • (String)


101
102
103
# File 'app/services/workarea/listrak/models/message_form.rb', line 101

def google_analytics_campaign_name
  options[:google_analytics_campaign_name]
end

#reply_emailString

The reply email address that will be used for the message.

Returns:

  • (String)


117
118
119
# File 'app/services/workarea/listrak/models/message_form.rb', line 117

def reply_email
  options[:reply_email]
end

#save_audience_idInteger

Identifier of the SavedAudience to use for recipient filtering.

Returns:

  • (Integer)


125
126
127
# File 'app/services/workarea/listrak/models/message_form.rb', line 125

def save_audience_id
  options[:save_audience_id]
end

#subjectString

Subject of the message.

Returns:

  • (String)


133
134
135
# File 'app/services/workarea/listrak/models/message_form.rb', line 133

def subject
  @subject
end

#to_jsonObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/services/workarea/listrak/models/message_form.rb', line 14

def to_json
  {
    campaignId: campaign_id,
    bodyHtml: body_html,
    bodyText: body_text,
    codePage: code_page,
    enablePassalong: enable_passalong,
    enableTracking: enable_tracking,
    fromEmail: from_email,
    fromName: from_name,
    googleAnalyticsCampaignName: google_analytics_campaign_name,
    googleAnalyticsCampaignContent: google_analytics_campaign_content,
    replyEmail: reply_email,
    savedAudienceId: save_audience_id,
    subject: subject,
    toName: to_name
  }.compact.to_json
end

#to_nameString

The to name that will be used for the message.

Returns:

  • (String)


141
142
143
# File 'app/services/workarea/listrak/models/message_form.rb', line 141

def to_name
  options[:to_name]
end