telerivet 1.5.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,361 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # A relative scheduled message is a message that is scheduled relative to a date stored as a
6
+ # custom field for each recipient contact.
7
+ # This allows scheduling messages on a different date for each contact, for
8
+ # example on their birthday, a certain number of days before an appointment, or a certain
9
+ # number of days after enrolling in a campaign.
10
+ #
11
+ # Telerivet will automatically create a [ScheduledMessage](#ScheduledMessage)
12
+ # for each contact matching a RelativeScheduledMessage.
13
+ #
14
+ # Any service that can be manually triggered for a contact (including polls)
15
+ # may also be scheduled via a relative scheduled message, whether or not the service actually
16
+ # sends a message.
17
+ #
18
+ # Fields:
19
+ #
20
+ # - id (string, max 34 characters)
21
+ # * ID of the relative scheduled message
22
+ # * Read-only
23
+ #
24
+ # - content
25
+ # * Text content of the relative scheduled message
26
+ # * Updatable via API
27
+ #
28
+ # - time_of_day
29
+ # * Time of day when scheduled messages will be sent in HH:MM format (with hours from 00
30
+ # to 23)
31
+ # * Updatable via API
32
+ #
33
+ # - date_variable
34
+ # * Custom contact variable storing date or date/time values relative to which messages
35
+ # will be scheduled.
36
+ # * Updatable via API
37
+ #
38
+ # - offset_scale
39
+ # * The type of interval (day/week/month/year) that will be used to adjust the scheduled
40
+ # date relative to the date stored in the contact's date_variable, when offset_count is
41
+ # non-zero (D=day, W=week, M=month, Y=year)
42
+ # * Allowed values: D, W, M, Y
43
+ # * Updatable via API
44
+ #
45
+ # - offset_count (int)
46
+ # * The number of days/weeks/months/years to adjust the date of the scheduled message
47
+ # relative relative to the date stored in the contact's date_variable. May be positive,
48
+ # negative, or zero.
49
+ # * Updatable via API
50
+ #
51
+ # - rrule
52
+ # * Recurrence rule for recurring scheduled messages, e.g. 'FREQ=MONTHLY' or
53
+ # 'FREQ=WEEKLY;INTERVAL=2'; see
54
+ # [RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
55
+ # * Updatable via API
56
+ #
57
+ # - end_time (UNIX timestamp)
58
+ # * Time after which recurring messages will stop (not applicable to non-recurring
59
+ # scheduled messages)
60
+ # * Updatable via API
61
+ #
62
+ # - timezone_id
63
+ # * Timezone ID used to compute times for recurring messages; see [List of tz database
64
+ # time zones Wikipedia
65
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
66
+ # * Updatable via API
67
+ #
68
+ # - recipients_str
69
+ # * A string with a human readable description of the recipient
70
+ # * Read-only
71
+ #
72
+ # - group_id
73
+ # * ID of the group to send the message to (null if the recipient is an individual
74
+ # contact)
75
+ # * Updatable via API
76
+ #
77
+ # - contact_id
78
+ # * ID of the contact to send the message to (null if the recipient is a group)
79
+ # * Updatable via API
80
+ #
81
+ # - to_number
82
+ # * Phone number to send the message to (null if the recipient is a group)
83
+ # * Updatable via API
84
+ #
85
+ # - route_id
86
+ # * ID of the phone or route the message will be sent from
87
+ # * Updatable via API
88
+ #
89
+ # - service_id (string, max 34 characters)
90
+ # * The service associated with this message (for voice calls, the service defines the
91
+ # call flow)
92
+ # * Updatable via API
93
+ #
94
+ # - audio_url
95
+ # * For voice calls, the URL of an MP3 file to play when the contact answers the call
96
+ # * Updatable via API
97
+ #
98
+ # - tts_lang
99
+ # * For voice calls, the language of the text-to-speech voice
100
+ # * Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
101
+ # de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
102
+ # * Updatable via API
103
+ #
104
+ # - tts_voice
105
+ # * For voice calls, the text-to-speech voice
106
+ # * Allowed values: female, male
107
+ # * Updatable via API
108
+ #
109
+ # - message_type
110
+ # * Type of scheduled message
111
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
112
+ # * Read-only
113
+ #
114
+ # - time_created (UNIX timestamp)
115
+ # * Time the relative scheduled message was created in Telerivet
116
+ # * Read-only
117
+ #
118
+ # - replace_variables (bool)
119
+ # * Set to true if Telerivet will render variables like [[contact.name]] in the message
120
+ # content, false otherwise
121
+ # * Updatable via API
122
+ #
123
+ # - track_clicks (boolean)
124
+ # * If true, URLs in the message content will automatically be replaced with unique
125
+ # short URLs
126
+ # * Updatable via API
127
+ #
128
+ # - media (array)
129
+ # * For text messages containing media files, this is an array of objects with the
130
+ # properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
131
+ # Unknown properties are null. This property is undefined for messages that do not
132
+ # contain media files. Note: For files uploaded via the Telerivet web app, the URL is
133
+ # temporary and may not be valid for more than 1 day.
134
+ # * Read-only
135
+ #
136
+ # - route_params (Hash)
137
+ # * Route-specific parameters to use when sending the message. The parameters object may
138
+ # have keys matching the `phone_type` field of a phone (basic route) that may be used to
139
+ # send the message. The corresponding value is an object with route-specific parameters
140
+ # to use when sending a message with that type of route.
141
+ # * Updatable via API
142
+ #
143
+ # - vars (Hash)
144
+ # * Custom variables stored for this scheduled message (copied to each ScheduledMessage
145
+ # and Message when sent)
146
+ # * Updatable via API
147
+ #
148
+ # - label_ids (array)
149
+ # * IDs of labels to add to the Message
150
+ # * Updatable via API
151
+ #
152
+ # - project_id
153
+ # * ID of the project this relative scheduled message belongs to
154
+ # * Read-only
155
+ #
156
+ class RelativeScheduledMessage < Entity
157
+ #
158
+ # Saves any fields or custom variables that have changed for this relative scheduled message.
159
+ #
160
+ def save()
161
+ super
162
+ end
163
+
164
+ #
165
+ # Deletes this relative scheduled message and any associated scheduled messages.
166
+ #
167
+ def delete()
168
+ @api.do_request("DELETE", get_base_api_path())
169
+ end
170
+
171
+ def id
172
+ get('id')
173
+ end
174
+
175
+ def content
176
+ get('content')
177
+ end
178
+
179
+ def content=(value)
180
+ set('content', value)
181
+ end
182
+
183
+ def time_of_day
184
+ get('time_of_day')
185
+ end
186
+
187
+ def time_of_day=(value)
188
+ set('time_of_day', value)
189
+ end
190
+
191
+ def date_variable
192
+ get('date_variable')
193
+ end
194
+
195
+ def date_variable=(value)
196
+ set('date_variable', value)
197
+ end
198
+
199
+ def offset_scale
200
+ get('offset_scale')
201
+ end
202
+
203
+ def offset_scale=(value)
204
+ set('offset_scale', value)
205
+ end
206
+
207
+ def offset_count
208
+ get('offset_count')
209
+ end
210
+
211
+ def offset_count=(value)
212
+ set('offset_count', value)
213
+ end
214
+
215
+ def rrule
216
+ get('rrule')
217
+ end
218
+
219
+ def rrule=(value)
220
+ set('rrule', value)
221
+ end
222
+
223
+ def end_time
224
+ get('end_time')
225
+ end
226
+
227
+ def end_time=(value)
228
+ set('end_time', value)
229
+ end
230
+
231
+ def timezone_id
232
+ get('timezone_id')
233
+ end
234
+
235
+ def timezone_id=(value)
236
+ set('timezone_id', value)
237
+ end
238
+
239
+ def recipients_str
240
+ get('recipients_str')
241
+ end
242
+
243
+ def group_id
244
+ get('group_id')
245
+ end
246
+
247
+ def group_id=(value)
248
+ set('group_id', value)
249
+ end
250
+
251
+ def contact_id
252
+ get('contact_id')
253
+ end
254
+
255
+ def contact_id=(value)
256
+ set('contact_id', value)
257
+ end
258
+
259
+ def to_number
260
+ get('to_number')
261
+ end
262
+
263
+ def to_number=(value)
264
+ set('to_number', value)
265
+ end
266
+
267
+ def route_id
268
+ get('route_id')
269
+ end
270
+
271
+ def route_id=(value)
272
+ set('route_id', value)
273
+ end
274
+
275
+ def service_id
276
+ get('service_id')
277
+ end
278
+
279
+ def service_id=(value)
280
+ set('service_id', value)
281
+ end
282
+
283
+ def audio_url
284
+ get('audio_url')
285
+ end
286
+
287
+ def audio_url=(value)
288
+ set('audio_url', value)
289
+ end
290
+
291
+ def tts_lang
292
+ get('tts_lang')
293
+ end
294
+
295
+ def tts_lang=(value)
296
+ set('tts_lang', value)
297
+ end
298
+
299
+ def tts_voice
300
+ get('tts_voice')
301
+ end
302
+
303
+ def tts_voice=(value)
304
+ set('tts_voice', value)
305
+ end
306
+
307
+ def message_type
308
+ get('message_type')
309
+ end
310
+
311
+ def time_created
312
+ get('time_created')
313
+ end
314
+
315
+ def replace_variables
316
+ get('replace_variables')
317
+ end
318
+
319
+ def replace_variables=(value)
320
+ set('replace_variables', value)
321
+ end
322
+
323
+ def track_clicks
324
+ get('track_clicks')
325
+ end
326
+
327
+ def track_clicks=(value)
328
+ set('track_clicks', value)
329
+ end
330
+
331
+ def media
332
+ get('media')
333
+ end
334
+
335
+ def route_params
336
+ get('route_params')
337
+ end
338
+
339
+ def route_params=(value)
340
+ set('route_params', value)
341
+ end
342
+
343
+ def label_ids
344
+ get('label_ids')
345
+ end
346
+
347
+ def label_ids=(value)
348
+ set('label_ids', value)
349
+ end
350
+
351
+ def project_id
352
+ get('project_id')
353
+ end
354
+
355
+ def get_base_api_path()
356
+ "/projects/#{get('project_id')}/relative_scheduled/#{get('id')}"
357
+ end
358
+
359
+ end
360
+
361
+ end
@@ -32,7 +32,7 @@ module Telerivet
32
32
  #
33
33
  class Route < Entity
34
34
  #
35
- # Saves any fields or custom variables that have changed for this route.
35
+ # Saves any fields or custom variables that have changed for this custom route.
36
36
  #
37
37
  def save()
38
38
  super
@@ -12,17 +12,19 @@ module Telerivet
12
12
  #
13
13
  # - content
14
14
  # * Text content of the scheduled message
15
- # * Read-only
15
+ # * Updatable via API
16
16
  #
17
17
  # - rrule
18
18
  # * Recurrence rule for recurring scheduled messages, e.g. 'FREQ=MONTHLY' or
19
- # 'FREQ=WEEKLY;INTERVAL=2'; see <https://tools.ietf.org/html/rfc2445#section-4.3.10>
20
- # * Read-only
19
+ # 'FREQ=WEEKLY;INTERVAL=2'; see
20
+ # [RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
21
+ # * Updatable via API
21
22
  #
22
23
  # - timezone_id
23
- # * Timezone ID used to compute times for recurring messages; see
24
- # <http://en.wikipedia.org/wiki/List_of_tz_database_time_zones>
25
- # * Read-only
24
+ # * Timezone ID used to compute times for recurring messages; see [List of tz database
25
+ # time zones Wikipedia
26
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
27
+ # * Updatable via API
26
28
  #
27
29
  # - recipients (array of objects)
28
30
  # * List of recipients. Each recipient is an object with a string `type` property, which
@@ -49,45 +51,45 @@ module Telerivet
49
51
  # - group_id
50
52
  # * ID of the group to send the message to (null if the recipient is an individual
51
53
  # contact, or if there are multiple recipients)
52
- # * Read-only
54
+ # * Updatable via API
53
55
  #
54
56
  # - contact_id
55
57
  # * ID of the contact to send the message to (null if the recipient is a group, or if
56
58
  # there are multiple recipients)
57
- # * Read-only
59
+ # * Updatable via API
58
60
  #
59
61
  # - to_number
60
62
  # * Phone number to send the message to (null if the recipient is a group, or if there
61
63
  # are multiple recipients)
62
- # * Read-only
64
+ # * Updatable via API
63
65
  #
64
66
  # - route_id
65
67
  # * ID of the phone or route the message will be sent from
66
- # * Read-only
68
+ # * Updatable via API
67
69
  #
68
70
  # - service_id (string, max 34 characters)
69
71
  # * The service associated with this message (for voice calls, the service defines the
70
72
  # call flow)
71
- # * Read-only
73
+ # * Updatable via API
72
74
  #
73
75
  # - audio_url
74
76
  # * For voice calls, the URL of an MP3 file to play when the contact answers the call
75
- # * Read-only
77
+ # * Updatable via API
76
78
  #
77
79
  # - tts_lang
78
80
  # * For voice calls, the language of the text-to-speech voice
79
81
  # * Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
80
82
  # de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
81
- # * Read-only
83
+ # * Updatable via API
82
84
  #
83
85
  # - tts_voice
84
86
  # * For voice calls, the text-to-speech voice
85
87
  # * Allowed values: female, male
86
- # * Read-only
88
+ # * Updatable via API
87
89
  #
88
90
  # - message_type
89
91
  # * Type of scheduled message
90
- # * Allowed values: sms, mms, ussd, call, service
92
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
91
93
  # * Read-only
92
94
  #
93
95
  # - time_created (UNIX timestamp)
@@ -96,12 +98,12 @@ module Telerivet
96
98
  #
97
99
  # - start_time (UNIX timestamp)
98
100
  # * The time that the message will be sent (or first sent for recurring messages)
99
- # * Read-only
101
+ # * Updatable via API
100
102
  #
101
103
  # - end_time (UNIX timestamp)
102
104
  # * Time after which a recurring message will stop (not applicable to non-recurring
103
105
  # scheduled messages)
104
- # * Read-only
106
+ # * Updatable via API
105
107
  #
106
108
  # - prev_time (UNIX timestamp)
107
109
  # * The most recent time that Telerivet has sent this scheduled message (null if it has
@@ -117,15 +119,15 @@ module Telerivet
117
119
  # * Number of times this scheduled message has already been sent
118
120
  # * Read-only
119
121
  #
120
- # - is_template (bool)
122
+ # - replace_variables (bool)
121
123
  # * Set to true if Telerivet will render variables like [[contact.name]] in the message
122
124
  # content, false otherwise
123
- # * Read-only
125
+ # * Updatable via API
124
126
  #
125
127
  # - track_clicks (boolean)
126
128
  # * If true, URLs in the message content will automatically be replaced with unique
127
129
  # short URLs
128
- # * Read-only
130
+ # * Updatable via API
129
131
  #
130
132
  # - media (array)
131
133
  # * For text messages containing media files, this is an array of objects with the
@@ -135,12 +137,24 @@ module Telerivet
135
137
  # temporary and may not be valid for more than 1 day.
136
138
  # * Read-only
137
139
  #
140
+ # - route_params (Hash)
141
+ # * Route-specific parameters to use when sending the message. The parameters object may
142
+ # have keys matching the `phone_type` field of a phone (basic route) that may be used to
143
+ # send the message. The corresponding value is an object with route-specific parameters
144
+ # to use when sending a message with that type of route.
145
+ # * Updatable via API
146
+ #
138
147
  # - vars (Hash)
139
148
  # * Custom variables stored for this scheduled message (copied to Message when sent)
140
149
  # * Updatable via API
141
150
  #
142
151
  # - label_ids (array)
143
152
  # * IDs of labels to add to the Message
153
+ # * Updatable via API
154
+ #
155
+ # - relative_scheduled_id
156
+ # * ID of the relative scheduled message this scheduled message was created from, if
157
+ # applicable
144
158
  # * Read-only
145
159
  #
146
160
  # - project_id
@@ -170,14 +184,26 @@ class ScheduledMessage < Entity
170
184
  get('content')
171
185
  end
172
186
 
187
+ def content=(value)
188
+ set('content', value)
189
+ end
190
+
173
191
  def rrule
174
192
  get('rrule')
175
193
  end
176
194
 
195
+ def rrule=(value)
196
+ set('rrule', value)
197
+ end
198
+
177
199
  def timezone_id
178
200
  get('timezone_id')
179
201
  end
180
202
 
203
+ def timezone_id=(value)
204
+ set('timezone_id', value)
205
+ end
206
+
181
207
  def recipients
182
208
  get('recipients')
183
209
  end
@@ -190,34 +216,66 @@ class ScheduledMessage < Entity
190
216
  get('group_id')
191
217
  end
192
218
 
219
+ def group_id=(value)
220
+ set('group_id', value)
221
+ end
222
+
193
223
  def contact_id
194
224
  get('contact_id')
195
225
  end
196
226
 
227
+ def contact_id=(value)
228
+ set('contact_id', value)
229
+ end
230
+
197
231
  def to_number
198
232
  get('to_number')
199
233
  end
200
234
 
235
+ def to_number=(value)
236
+ set('to_number', value)
237
+ end
238
+
201
239
  def route_id
202
240
  get('route_id')
203
241
  end
204
242
 
243
+ def route_id=(value)
244
+ set('route_id', value)
245
+ end
246
+
205
247
  def service_id
206
248
  get('service_id')
207
249
  end
208
250
 
251
+ def service_id=(value)
252
+ set('service_id', value)
253
+ end
254
+
209
255
  def audio_url
210
256
  get('audio_url')
211
257
  end
212
258
 
259
+ def audio_url=(value)
260
+ set('audio_url', value)
261
+ end
262
+
213
263
  def tts_lang
214
264
  get('tts_lang')
215
265
  end
216
266
 
267
+ def tts_lang=(value)
268
+ set('tts_lang', value)
269
+ end
270
+
217
271
  def tts_voice
218
272
  get('tts_voice')
219
273
  end
220
274
 
275
+ def tts_voice=(value)
276
+ set('tts_voice', value)
277
+ end
278
+
221
279
  def message_type
222
280
  get('message_type')
223
281
  end
@@ -230,10 +288,18 @@ class ScheduledMessage < Entity
230
288
  get('start_time')
231
289
  end
232
290
 
291
+ def start_time=(value)
292
+ set('start_time', value)
293
+ end
294
+
233
295
  def end_time
234
296
  get('end_time')
235
297
  end
236
298
 
299
+ def end_time=(value)
300
+ set('end_time', value)
301
+ end
302
+
237
303
  def prev_time
238
304
  get('prev_time')
239
305
  end
@@ -246,22 +312,46 @@ class ScheduledMessage < Entity
246
312
  get('occurrences')
247
313
  end
248
314
 
249
- def is_template
250
- get('is_template')
315
+ def replace_variables
316
+ get('replace_variables')
317
+ end
318
+
319
+ def replace_variables=(value)
320
+ set('replace_variables', value)
251
321
  end
252
322
 
253
323
  def track_clicks
254
324
  get('track_clicks')
255
325
  end
256
326
 
327
+ def track_clicks=(value)
328
+ set('track_clicks', value)
329
+ end
330
+
257
331
  def media
258
332
  get('media')
259
333
  end
260
334
 
335
+ def route_params
336
+ get('route_params')
337
+ end
338
+
339
+ def route_params=(value)
340
+ set('route_params', value)
341
+ end
342
+
261
343
  def label_ids
262
344
  get('label_ids')
263
345
  end
264
346
 
347
+ def label_ids=(value)
348
+ set('label_ids', value)
349
+ end
350
+
351
+ def relative_scheduled_id
352
+ get('relative_scheduled_id')
353
+ end
354
+
265
355
  def project_id
266
356
  get('project_id')
267
357
  end