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](
* 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](
* 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
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
84
85
86
87
|
# 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 ⇒ Object
125
126
127
|
# File 'lib/telerivet/task.rb', line 125
def current_row
get('current_row')
end
|
#filter_params ⇒ Object
105
106
107
|
# File 'lib/telerivet/task.rb', line 105
def filter_params
get('filter_params')
end
|
#filter_type ⇒ Object
101
102
103
|
# File 'lib/telerivet/task.rb', line 101
def filter_type
get('filter_type')
end
|
#get_base_api_path ⇒ Object
145
146
147
|
# File 'lib/telerivet/task.rb', line 145
def get_base_api_path()
"/projects/#{get('project_id')}/tasks/#{get('id')}"
end
|
#id ⇒ Object
89
90
91
|
# File 'lib/telerivet/task.rb', line 89
def id
get('id')
end
|
#project_id ⇒ Object
141
142
143
|
# File 'lib/telerivet/task.rb', line 141
def project_id
get('project_id')
end
|
#status ⇒ Object
129
130
131
|
# File 'lib/telerivet/task.rb', line 129
def status
get('status')
end
|
#table_id ⇒ Object
133
134
135
|
# File 'lib/telerivet/task.rb', line 133
def table_id
get('table_id')
end
|
#task_params ⇒ Object
97
98
99
|
# File 'lib/telerivet/task.rb', line 97
def task_params
get('task_params')
end
|
#task_type ⇒ Object
93
94
95
|
# File 'lib/telerivet/task.rb', line 93
def task_type
get('task_type')
end
|
#time_active ⇒ Object
113
114
115
|
# File 'lib/telerivet/task.rb', line 113
def time_active
get('time_active')
end
|
#time_complete ⇒ Object
117
118
119
|
# File 'lib/telerivet/task.rb', line 117
def time_complete
get('time_complete')
end
|
#time_created ⇒ Object
109
110
111
|
# File 'lib/telerivet/task.rb', line 109
def time_created
get('time_created')
end
|
#total_rows ⇒ Object
121
122
123
|
# File 'lib/telerivet/task.rb', line 121
def total_rows
get('total_rows')
end
|
#user_id ⇒ Object
137
138
139
|
# File 'lib/telerivet/task.rb', line 137
def user_id
get('user_id')
end
|