class MarketoAPI::Lists

Marketo list operations.

Constants

TYPES

Public Class Methods

key(type, value) click to toggle source
# File lib/marketo_api/lists.rb, line 72
def key(type, value)
  {
    listKey: {
      keyType:  key_type(type),
      keyValue: value
    }
  }
end

Private Class Methods

key_type(key) click to toggle source
# File lib/marketo_api/lists.rb, line 82
def key_type(key)
  res = if TYPES.include? key
          key
        else
          NAMED_TYPES[key]
        end
  raise ArgumentError, "Invalid key #{key}" unless res
  res
end

Public Instance Methods

add(list_key, options) click to toggle source

Options

leads

Required. An array of Lead objects or lead keys. If both leads and lead are provided, they will be merged.

lead

An alias for leads.

strict

If true, the entire operation fails if any subset fails. Non-strict mode will complete everything it can and return errors for anything that failed.

Add leads to a Marketo list.

# File lib/marketo_api/lists.rb, line 14
  
member?(list_key, options) click to toggle source

Options

leads

Required. An array of Lead objects or lead keys. If both leads and lead are provided, they will be merged.

lead

An alias for leads.

strict

If true, the entire operation fails if any subset fails. Non-strict mode will complete everything it can and return errors for anything that failed.

Add leads to a Marketo list.

# File lib/marketo_api/lists.rb, line 46
  
remove(list_key, options) click to toggle source

Options

leads

Required. An array of Lead objects or lead keys. If both leads and lead are provided, they will be merged.

lead

An alias for leads.

strict

If true, the entire operation fails if any subset fails. Non-strict mode will complete everything it can and return errors for anything that failed.

Add leads to a Marketo list.

# File lib/marketo_api/lists.rb, line 30
  

Private Instance Methods

list_operation(operation, list_key, options = {}) click to toggle source
# File lib/marketo_api/lists.rb, line 94
def list_operation(operation, list_key, options = {})
  leads = MarketoAPI.array(options.delete(:leads)) +
    MarketoAPI.array(options.delete(:lead))
  if leads.empty?
    raise ArgumentError, ':lead or :leads must be provided'
  end

  call(
    :list_operation,
    listOperation:  operation,
    listKey:        list_key,
    strict:         false,
    listMemberList: transform_param_list(:get, leads)
  )
end