class Emarsys::Segment

Methods for the Segment API

Public Class Methods

collection(account: nil) click to toggle source

List segments

@return [Hash] List of segments @example

Emarsys::Segment.collection
# File lib/emarsys/data_objects/segment.rb, line 15
def collection(account: nil)
  get account, 'filter', {}
end
run(id, account: nil) click to toggle source

Run a Segment for Multiple Contacts Reference: dev.emarsys.com/v2/segments/run-a-contact-segment-batch

@param id [Integer] the id of the segment

# File lib/emarsys/data_objects/segment.rb, line 23
def run(id, account: nil)
  path = "filter/#{id}/runs"
  post account, path, {}
end
status(run_id, account: nil) click to toggle source

Poll the Status of a Segment Run for Multiple Contacts Reference: dev.emarsys.com/v2/segments/poll-the-status-of-a-segment-run-for-multiple-contacts

@param run_id [String] the id of the segment run, @see run

# File lib/emarsys/data_objects/segment.rb, line 32
def status(run_id, account: nil)
  path = "filter/runs/#{run_id}"
  get account, path, {}
end