Class: Workarea::Listrak::Models::ContactForm

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

Constant Summary collapse

SUBSCRIBED_STATES =
['Subscribed', 'Unsubscribed']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email:, subscription_state: nil, **options) ⇒ ContactForm

Returns a new instance of ContactForm.



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

def initialize(email:, subscription_state: nil, **options)
  @email = email
  @subscription_state = subscription_state.presence_in SUBSCRIBED_STATES
  @options = options
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



6
7
8
# File 'app/services/workarea/listrak/models/contact_form.rb', line 6

def email
  @email
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'app/services/workarea/listrak/models/contact_form.rb', line 6

def options
  @options
end

#subscription_stateObject (readonly)

Returns the value of attribute subscription_state.



6
7
8
# File 'app/services/workarea/listrak/models/contact_form.rb', line 6

def subscription_state
  @subscription_state
end

Instance Method Details

#to_jsonObject



14
15
16
17
18
19
20
# File 'app/services/workarea/listrak/models/contact_form.rb', line 14

def to_json
  {
    emailAddress: email,
    subscriptionState: subscription_state,
    segmentationFieldValues: nil
  }.to_json
end