class Telerivet::Task

Represents an asynchronous task that is applied to all entities matching a filter.

Tasks include services applied to contacts, messages, or data rows; adding or removing contacts from a group; blocking or unblocking sending messages to a contact; updating a custom variable; deleting contacts, messages, or data rows; or exporting data to CSV.

Fields:

- id (string, max 34 characters)
    * ID of the task
    * Read-only

- task_type (string)
    * The task type
    * Read-only

- task_params (Hash)
    * Parameters applied to all matching rows (specific to `task_type`). See
        [project.createTask](#Project.createTask).
    * Read-only

- filter_type
    * Type of filter defining the rows that the task is applied to
    * Read-only

- filter_params (Hash)
    * Parameters defining the rows that the task is applied to (specific to
        `filter_type`). See [project.createTask](#Project.createTask).
    * Read-only

- time_created (UNIX timestamp)
    * Time the task was created in Telerivet
    * Read-only

- time_active (UNIX timestamp)
    * Time Telerivet started executing the task
    * Read-only

- time_complete (UNIX timestamp)
    * Time Telerivet finished executing the task
    * Read-only

- total_rows (int)
    * The total number of rows matching the filter (null if not known)
    * Read-only

- current_row (int)
    * The number of rows that have been processed so far
    * Read-only

- status (string)
    * The current status of the task
    * Allowed values: created, queued, active, complete, failed, cancelled
    * Read-only

- vars (Hash)
    * Custom variables stored for this task
    * Read-only

- table_id (string, max 34 characters)
    * ID of the data table this task is applied to (if applicable)
    * Read-only

- user_id (string, max 34 characters)
    * ID of the Telerivet user who created the task (if applicable)
    * Read-only

- project_id
    * ID of the project this task belongs to
    * Read-only

Public Instance Methods

cancel() click to toggle source

Cancels a task that is not yet complete.

Returns:

Telerivet::Task
# File lib/telerivet/task.rb, line 84
def cancel()
    require_relative 'task'
    Task.new(@api, @api.do_request("POST", get_base_api_path() + "/cancel"))
end
current_row() click to toggle source
# File lib/telerivet/task.rb, line 125
def current_row
    get('current_row')
end
filter_params() click to toggle source
# File lib/telerivet/task.rb, line 105
def filter_params
    get('filter_params')
end
filter_type() click to toggle source
# File lib/telerivet/task.rb, line 101
def filter_type
    get('filter_type')
end
get_base_api_path() click to toggle source
# File lib/telerivet/task.rb, line 145
def get_base_api_path()
    "/projects/#{get('project_id')}/tasks/#{get('id')}"
end
id() click to toggle source
# File lib/telerivet/task.rb, line 89
def id
    get('id')
end
project_id() click to toggle source
# File lib/telerivet/task.rb, line 141
def project_id
    get('project_id')
end
status() click to toggle source
# File lib/telerivet/task.rb, line 129
def status
    get('status')
end
table_id() click to toggle source
# File lib/telerivet/task.rb, line 133
def table_id
    get('table_id')
end
task_params() click to toggle source
# File lib/telerivet/task.rb, line 97
def task_params
    get('task_params')
end
task_type() click to toggle source
# File lib/telerivet/task.rb, line 93
def task_type
    get('task_type')
end
time_active() click to toggle source
# File lib/telerivet/task.rb, line 113
def time_active
    get('time_active')
end
time_complete() click to toggle source
# File lib/telerivet/task.rb, line 117
def time_complete
    get('time_complete')
end
time_created() click to toggle source
# File lib/telerivet/task.rb, line 109
def time_created
    get('time_created')
end
total_rows() click to toggle source
# File lib/telerivet/task.rb, line 121
def total_rows
    get('total_rows')
end
user_id() click to toggle source
# File lib/telerivet/task.rb, line 137
def user_id
    get('user_id')
end