telerivet 1.8.2 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,10 +36,10 @@ module Telerivet
36
36
  # * Updatable via API
37
37
  #
38
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
39
+ # * The type of interval that will be used to adjust the scheduled date relative to the
40
+ # date stored in the contact's date_variable, when offset_count is non-zero (I=minutes,
41
+ # D=day, W=week, M=month, Y=year)
42
+ # * Allowed values: I, D, W, M, Y
43
43
  # * Updatable via API
44
44
  #
45
45
  # - offset_count (int)
@@ -126,12 +126,9 @@ module Telerivet
126
126
  # * Updatable via API
127
127
  #
128
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
129
+ # * Array of media attachments for the text message. This property is undefined for
130
+ # messages that do not contain media files.
131
+ # * Updatable via API
135
132
  #
136
133
  # - route_params (Hash)
137
134
  # * Route-specific parameters to use when sending the message.
@@ -340,6 +337,10 @@ class RelativeScheduledMessage < Entity
340
337
  get('media')
341
338
  end
342
339
 
340
+ def media=(value)
341
+ set('media', value)
342
+ end
343
+
343
344
  def route_params
344
345
  get('route_params')
345
346
  end
@@ -9,9 +9,6 @@ module Telerivet
9
9
  # parameters, and properties related to Custom Routes continue to use the term "Route" to
10
10
  # maintain backwards compatibility.
11
11
  #
12
- # Custom routing rules can currently only be configured via Telerivet's web
13
- # UI.
14
- #
15
12
  # Fields:
16
13
  #
17
14
  # - id (string, max 34 characters)
@@ -31,13 +28,22 @@ module Telerivet
31
28
  # Setting a variable to null will delete the variable.
32
29
  # * Updatable via API
33
30
  #
31
+ # - url
32
+ # * URL to this route in the Telerivet web app
33
+ # * Read-only
34
+ #
34
35
  # - project_id
35
36
  # * ID of the project this route belongs to
36
37
  # * Read-only
38
+ #
39
+ # - actions (array of RoutingAction)
40
+ # * Array of routing action objects. Allowed action types: `use_phone`, `condition`.
41
+ # * Updatable via API
37
42
  #
38
43
  class Route < Entity
39
44
  #
40
- # Saves any fields or custom variables that have changed for this custom route.
45
+ # Saves any fields, custom variables, or routing actions that have changed for this custom
46
+ # route.
41
47
  #
42
48
  def save()
43
49
  super
@@ -55,10 +61,22 @@ class Route < Entity
55
61
  set('name', value)
56
62
  end
57
63
 
64
+ def url
65
+ get('url')
66
+ end
67
+
58
68
  def project_id
59
69
  get('project_id')
60
70
  end
61
71
 
72
+ def actions
73
+ get('actions')
74
+ end
75
+
76
+ def actions=(value)
77
+ set('actions', value)
78
+ end
79
+
62
80
  def get_base_api_path()
63
81
  "/projects/#{get('project_id')}/routes/#{get('id')}"
64
82
  end
@@ -130,12 +130,9 @@ module Telerivet
130
130
  # * Updatable via API
131
131
  #
132
132
  # - media (array)
133
- # * For text messages containing media files, this is an array of objects with the
134
- # properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
135
- # Unknown properties are null. This property is undefined for messages that do not
136
- # contain media files. Note: For files uploaded via the Telerivet web app, the URL is
137
- # temporary and may not be valid for more than 1 day.
138
- # * Read-only
133
+ # * Array of media attachments for the text message. This property is undefined for
134
+ # messages that do not contain media files.
135
+ # * Updatable via API
139
136
  #
140
137
  # - route_params (Hash)
141
138
  # * Route-specific parameters to use when sending the message.
@@ -169,6 +166,11 @@ module Telerivet
169
166
  # - project_id
170
167
  # * ID of the project this scheduled message belongs to
171
168
  # * Read-only
169
+ #
170
+ # - is_template (bool)
171
+ # * Set to true if Telerivet will render variables like [[contact.name]] in the message
172
+ # content
173
+ # * Read-only
172
174
  #
173
175
  class ScheduledMessage < Entity
174
176
  #
@@ -341,6 +343,10 @@ class ScheduledMessage < Entity
341
343
  get('media')
342
344
  end
343
345
 
346
+ def media=(value)
347
+ set('media', value)
348
+ end
349
+
344
350
  def route_params
345
351
  get('route_params')
346
352
  end
@@ -365,6 +371,10 @@ class ScheduledMessage < Entity
365
371
  get('project_id')
366
372
  end
367
373
 
374
+ def is_template
375
+ get('is_template')
376
+ end
377
+
368
378
  def get_base_api_path()
369
379
  "/projects/#{get('project_id')}/scheduled/#{get('id')}"
370
380
  end
@@ -0,0 +1,160 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a scheduled service within Telerivet.
6
+ #
7
+ # Scheduled services allow services to be triggered automatically at specified
8
+ # times.
9
+ # The ScheduledService object is only used for services that are triggered for
10
+ # a project (e.g. `scheduled_actions` or `scheduled_script`).
11
+ #
12
+ # Note: To schedule services that are triggered for a contact, the
13
+ # [ScheduledMessage](#ScheduledMessage) object should be used instead, with
14
+ # `message_type`=`service`.
15
+ #
16
+ # Fields:
17
+ #
18
+ # - id (string, max 34 characters)
19
+ # * ID of the scheduled service
20
+ # * Read-only
21
+ #
22
+ # - service_id (string, max 34 characters)
23
+ # * ID of the service to be triggered
24
+ # * Read-only
25
+ #
26
+ # - rrule
27
+ # * Recurrence rule for recurring scheduled services, e.g. 'FREQ=MONTHLY' or
28
+ # 'FREQ=WEEKLY;INTERVAL=2'; see
29
+ # [RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
30
+ # * Updatable via API
31
+ #
32
+ # - timezone_id
33
+ # * Timezone ID used to compute times for recurring scheduled services; see [List of tz
34
+ # database time zones Wikipedia
35
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
36
+ # * Updatable via API
37
+ #
38
+ # - time_created (UNIX timestamp)
39
+ # * Time the scheduled service was created in Telerivet
40
+ # * Read-only
41
+ #
42
+ # - start_time (UNIX timestamp)
43
+ # * The time that the service will be triggered (or first triggered for recurring
44
+ # scheduled services)
45
+ # * Updatable via API
46
+ #
47
+ # - end_time (UNIX timestamp)
48
+ # * Time after which a recurring scheduled service will stop (not applicable to
49
+ # non-recurring scheduled services)
50
+ # * Updatable via API
51
+ #
52
+ # - prev_time (UNIX timestamp)
53
+ # * The most recent time that Telerivet triggered this scheduled service (null if it has
54
+ # never been triggered)
55
+ # * Read-only
56
+ #
57
+ # - next_time (UNIX timestamp)
58
+ # * The next upcoming time that Telerivet will trigger this scheduled service (null if
59
+ # it will not be triggered again)
60
+ # * Read-only
61
+ #
62
+ # - occurrences (int)
63
+ # * Number of times this scheduled service has already been triggered
64
+ # * Read-only
65
+ #
66
+ # - vars (Hash)
67
+ # * Custom variables stored for this scheduled service. Variable names may be up to 32
68
+ # characters in length and can contain the characters a-z, A-Z, 0-9, and _.
69
+ # Values may be strings, numbers, or boolean (true/false).
70
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
71
+ # Up to 100 variables are supported per object.
72
+ # Setting a variable to null will delete the variable.
73
+ # * Updatable via API
74
+ #
75
+ # - project_id
76
+ # * ID of the project this scheduled service belongs to
77
+ # * Read-only
78
+ #
79
+ class ScheduledService < Entity
80
+ #
81
+ # Saves any fields or custom variables that have changed for this scheduled service.
82
+ #
83
+ def save()
84
+ super
85
+ end
86
+
87
+ #
88
+ # Cancels this scheduled service.
89
+ #
90
+ def delete()
91
+ @api.do_request("DELETE", get_base_api_path())
92
+ end
93
+
94
+ def id
95
+ get('id')
96
+ end
97
+
98
+ def service_id
99
+ get('service_id')
100
+ end
101
+
102
+ def rrule
103
+ get('rrule')
104
+ end
105
+
106
+ def rrule=(value)
107
+ set('rrule', value)
108
+ end
109
+
110
+ def timezone_id
111
+ get('timezone_id')
112
+ end
113
+
114
+ def timezone_id=(value)
115
+ set('timezone_id', value)
116
+ end
117
+
118
+ def time_created
119
+ get('time_created')
120
+ end
121
+
122
+ def start_time
123
+ get('start_time')
124
+ end
125
+
126
+ def start_time=(value)
127
+ set('start_time', value)
128
+ end
129
+
130
+ def end_time
131
+ get('end_time')
132
+ end
133
+
134
+ def end_time=(value)
135
+ set('end_time', value)
136
+ end
137
+
138
+ def prev_time
139
+ get('prev_time')
140
+ end
141
+
142
+ def next_time
143
+ get('next_time')
144
+ end
145
+
146
+ def occurrences
147
+ get('occurrences')
148
+ end
149
+
150
+ def project_id
151
+ get('project_id')
152
+ end
153
+
154
+ def get_base_api_path()
155
+ "/projects/#{get('project_id')}/scheduled_services/#{get('id')}"
156
+ end
157
+
158
+ end
159
+
160
+ end
@@ -53,6 +53,14 @@ module Telerivet
53
53
  # Setting a variable to null will delete the variable.
54
54
  # * Updatable via API
55
55
  #
56
+ # - url
57
+ # * URL to this service in the Telerivet web app
58
+ # * Read-only
59
+ #
60
+ # - url_edit
61
+ # * URL to edit the service in the Telerivet web app
62
+ # * Read-only
63
+ #
56
64
  # - project_id
57
65
  # * ID of the project this service belongs to
58
66
  # * Read-only
@@ -61,12 +69,34 @@ module Telerivet
61
69
  # * ID of the data table where responses to this service will be stored
62
70
  # * Updatable via API
63
71
  #
64
- # - phone_ids
72
+ # - phone_ids (array)
65
73
  # * IDs of phones (basic routes) associated with this service, or null if the service is
66
74
  # associated with all routes. Only applies for service types that handle incoming
67
75
  # messages, voice calls, or USSD sessions.
68
76
  # * Updatable via API
69
77
  #
78
+ # - message_types (array of strings)
79
+ # * Types of messages that this service handles. Only provided for service types that
80
+ # handle incoming messages.
81
+ # * Allowed values: text, call, ussd
82
+ # * Updatable via API
83
+ #
84
+ # - table_ids (array)
85
+ # * IDs of data tables that this service applies to, or null if this service applies to
86
+ # all data tables. Only provided for data row services (`data_row_script` and
87
+ # `data_row_actions`).
88
+ # * Updatable via API
89
+ #
90
+ # - message_statuses (array of strings)
91
+ # * Message statuses that this service handles. Only provided for
92
+ # `message_status_actions` services.
93
+ # * Allowed values: sent, delivered, failed, failed_queued, not_delivered
94
+ # * Updatable via API
95
+ #
96
+ # - tags (array)
97
+ # * Tags used to organize this service. Each tag can be up to 32 characters in length.
98
+ # * Updatable via API
99
+ #
70
100
  # - apply_mode
71
101
  # * If apply_mode is `unhandled`, the service will not be triggered if another service
72
102
  # has already handled the incoming message. If apply_mode is `always`, the service will
@@ -100,6 +130,10 @@ module Telerivet
100
130
  # * URL that a third-party can invoke to trigger this service. Only provided for
101
131
  # services that are triggered by a webhook request.
102
132
  # * Read-only
133
+ #
134
+ # - is_custom_template (bool)
135
+ # * Whether this service was created from a custom service template
136
+ # * Read-only
103
137
  #
104
138
  class Service < Entity
105
139
 
@@ -123,7 +157,8 @@ class Service < Entity
123
157
  #
124
158
  # - context
125
159
  # * The name of the context in which this service is invoked
126
- # * Allowed values: message, call, ussd_session, row, contact, project
160
+ # * Allowed values: message, call, ussd_session, row, contact, project,
161
+ # airtime_transaction
127
162
  # * Required
128
163
  #
129
164
  # - event
@@ -143,6 +178,10 @@ class Service < Entity
143
178
  # or `phone_number` is required if `context` is 'contact'). If no contact exists with
144
179
  # this phone number, a new contact will be created.
145
180
  #
181
+ # - row_id
182
+ # * The ID of the data row this service is triggered for
183
+ # * Required if context is 'row'
184
+ #
146
185
  # - variables (Hash)
147
186
  # * Object containing up to 25 temporary variable names and their corresponding values
148
187
  # to set when invoking the service. Values may be strings, numbers, or boolean
@@ -313,7 +352,8 @@ class Service < Entity
313
352
  # Gets configuration specific to the type of automated service.
314
353
  #
315
354
  # Only certain types of services provide their configuration via the
316
- # API.
355
+ # API. See [Service Configuration Reference](#service_config) or the machine-readable [OpenAPI
356
+ # specification](https://api.telerivet.com/openapi.json) for available configuration options.
317
357
  #
318
358
  # Returns:
319
359
  # object
@@ -333,8 +373,10 @@ class Service < Entity
333
373
  #
334
374
  # Arguments:
335
375
  # - options (Hash)
336
- # * Configuration for this service type. See
337
- # [project.createService](#Project.createService) for available configuration options.
376
+ # * Configuration for this service type. See [Service Configuration
377
+ # Reference](#service_config) or the machine-readable [OpenAPI
378
+ # specification](https://api.telerivet.com/openapi.json) for available configuration
379
+ # options.
338
380
  # * Required
339
381
  #
340
382
  # Returns:
@@ -394,6 +436,14 @@ class Service < Entity
394
436
  get('contexts')
395
437
  end
396
438
 
439
+ def url
440
+ get('url')
441
+ end
442
+
443
+ def url_edit
444
+ get('url_edit')
445
+ end
446
+
397
447
  def project_id
398
448
  get('project_id')
399
449
  end
@@ -414,6 +464,38 @@ class Service < Entity
414
464
  set('phone_ids', value)
415
465
  end
416
466
 
467
+ def message_types
468
+ get('message_types')
469
+ end
470
+
471
+ def message_types=(value)
472
+ set('message_types', value)
473
+ end
474
+
475
+ def table_ids
476
+ get('table_ids')
477
+ end
478
+
479
+ def table_ids=(value)
480
+ set('table_ids', value)
481
+ end
482
+
483
+ def message_statuses
484
+ get('message_statuses')
485
+ end
486
+
487
+ def message_statuses=(value)
488
+ set('message_statuses', value)
489
+ end
490
+
491
+ def tags
492
+ get('tags')
493
+ end
494
+
495
+ def tags=(value)
496
+ set('tags', value)
497
+ end
498
+
417
499
  def apply_mode
418
500
  get('apply_mode')
419
501
  end
@@ -450,6 +532,10 @@ class Service < Entity
450
532
  get('webhook_url')
451
533
  end
452
534
 
535
+ def is_custom_template
536
+ get('is_custom_template')
537
+ end
538
+
453
539
  def get_base_api_path()
454
540
  "/projects/#{get('project_id')}/services/#{get('id')}"
455
541
  end
@@ -0,0 +1,167 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a file stored in a Telerivet project, such as a media attachment for outgoing
6
+ # messages.
7
+ #
8
+ # Stored files are also automatically created for media attachments for
9
+ # incoming messages.
10
+ #
11
+ # Files can be uploaded via [project.uploadFile](#Project.uploadFile), then
12
+ # attached to outgoing messages by passing the file ID as a `file_id` item in the `media`
13
+ # parameter when sending a message or broadcast.
14
+ #
15
+ # Fields:
16
+ #
17
+ # - id (string, max 34 characters)
18
+ # * ID of the stored file
19
+ # * Read-only
20
+ #
21
+ # - filename (string, max 127 characters)
22
+ # * Filename of the stored file
23
+ # * Updatable via API
24
+ #
25
+ # - type
26
+ # * MIME type of the file
27
+ # * Read-only
28
+ #
29
+ # - size (int)
30
+ # * Size of the file in bytes
31
+ # * Read-only
32
+ #
33
+ # - description (string, max 1000 characters)
34
+ # * Description of the file
35
+ # * Updatable via API
36
+ #
37
+ # - category
38
+ # * Category of the stored file
39
+ # * Allowed values: outgoing_media, incoming_media, call_audio, test_recording,
40
+ # script_module, icon
41
+ # * Read-only
42
+ #
43
+ # - source
44
+ # * How the stored file was created
45
+ # * Allowed values: upload, recording, message, api
46
+ # * Read-only
47
+ #
48
+ # - message_id
49
+ # * ID of the message associated with this file, if any. Files associated with a message
50
+ # are deleted automatically when the message is deleted.
51
+ # * Read-only
52
+ #
53
+ # - sha256
54
+ # * SHA-256 hash of the file content (lowercase hex), if available
55
+ # * Read-only
56
+ #
57
+ # - time_created (UNIX timestamp)
58
+ # * Time the file was created in Telerivet
59
+ # * Read-only
60
+ #
61
+ # - user_id (string, max 34 characters)
62
+ # * ID of the Telerivet user who created the file (if applicable)
63
+ # * Read-only
64
+ #
65
+ # - url
66
+ # * URL where the file content can be downloaded. Note: this URL is temporary and may
67
+ # not be valid for more than 1 day; retrieve the stored file again to get a fresh URL.
68
+ # * Read-only
69
+ #
70
+ # - thumbnail_url
71
+ # * URL of a thumbnail image for video files, if available. Note: this URL is temporary
72
+ # and may not be valid for more than 1 day.
73
+ # * Read-only
74
+ #
75
+ # - project_id
76
+ # * ID of the project this file belongs to
77
+ # * Read-only
78
+ #
79
+ class StoredFile < Entity
80
+ #
81
+ # Saves any fields that have changed for this stored file.
82
+ #
83
+ def save()
84
+ super
85
+ end
86
+
87
+ #
88
+ # Deletes this stored file.
89
+ #
90
+ # A stored file may only be deleted by the user who created it or by a
91
+ # project administrator, and may not be deleted while it is attached to an existing message.
92
+ #
93
+ def delete()
94
+ @api.do_request("DELETE", get_base_api_path())
95
+ end
96
+
97
+ def id
98
+ get('id')
99
+ end
100
+
101
+ def filename
102
+ get('filename')
103
+ end
104
+
105
+ def filename=(value)
106
+ set('filename', value)
107
+ end
108
+
109
+ def type
110
+ get('type')
111
+ end
112
+
113
+ def size
114
+ get('size')
115
+ end
116
+
117
+ def description
118
+ get('description')
119
+ end
120
+
121
+ def description=(value)
122
+ set('description', value)
123
+ end
124
+
125
+ def category
126
+ get('category')
127
+ end
128
+
129
+ def source
130
+ get('source')
131
+ end
132
+
133
+ def message_id
134
+ get('message_id')
135
+ end
136
+
137
+ def sha256
138
+ get('sha256')
139
+ end
140
+
141
+ def time_created
142
+ get('time_created')
143
+ end
144
+
145
+ def user_id
146
+ get('user_id')
147
+ end
148
+
149
+ def url
150
+ get('url')
151
+ end
152
+
153
+ def thumbnail_url
154
+ get('thumbnail_url')
155
+ end
156
+
157
+ def project_id
158
+ get('project_id')
159
+ end
160
+
161
+ def get_base_api_path()
162
+ "/projects/#{get('project_id')}/files/#{get('id')}"
163
+ end
164
+
165
+ end
166
+
167
+ end
@@ -58,6 +58,10 @@ module Telerivet
58
58
  # * Allowed values: created, queued, active, complete, failed, cancelled
59
59
  # * Read-only
60
60
  #
61
+ # - error_message (string)
62
+ # * Error message if the task failed
63
+ # * Read-only
64
+ #
61
65
  # - vars (Hash)
62
66
  # * Custom variables stored for this task. Variable names may be up to 32 characters in
63
67
  # length and can contain the characters a-z, A-Z, 0-9, and _.
@@ -135,6 +139,10 @@ class Task < Entity
135
139
  get('status')
136
140
  end
137
141
 
142
+ def error_message
143
+ get('error_message')
144
+ end
145
+
138
146
  def table_id
139
147
  get('table_id')
140
148
  end