Class: Emarsys::Export

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

Overview

Methods for the Export API

Class Method Summary collapse

Methods inherited from DataObject

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

Class Method Details

.data(id, offset: nil, limit: nil, account: nil) ⇒ String

Download export data

Examples:

Emarsys::Export.data(2)

Parameters:

  • id (Integer, String)

    The internal emarsys id

  • offset (Hash) (defaults to: nil)

    a customizable set of options

  • limit (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (offset:):

  • Defines (Integer)

    the ID to start listing from

Options Hash (limit:):

  • Defines (Integer)

    how many IDs are listed

Returns:

  • (String)

    text/csv



28
29
30
31
32
33
# File 'lib/emarsys/data_objects/export.rb', line 28

def data(id, offset: nil, limit: nil, account: nil)
  params = {}
  params.merge!(:offset => offset) if offset
  params.merge!(:limit => limit) if limit
  get , "export/#{id}/data", params
end

.filter(filter:, distribution_method:, contact_fields:, account: nil, **params) ⇒ Hash

Export a segment

Examples:

Emarsys::Export.filter(filter: 123, distribution_method: 'local', contact_fields: [1, 3, 106533])

Parameters:

  • filter (Integer)

    The segment ID

  • distribution_method (Hash)

    a customizable set of options

  • contact_fields (Hash)

    a customizable set of options

Options Hash (distribution_method:):

  • ftp, (String)

    sftp, local or mail

Options Hash (contact_fields:):

  • Contact (Array)

    field IDs to export

Returns:

  • (Hash)

    Result data



43
44
45
46
47
48
49
50
# File 'lib/emarsys/data_objects/export.rb', line 43

def filter(filter:, distribution_method:, contact_fields:, account: nil, **params)
  params.merge!(
    filter: filter,
    distribution_method: distribution_method,
    contact_fields: contact_fields
  )
  post , "export/filter", params
end

.resource(id, account: nil) ⇒ Hash

Find a specific export

Examples:

Emarsys::Export.resource(2)

Parameters:

  • id (Integer, String)

    The internal emarsys id

Returns:

  • (Hash)

    Result data



16
17
18
# File 'lib/emarsys/data_objects/export.rb', line 16

def resource(id, account: nil)
  get , "export/#{id}", {}
end