Sha256: 6d86060530a151937483ecabddb10eea8d37166125a8b574b43b30704e33e003

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

module LoopsSdk
  class Events < Base
    class << self
      def send(event_name:, email: nil, user_id: nil, contact_properties: {}, event_properties: {}, mailing_lists: {})
        raise ArgumentError, "You must provide an email or user_id value." if email.nil? && user_id.nil?

        event_data = {
          email: email,
          userId: user_id,
          eventName: event_name,
          eventProperties: event_properties.compact,
          mailingLists: mailing_lists.compact
        }.merge(contact_properties)
        make_request(:post, "v1/events/send", {}, event_data)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loops_sdk-0.2.0 lib/loops_sdk/events.rb
loops_sdk-0.1.2 lib/loops_sdk/events.rb