module Selligent::Client::Lists

Implements the list endpoints

In this module, `list_name` is the list name as it appears in the API urls.

/organizations/:organization/lists/*

Public Instance Methods

create_fields(list_name, model) click to toggle source

Create list fields

The model has the following shape:

{

"fields": [
  {
    "name": "string",
    "data_type": "Boolean",
    "length": 0,
    "description": "string",
    "allow_null": true
  }
]

}

@param list_name [String] The list API name @param model [Hash] The model containing the data that should be sent

# File lib/selligent/client/lists.rb, line 117
def create_fields(list_name, model)
  post "#{base_url}/lists/#{list_name}/fields", model
end
create_list(model) click to toggle source

Create a new list

The model has the following shape:

{

"api_name": "list_name_in_api",
"name": "list_name",
"type": "Userlist",
"description": "description",
"tags": [
  "tag1",
  "tag2"
]

}

@param model [Hash] The model containing the data that should be sent

# File lib/selligent/client/lists.rb, line 38
def create_list(model)
  post "#{base_url}/lists", model
end
create_relation(list_name, model) click to toggle source

Create a relation between two lists

The model has the following shape:

{

"relations": [
  {
    "scope": "string",
    "type": "OneToOne",
    "masterlist_field_name": "string",
    "slavelist_api_name": "string",
    "slavelist_field_name": "string",
    "constraints": [
      {
        "list1": "string",
        "field1": "string",
        "operator": "Unknown",
        "list2": "string",
        "field2": "string",
        "value": "string"
      }
    ]
  }
]

}

@param list_name [String] The list API name @param model [Hash] The model containing the data that should be sent

# File lib/selligent/client/lists.rb, line 195
def create_relation(list_name, model)
  post "#{base_url}/lists/#{list_name}/relations", model
end
delete_field(list_name, field_name) click to toggle source

Delete a list field

@param list_name [String] The list API name @param field_name [String] The field name

# File lib/selligent/client/lists.rb, line 125
def delete_field(list_name, field_name)
  delete "#{base_url}/lists/#{list_name}/fields/#{field_name}"
end
delete_list(list_name, options = {}) click to toggle source

Delete a list

@param list_name [String] The list API name @param options [Hash] Additional options @option options [Boolean] :dropTable delete the associated table

# File lib/selligent/client/lists.rb, line 47
def delete_list(list_name, options = {})
  delete "#{base_url}/lists/#{list_name}", options
end
delete_record(list_name, record_id) click to toggle source

Delete a single record by id

@param list_name [String] The list API name @param record_id [Integer] The record id

# File lib/selligent/client/lists.rb, line 156
def delete_record(list_name, record_id)
  delete "#{base_url}/lists/#{list_name}/records/#{record_id}"
end
delete_relation(list_name, scope) click to toggle source

Delete a relation between two lists

@param list_name [String] The list API name @param scope [String] The scope name of the relation

# File lib/selligent/client/lists.rb, line 203
def delete_relation(list_name, scope)
  delete "#{base_url}/lists/#{list_name}/relations/#{scope}"
end
fields(list_name) click to toggle source

Get list fields for the given list

@param list_name [String] The list API name

# File lib/selligent/client/lists.rb, line 95
def fields(list_name)
  get "#{base_url}/lists/#{list_name}/fields"
end
list(list_name) click to toggle source

Get details for the list with the given name

@param list_name [String] The list API name

# File lib/selligent/client/lists.rb, line 54
def list(list_name)
  get "#{base_url}/lists/#{list_name}"
end
lists(options = {}) click to toggle source

Returns an overview of all of the lists in this organization

@param options [Hash] Options for filtering, searching, etc. @option options [String] :filter Filter list by type @option options [String] :search Search a list by name, description or tags @option options [Integer] :skip Specify index to start picking list items from @option options [Integer] :take Specify count for the number of items to be taken

# File lib/selligent/client/lists.rb, line 18
def lists(options = {})
  get "#{base_url}/lists", options
end
records_count(list_name) click to toggle source

Get the number of records for the given list

@param list_name [String] The list API name

# File lib/selligent/client/lists.rb, line 148
def records_count(list_name)
  get "#{base_url}/lists/#{list_name}/records"
end
relation(list_name, scope) click to toggle source

Get relation details based based on the list name and the relation scope name

@param list_name [String] The list API name @param scope [String] The scope name of the relation

# File lib/selligent/client/lists.rb, line 211
def relation(list_name, scope)
  get "#{base_url}/lists/#{list_name}/relations/#{scope}"
end
relations(list_name) click to toggle source

Get all relations associated with a list

@param list_name [String] The list API name

# File lib/selligent/client/lists.rb, line 163
def relations(list_name)
  get "#{base_url}/lists/#{list_name}/relations"
end
segment(list_name, segment_name) click to toggle source

Get segment details based on list API name and segment API name

@param list_name [String] The list API name @param segment_name [String] The name of the segment

# File lib/selligent/client/lists.rb, line 259
def segment(list_name, segment_name)
  get "#{base_url}/lists/#{list_name}/segments/#{segment_name}"
end
segments(list_name, options = {}) click to toggle source

Get an overview of the segments defined on the given list

@param list_name [String] The list API name @option options [String] :filter Filter segment by type @option options [String] :search Search a segment by name, description or tags @option options [Integer] :skip Specify index to start picking segment items from @option options [Integer] :take Specify count for the number of segments to be taken

# File lib/selligent/client/lists.rb, line 251
def segments(list_name, options = {})
  get "#{base_url}/lists/#{list_name}/segments", options
end
update_field(list_name, field_name, model) click to toggle source

Update a list field

The model has the following shape:

{

"field_name": "FIELD",
"field_description": "This is FIELD."

}

@param list_name [String] The list API name @param field_name [String] The field name @param model [Hash] The model containing the data that should be sent

# File lib/selligent/client/lists.rb, line 141
def update_field(list_name, field_name, model)
  put "#{base_url}/lists/#{list_name}/fields/#{field_name}", model
end
update_list(list_name, model) click to toggle source

Update a list

The model has the following shape:

{

"api_name": "list_name_in_api",
"name": "list_name",
"description": "description",
"tags": [
  "tag1",
  "tag2"
],
"email_quality_configuration": {
  "type": "Normal",
  "bounce_scope": "MASTER",
  "actions": [
    {
      "name": "OPTOUT",
      "value": "10"
    }
  ],
  "bouncestoredprocedures": [
    "ST_Bounce_Sp1",
    "ST_Bounce_Sp2"
  ]
}

}

@param list_name [String] The list API name @param model [Hash] The model containing the data that should be sent

# File lib/selligent/client/lists.rb, line 88
def update_list(list_name, model)
  put "#{base_url}/lists/#{list_name}", model
end
update_relation(list_name, scope, model) click to toggle source

Update an existing relation

The model has the following shape:

{

"scope_name": "RELATION",
"relation_type": "OneToMany",
"master_list_field_name": "MASTERLISTFIELD",
"slave_list_api_name": "SLAVELIST",
"slave_list_field_name": "SLAVELISTFIELD",
"constraints": [
  {
    "source_list": "MASTER",
    "source_field": "master_field",
    "operator": "EqualTo",
    "destination_list": "SLAVE",
    "destination_field": "slave_field",
    "field_value": ""
  }
]

}

@param list_name [String] The list API name @param scope [String] The scope name of the relation @param model [Hash] The model containing the data that should be sent

# File lib/selligent/client/lists.rb, line 240
def update_relation(list_name, scope, model)
  put "#{base_url}/lists/#{list_name}/relations/#{scope}", model
end