telerivet 1.4.5 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -135,6 +135,13 @@ module Telerivet
135
135
  # temporary and may not be valid for more than 1 day.
136
136
  # * Read-only
137
137
  #
138
+ # - route_params (Hash)
139
+ # * Route-specific parameters to use when sending the message. The parameters object may
140
+ # have keys matching the `phone_type` field of a phone (basic route) that may be used to
141
+ # send the message. The corresponding value is an object with route-specific parameters
142
+ # to use when sending a message with that type of route.
143
+ # * Read-only
144
+ #
138
145
  # - vars (Hash)
139
146
  # * Custom variables stored for this scheduled message (copied to Message when sent)
140
147
  # * Updatable via API
@@ -258,6 +265,10 @@ class ScheduledMessage < Entity
258
265
  get('media')
259
266
  end
260
267
 
268
+ def route_params
269
+ get('route_params')
270
+ end
271
+
261
272
  def label_ids
262
273
  get('label_ids')
263
274
  end
@@ -97,7 +97,7 @@ class Service < Entity
97
97
  #
98
98
  # - context
99
99
  # * The name of the context in which this service is invoked
100
- # * Allowed values: message, call, contact, project
100
+ # * Allowed values: message, call, ussd_session, row, contact, project
101
101
  # * Required
102
102
  #
103
103
  # - event
@@ -109,11 +109,49 @@ class Service < Entity
109
109
  # * Required if context is 'message'
110
110
  #
111
111
  # - contact_id
112
- # * The ID of the contact this service is triggered for
113
- # * Required if context is 'contact'
112
+ # * The ID of the contact this service is triggered for (either `contact_id` or
113
+ # `phone_number` is required if `context` is 'contact')
114
+ #
115
+ # - phone_number
116
+ # * The phone number of the contact this service is triggered for (either `contact_id`
117
+ # or `phone_number` is required if `context` is 'contact'). If no contact exists with
118
+ # this phone number, a new contact will be created.
119
+ #
120
+ # - variables (Hash)
121
+ # * Object containing up to 25 temporary variable names and their corresponding values
122
+ # to set when invoking the service. Values may be strings, numbers, or boolean
123
+ # (true/false). String values may be up to 4096 bytes in length. Arrays and objects
124
+ # are not supported. Within Custom Actions, each variable can be used like `[[$name]]`
125
+ # (with a leading `$` character and surrounded by double square brackets). Within a
126
+ # Cloud Script API service or JavaScript action, each variable will be available as a
127
+ # global JavaScript variable like `$name` (with a leading `$` character).
128
+ #
129
+ # - route_id
130
+ # * The ID of the phone or route that the service will use for sending messages by
131
+ # default
132
+ #
133
+ # - async (bool)
134
+ # * If set to true, the service will be invoked asynchronously. By default, queued
135
+ # services will be invoked one at a time for each project.
114
136
  #
115
137
  # Returns:
116
- # object
138
+ # (associative array)
139
+ # - return_value (any)
140
+ # * Return value of the service. May be any JSON type (boolean, number, string,
141
+ # array, object, or null). (Undefined if async=true.)
142
+ #
143
+ # - log_entries (array)
144
+ # * Array of log entry strings generated by the service. (Undefined if async=true.)
145
+ #
146
+ # - errors (array)
147
+ # * Array of error message strings generated by the service. (Undefined if
148
+ # async=true.)
149
+ #
150
+ # - sent_messages (array of objects)
151
+ # * Array of messages sent by the service (Undefined if async=true.)
152
+ #
153
+ # - airtime_transactions (array of objects)
154
+ # * Array of airtime transactions sent by the service (Undefined if async=true.)
117
155
  #
118
156
  def invoke(options)
119
157
  invoke_result = @api.do_request('POST', get_base_api_path() + '/invoke', options)
@@ -210,9 +248,9 @@ class Service < Entity
210
248
  #
211
249
  # - vars (Hash)
212
250
  # * Filter states by value of a custom variable (e.g. vars[email], vars[foo], etc.)
213
- # * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
214
- # vars[foo][not_prefix], vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte],
215
- # vars[foo][min], vars[foo][max]
251
+ # * Allowed modifiers: vars[foo][ne], vars[foo][prefix], vars[foo][not_prefix],
252
+ # vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte], vars[foo][min],
253
+ # vars[foo][max], vars[foo][exists]
216
254
  #
217
255
  # - sort
218
256
  # * Sort the results based on a field
@@ -0,0 +1,151 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents an asynchronous task that is applied to all entities matching a filter.
6
+ #
7
+ # Tasks include services applied to contacts, messages, or data rows; adding
8
+ # or removing contacts from a group; blocking or unblocking sending messages to a contact;
9
+ # updating a custom variable; deleting contacts, messages, or data rows; or
10
+ # exporting data to CSV.
11
+ #
12
+ # Fields:
13
+ #
14
+ # - id (string, max 34 characters)
15
+ # * ID of the task
16
+ # * Read-only
17
+ #
18
+ # - task_type (string)
19
+ # * The task type
20
+ # * Read-only
21
+ #
22
+ # - task_params (Hash)
23
+ # * Parameters applied to all matching rows (specific to `task_type`). See
24
+ # [project.createTask](#Project.createTask).
25
+ # * Read-only
26
+ #
27
+ # - filter_type
28
+ # * Type of filter defining the rows that the task is applied to
29
+ # * Read-only
30
+ #
31
+ # - filter_params (Hash)
32
+ # * Parameters defining the rows that the task is applied to (specific to
33
+ # `filter_type`). See [project.createTask](#Project.createTask).
34
+ # * Read-only
35
+ #
36
+ # - time_created (UNIX timestamp)
37
+ # * Time the task was created in Telerivet
38
+ # * Read-only
39
+ #
40
+ # - time_active (UNIX timestamp)
41
+ # * Time Telerivet started executing the task
42
+ # * Read-only
43
+ #
44
+ # - time_complete (UNIX timestamp)
45
+ # * Time Telerivet finished executing the task
46
+ # * Read-only
47
+ #
48
+ # - total_rows (int)
49
+ # * The total number of rows matching the filter (null if not known)
50
+ # * Read-only
51
+ #
52
+ # - current_row (int)
53
+ # * The number of rows that have been processed so far
54
+ # * Read-only
55
+ #
56
+ # - status (string)
57
+ # * The current status of the task
58
+ # * Allowed values: created, queued, active, complete, failed, cancelled
59
+ # * Read-only
60
+ #
61
+ # - vars (Hash)
62
+ # * Custom variables stored for this task
63
+ # * Read-only
64
+ #
65
+ # - table_id (string, max 34 characters)
66
+ # * ID of the data table this task is applied to (if applicable)
67
+ # * Read-only
68
+ #
69
+ # - user_id (string, max 34 characters)
70
+ # * ID of the Telerivet user who created the task (if applicable)
71
+ # * Read-only
72
+ #
73
+ # - project_id
74
+ # * ID of the project this task belongs to
75
+ # * Read-only
76
+ #
77
+ class Task < Entity
78
+ #
79
+ # Cancels a task that is not yet complete.
80
+ #
81
+ # Returns:
82
+ # Telerivet::Task
83
+ #
84
+ def cancel()
85
+ require_relative 'task'
86
+ Task.new(@api, @api.do_request("POST", get_base_api_path() + "/cancel"))
87
+ end
88
+
89
+ def id
90
+ get('id')
91
+ end
92
+
93
+ def task_type
94
+ get('task_type')
95
+ end
96
+
97
+ def task_params
98
+ get('task_params')
99
+ end
100
+
101
+ def filter_type
102
+ get('filter_type')
103
+ end
104
+
105
+ def filter_params
106
+ get('filter_params')
107
+ end
108
+
109
+ def time_created
110
+ get('time_created')
111
+ end
112
+
113
+ def time_active
114
+ get('time_active')
115
+ end
116
+
117
+ def time_complete
118
+ get('time_complete')
119
+ end
120
+
121
+ def total_rows
122
+ get('total_rows')
123
+ end
124
+
125
+ def current_row
126
+ get('current_row')
127
+ end
128
+
129
+ def status
130
+ get('status')
131
+ end
132
+
133
+ def table_id
134
+ get('table_id')
135
+ end
136
+
137
+ def user_id
138
+ get('user_id')
139
+ end
140
+
141
+ def project_id
142
+ get('project_id')
143
+ end
144
+
145
+ def get_base_api_path()
146
+ "/projects/#{get('project_id')}/tasks/#{get('id')}"
147
+ end
148
+
149
+ end
150
+
151
+ end
data/lib/telerivet.rb CHANGED
@@ -9,7 +9,7 @@ module Telerivet
9
9
  class API
10
10
  attr_reader :num_requests
11
11
 
12
- @@client_version = '1.4.5'
12
+ @@client_version = '1.6.1'
13
13
 
14
14
  #
15
15
  # Initializes a client handle to the Telerivet REST API.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telerivet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-15 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client library for Telerivet REST API
14
14
  email: support@telerivet.com
@@ -18,6 +18,7 @@ extra_rdoc_files: []
18
18
  files:
19
19
  - lib/cacert.pem
20
20
  - lib/telerivet.rb
21
+ - lib/telerivet/airtimetransaction.rb
21
22
  - lib/telerivet/apicursor.rb
22
23
  - lib/telerivet/broadcast.rb
23
24
  - lib/telerivet/contact.rb
@@ -34,6 +35,7 @@ files:
34
35
  - lib/telerivet/route.rb
35
36
  - lib/telerivet/scheduledmessage.rb
36
37
  - lib/telerivet/service.rb
38
+ - lib/telerivet/task.rb
37
39
  homepage: http://telerivet.com
38
40
  licenses:
39
41
  - MIT