class KlaviyoAPI::Event

Klaviyo has the concept of “timelines” on Metrics. A single entry in that timeline is an Event.

Constants

ORIGINAL_PREFIX

Public Class Methods

collection_path(prefix_options = {}, query_options = {}) click to toggle source
# File lib/klaviyo_api/resources/event.rb, line 19
def collection_path(prefix_options = {}, query_options = {})
  # This needs to support both `metrics/timeline` and `metric/<id>/timeline,
  # through `Event.all` and `Event.all params {metric_id: <id>}`. It gets a
  # little messy.
  if prefix_options.empty?
    self.prefix = '/api/v1/metrics/'
  end

  check_prefix_options(prefix_options)

  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  query_options = query_options.deep_merge({ api_key: headers['api-key'] })

  path = "#{prefix(prefix_options)}#{collection_name}#{format_extension}#{query_string(query_options)}"

  self.prefix = ORIGINAL_PREFIX

  path
end
find_single(scope, options) click to toggle source
# File lib/klaviyo_api/resources/event.rb, line 15
def find_single(scope, options)
  raise KlaviyoAPI::InvalidOperation, 'Cannot get single Event via API. Please use KlaviyoAPI::Event#all.'
end

Public Instance Methods

create() click to toggle source
# File lib/klaviyo_api/resources/event.rb, line 44
def create
  raise KlaviyoAPI::InvalidOperation, 'Cannot create Events via API.'
end
destroy() click to toggle source
# File lib/klaviyo_api/resources/event.rb, line 40
def destroy
  raise KlaviyoAPI::InvalidOperation, 'Cannot delete Events via API.'
end
update() click to toggle source
# File lib/klaviyo_api/resources/event.rb, line 48
def update
  raise KlaviyoAPI::InvalidOperation, 'Cannot update Events via API.'
end