Module: Klaviyo::ApiOperations

Included in:
Event
Defined in:
lib/klaviyo/event/api_operations.rb

Overview

Instance Method Summary collapse

Instance Method Details

#track(client:, event_name:, customer_properties:, properties: {}, time: nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/klaviyo/event/api_operations.rb', line 4

def track(client:, event_name:,
          customer_properties:,
          properties: {},
          time: nil)


  res = client.conn.get(
    '/api/track',
    client.build_params(
      event: event_name,
      customer_properties: customer_properties,
      properties: properties,
      time: time
    )
  )

  Klaviyo::Event::Result.new(res.body)
end

#track_once(client:, event_name:, customer_properties:, properties: {}, time: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/klaviyo/event/api_operations.rb', line 23

def track_once(client:, event_name:,
               customer_properties:,
               properties: {},
               time: nil)
  res = client.conn.get(
    '/api/track-once',
    client.build_params(
      event: event_name,
      customer_properties: customer_properties,
      properties: properties,
      time: time
    )
  )
  Klaviyo::Event::Result.new(res.body)
end