15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/workers/workarea/listrak/subscribe_email_signup.rb', line 15
def perform(id)
signup = Email::Signup.find id
list_id = Listrak.configuration.default_list_id
event_ids = Array.wrap(Listrak.configuration.external_event_ids).to_csv(row_sep: nil).presence
contact = Listrak::Models::ContactForm.new(
email: signup.email,
subscription_state: 'Subscribed'
)
options = {
overrideUnsubscribe: true,
eventIds: event_ids
}.compact
Listrak.email.contacts.upsert list_id, contact, options
end
|