Class: Telerivet::Task
Overview
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. Variable names may be up to 32 characters in
length and can contain the characters a-z, A-Z, 0-9, and _.
Values may be strings, numbers, or boolean (true/false).
String values may be up to 4096 bytes in length when encoded as UTF-8.
Up to 100 variables are supported per object.
Setting a variable to null will delete the variable.
* 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
Instance Method Summary
collapse
Methods inherited from Entity
#get, #initialize, #load, #save, #set, #set_data, #to_s, #vars
Instance Method Details
#cancel ⇒ Object
Cancels a task that is not yet complete.
Returns:
Telerivet::Task
89
90
91
92
|
# File 'lib/telerivet/task.rb', line 89
def cancel()
require_relative 'task'
Task.new(@api, @api.do_request("POST", get_base_api_path() + "/cancel"))
end
|
#current_row ⇒ Object
130
131
132
|
# File 'lib/telerivet/task.rb', line 130
def current_row
get('current_row')
end
|
#filter_params ⇒ Object
110
111
112
|
# File 'lib/telerivet/task.rb', line 110
def filter_params
get('filter_params')
end
|
#filter_type ⇒ Object
106
107
108
|
# File 'lib/telerivet/task.rb', line 106
def filter_type
get('filter_type')
end
|
#get_base_api_path ⇒ Object
150
151
152
|
# File 'lib/telerivet/task.rb', line 150
def get_base_api_path()
"/projects/#{get('project_id')}/tasks/#{get('id')}"
end
|
#id ⇒ Object
94
95
96
|
# File 'lib/telerivet/task.rb', line 94
def id
get('id')
end
|
#project_id ⇒ Object
146
147
148
|
# File 'lib/telerivet/task.rb', line 146
def project_id
get('project_id')
end
|
#status ⇒ Object
134
135
136
|
# File 'lib/telerivet/task.rb', line 134
def status
get('status')
end
|
#table_id ⇒ Object
138
139
140
|
# File 'lib/telerivet/task.rb', line 138
def table_id
get('table_id')
end
|
#task_params ⇒ Object
102
103
104
|
# File 'lib/telerivet/task.rb', line 102
def task_params
get('task_params')
end
|
#task_type ⇒ Object
98
99
100
|
# File 'lib/telerivet/task.rb', line 98
def task_type
get('task_type')
end
|
#time_active ⇒ Object
118
119
120
|
# File 'lib/telerivet/task.rb', line 118
def time_active
get('time_active')
end
|
#time_complete ⇒ Object
122
123
124
|
# File 'lib/telerivet/task.rb', line 122
def time_complete
get('time_complete')
end
|
#time_created ⇒ Object
114
115
116
|
# File 'lib/telerivet/task.rb', line 114
def time_created
get('time_created')
end
|
#total_rows ⇒ Object
126
127
128
|
# File 'lib/telerivet/task.rb', line 126
def total_rows
get('total_rows')
end
|
#user_id ⇒ Object
142
143
144
|
# File 'lib/telerivet/task.rb', line 142
def user_id
get('user_id')
end
|