Sha256: 67aece8d7bb636d3c07038e24bcb10e9eb5b92da63ebbff8e86723102c0b34f0

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

module Workarea
  module Listrak
    module Models
      class ContactForm
        SUBSCRIBED_STATES = ['Subscribed', 'Unsubscribed']
        attr_reader :email, :subscription_state, :options

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-listrak-5.0.4 app/services/workarea/listrak/models/contact_form.rb
workarea-listrak-5.0.3 app/services/workarea/listrak/models/contact_form.rb
workarea-listrak-5.0.2 app/services/workarea/listrak/models/contact_form.rb
workarea-listrak-5.0.1 app/services/workarea/listrak/models/contact_form.rb