Class: Emarsys::Segment

Inherits:
DataObject show all
Defined in:
lib/emarsys/data_objects/segment.rb

Overview

Methods for the Segment API

Class Method Summary collapse

Methods inherited from DataObject

delete, get, parameterize_params, post, put, #request

Class Method Details

.collection(account: nil) ⇒ Hash

List segments

Examples:

Emarsys::Segment.collection

Returns:

  • (Hash)

    List of segments



15
16
17
# File 'lib/emarsys/data_objects/segment.rb', line 15

def collection(account: nil)
  get , 'filter', {}
end

.run(id, account: nil) ⇒ Object

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

Parameters:

  • id (Integer)

    the id of the segment



23
24
25
26
# File 'lib/emarsys/data_objects/segment.rb', line 23

def run(id, account: nil)
  path = "filter/#{id}/runs"
  post , path, {}
end

.status(run_id, account: nil) ⇒ Object

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

Parameters:

  • run_id (String)

    the id of the segment run, @see #run



32
33
34
35
# File 'lib/emarsys/data_objects/segment.rb', line 32

def status(run_id, account: nil)
  path = "filter/runs/#{run_id}"
  get , path, {}
end