telerivet 1.6.1 → 1.8.0
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.
- checksums.yaml +4 -4
- data/lib/cacert.pem +0 -0
- data/lib/telerivet/airtimetransaction.rb +31 -2
- data/lib/telerivet/apicursor.rb +26 -22
- data/lib/telerivet/broadcast.rb +17 -9
- data/lib/telerivet/contact.rb +13 -5
- data/lib/telerivet/contactservicestate.rb +6 -1
- data/lib/telerivet/datarow.rb +6 -1
- data/lib/telerivet/datatable.rb +19 -5
- data/lib/telerivet/entity.rb +0 -0
- data/lib/telerivet/group.rb +36 -2
- data/lib/telerivet/label.rb +7 -2
- data/lib/telerivet/message.rb +49 -8
- data/lib/telerivet/organization.rb +44 -2
- data/lib/telerivet/phone.rb +16 -9
- data/lib/telerivet/project.rb +719 -116
- data/lib/telerivet/relativescheduledmessage.rb +369 -0
- data/lib/telerivet/route.rb +7 -2
- data/lib/telerivet/scheduledmessage.rb +116 -28
- data/lib/telerivet/service.rb +143 -34
- data/lib/telerivet/task.rb +6 -1
- data/lib/telerivet.rb +16 -4
- metadata +7 -6
data/lib/telerivet/service.rb
CHANGED
@@ -21,6 +21,10 @@ module Telerivet
|
|
21
21
|
# * Name of the service
|
22
22
|
# * Updatable via API
|
23
23
|
#
|
24
|
+
# - service_type
|
25
|
+
# * Type of the service.
|
26
|
+
# * Read-only
|
27
|
+
#
|
24
28
|
# - active (bool)
|
25
29
|
# * Whether the service is active or inactive. Inactive services are not automatically
|
26
30
|
# triggered and cannot be invoked via the API.
|
@@ -41,38 +45,60 @@ module Telerivet
|
|
41
45
|
# * Read-only
|
42
46
|
#
|
43
47
|
# - vars (Hash)
|
44
|
-
# * Custom variables stored for this service
|
48
|
+
# * Custom variables stored for this service. Variable names may be up to 32 characters
|
49
|
+
# in length and can contain the characters a-z, A-Z, 0-9, and _.
|
50
|
+
# Values may be strings, numbers, or boolean (true/false).
|
51
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
52
|
+
# Up to 100 variables are supported per object.
|
53
|
+
# Setting a variable to null will delete the variable.
|
45
54
|
# * Updatable via API
|
46
55
|
#
|
47
56
|
# - project_id
|
48
57
|
# * ID of the project this service belongs to
|
49
58
|
# * Read-only
|
50
59
|
#
|
51
|
-
# - label_id
|
52
|
-
# * ID of the label containing messages sent or received by this service (currently only
|
53
|
-
# used for polls)
|
54
|
-
# * Read-only
|
55
|
-
#
|
56
60
|
# - response_table_id
|
57
|
-
# * ID of the data table where responses to this service will be stored
|
58
|
-
#
|
59
|
-
# * Read-only
|
61
|
+
# * ID of the data table where responses to this service will be stored
|
62
|
+
# * Updatable via API
|
60
63
|
#
|
61
|
-
# -
|
62
|
-
# *
|
63
|
-
#
|
64
|
-
#
|
64
|
+
# - phone_ids
|
65
|
+
# * IDs of phones (basic routes) associated with this service, or null if the service is
|
66
|
+
# associated with all routes. Only applies for service types that handle incoming
|
67
|
+
# messages, voice calls, or USSD sessions.
|
68
|
+
# * Updatable via API
|
65
69
|
#
|
66
|
-
# -
|
67
|
-
# *
|
68
|
-
#
|
69
|
-
#
|
70
|
+
# - apply_mode
|
71
|
+
# * If apply_mode is `unhandled`, the service will not be triggered if another service
|
72
|
+
# has already handled the incoming message. If apply_mode is `always`, the service will
|
73
|
+
# always be triggered regardless of other services. Only applies to services that handle
|
74
|
+
# incoming messages.
|
75
|
+
# * Allowed values: always, unhandled
|
76
|
+
# * Updatable via API
|
77
|
+
#
|
78
|
+
# - contact_number_filter
|
79
|
+
# * If contact_number_filter is `long_number`, this service will only be triggered if
|
80
|
+
# the contact phone number has at least 7 digits (ignoring messages from shortcodes and
|
81
|
+
# alphanumeric senders). If contact_number_filter is `all`, the service will be
|
82
|
+
# triggered for all contact phone numbers. Only applies to services that handle
|
83
|
+
# incoming messages.
|
84
|
+
# * Allowed values: long_number, all
|
85
|
+
# * Updatable via API
|
86
|
+
#
|
87
|
+
# - show_action (bool)
|
88
|
+
# * Whether this service is shown in the 'Actions' menu within the Telerivet web app
|
89
|
+
# when the service is active. Only provided for service types that are manually
|
90
|
+
# triggered.
|
91
|
+
# * Updatable via API
|
92
|
+
#
|
93
|
+
# - direction
|
94
|
+
# * Determines whether the service handles incoming voice calls, outgoing voice calls,
|
95
|
+
# or both. Only applies to services that handle voice calls.
|
96
|
+
# * Allowed values: incoming, outgoing, both
|
97
|
+
# * Updatable via API
|
70
98
|
#
|
71
|
-
# -
|
72
|
-
# *
|
73
|
-
#
|
74
|
-
# question), and `"question_type"` (either `"multiple_choice"`, `"missed_call"`, or
|
75
|
-
# `"open"`).
|
99
|
+
# - webhook_url
|
100
|
+
# * URL that a third-party can invoke to trigger this service. Only provided for
|
101
|
+
# services that are triggered by a webhook request.
|
76
102
|
# * Read-only
|
77
103
|
#
|
78
104
|
class Service < Entity
|
@@ -148,7 +174,7 @@ class Service < Entity
|
|
148
174
|
# async=true.)
|
149
175
|
#
|
150
176
|
# - sent_messages (array of objects)
|
151
|
-
# * Array of messages sent by the service
|
177
|
+
# * Array of messages sent by the service.
|
152
178
|
#
|
153
179
|
# - airtime_transactions (array of objects)
|
154
180
|
# * Array of airtime transactions sent by the service (Undefined if async=true.)
|
@@ -209,7 +235,12 @@ class Service < Entity
|
|
209
235
|
# * Required
|
210
236
|
#
|
211
237
|
# - vars (Hash)
|
212
|
-
# * Custom variables stored for this contact's state
|
238
|
+
# * Custom variables stored for this contact's state. Variable names may be up to 32
|
239
|
+
# characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
240
|
+
# Values may be strings, numbers, or boolean (true/false).
|
241
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
242
|
+
# Up to 100 variables are supported per object.
|
243
|
+
# Setting a variable to null will delete the variable.
|
213
244
|
#
|
214
245
|
# Returns:
|
215
246
|
# Telerivet::ContactServiceState
|
@@ -278,6 +309,41 @@ class Service < Entity
|
|
278
309
|
@api.cursor(ContactServiceState, get_base_api_path() + "/states", options)
|
279
310
|
end
|
280
311
|
|
312
|
+
#
|
313
|
+
# Gets configuration specific to the type of automated service.
|
314
|
+
#
|
315
|
+
# Only certain types of services provide their configuration via the
|
316
|
+
# API.
|
317
|
+
#
|
318
|
+
# Returns:
|
319
|
+
# object
|
320
|
+
#
|
321
|
+
def get_config()
|
322
|
+
return @api.do_request("GET", get_base_api_path() + "/config")
|
323
|
+
end
|
324
|
+
|
325
|
+
#
|
326
|
+
# Updates configuration specific to the type of automated service.
|
327
|
+
#
|
328
|
+
# Only certain types of services support updating their configuration
|
329
|
+
# via the API.
|
330
|
+
#
|
331
|
+
# Note: when updating a service of type custom_template_instance,
|
332
|
+
# the validation script will be invoked when calling this method.
|
333
|
+
#
|
334
|
+
# Arguments:
|
335
|
+
# - options (Hash)
|
336
|
+
# * Configuration for this service type. See
|
337
|
+
# [project.createService](#Project.createService) for available configuration options.
|
338
|
+
# * Required
|
339
|
+
#
|
340
|
+
# Returns:
|
341
|
+
# object
|
342
|
+
#
|
343
|
+
def set_config(options)
|
344
|
+
return @api.do_request("POST", get_base_api_path() + "/config", options)
|
345
|
+
end
|
346
|
+
|
281
347
|
#
|
282
348
|
# Saves any fields or custom variables that have changed for this service.
|
283
349
|
#
|
@@ -285,6 +351,13 @@ class Service < Entity
|
|
285
351
|
super
|
286
352
|
end
|
287
353
|
|
354
|
+
#
|
355
|
+
# Deletes this service.
|
356
|
+
#
|
357
|
+
def delete()
|
358
|
+
@api.do_request("DELETE", get_base_api_path())
|
359
|
+
end
|
360
|
+
|
288
361
|
def id
|
289
362
|
get('id')
|
290
363
|
end
|
@@ -297,6 +370,10 @@ class Service < Entity
|
|
297
370
|
set('name', value)
|
298
371
|
end
|
299
372
|
|
373
|
+
def service_type
|
374
|
+
get('service_type')
|
375
|
+
end
|
376
|
+
|
300
377
|
def active
|
301
378
|
get('active')
|
302
379
|
end
|
@@ -321,24 +398,56 @@ class Service < Entity
|
|
321
398
|
get('project_id')
|
322
399
|
end
|
323
400
|
|
324
|
-
def label_id
|
325
|
-
get('label_id')
|
326
|
-
end
|
327
|
-
|
328
401
|
def response_table_id
|
329
402
|
get('response_table_id')
|
330
403
|
end
|
331
404
|
|
332
|
-
def
|
333
|
-
|
405
|
+
def response_table_id=(value)
|
406
|
+
set('response_table_id', value)
|
407
|
+
end
|
408
|
+
|
409
|
+
def phone_ids
|
410
|
+
get('phone_ids')
|
411
|
+
end
|
412
|
+
|
413
|
+
def phone_ids=(value)
|
414
|
+
set('phone_ids', value)
|
415
|
+
end
|
416
|
+
|
417
|
+
def apply_mode
|
418
|
+
get('apply_mode')
|
419
|
+
end
|
420
|
+
|
421
|
+
def apply_mode=(value)
|
422
|
+
set('apply_mode', value)
|
423
|
+
end
|
424
|
+
|
425
|
+
def contact_number_filter
|
426
|
+
get('contact_number_filter')
|
427
|
+
end
|
428
|
+
|
429
|
+
def contact_number_filter=(value)
|
430
|
+
set('contact_number_filter', value)
|
431
|
+
end
|
432
|
+
|
433
|
+
def show_action
|
434
|
+
get('show_action')
|
435
|
+
end
|
436
|
+
|
437
|
+
def show_action=(value)
|
438
|
+
set('show_action', value)
|
439
|
+
end
|
440
|
+
|
441
|
+
def direction
|
442
|
+
get('direction')
|
334
443
|
end
|
335
444
|
|
336
|
-
def
|
337
|
-
|
445
|
+
def direction=(value)
|
446
|
+
set('direction', value)
|
338
447
|
end
|
339
448
|
|
340
|
-
def
|
341
|
-
get('
|
449
|
+
def webhook_url
|
450
|
+
get('webhook_url')
|
342
451
|
end
|
343
452
|
|
344
453
|
def get_base_api_path()
|
data/lib/telerivet/task.rb
CHANGED
@@ -59,7 +59,12 @@ module Telerivet
|
|
59
59
|
# * Read-only
|
60
60
|
#
|
61
61
|
# - vars (Hash)
|
62
|
-
# * Custom variables stored for this task
|
62
|
+
# * Custom variables stored for this task. Variable names may be up to 32 characters in
|
63
|
+
# length and can contain the characters a-z, A-Z, 0-9, and _.
|
64
|
+
# Values may be strings, numbers, or boolean (true/false).
|
65
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
66
|
+
# Up to 100 variables are supported per object.
|
67
|
+
# Setting a variable to null will delete the variable.
|
63
68
|
# * Read-only
|
64
69
|
#
|
65
70
|
# - table_id (string, max 34 characters)
|
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.
|
12
|
+
@@client_version = '1.8.0'
|
13
13
|
|
14
14
|
#
|
15
15
|
# Initializes a client handle to the Telerivet REST API.
|
@@ -88,11 +88,11 @@ class API
|
|
88
88
|
error_code = error['code']
|
89
89
|
|
90
90
|
if error_code == 'invalid_param'
|
91
|
-
raise InvalidParameterException
|
91
|
+
raise InvalidParameterException.new error['message'], error['code'], error['param']
|
92
92
|
elsif error_code == 'not_found'
|
93
|
-
raise NotFoundException
|
93
|
+
raise NotFoundException.new error['message'], error['code']
|
94
94
|
else
|
95
|
-
raise APIException
|
95
|
+
raise APIException.new error['message'], error['code']
|
96
96
|
end
|
97
97
|
else
|
98
98
|
return res
|
@@ -282,12 +282,24 @@ class API
|
|
282
282
|
end
|
283
283
|
|
284
284
|
class APIException < Exception
|
285
|
+
attr_reader :code
|
286
|
+
|
287
|
+
def initialize(msg, code)
|
288
|
+
@code = code
|
289
|
+
super(msg)
|
290
|
+
end
|
285
291
|
end
|
286
292
|
|
287
293
|
class NotFoundException < APIException
|
288
294
|
end
|
289
295
|
|
290
296
|
class InvalidParameterException < APIException
|
297
|
+
attr_reader :param
|
298
|
+
|
299
|
+
def initialize(msg, code, param)
|
300
|
+
@param = param
|
301
|
+
super(msg, code)
|
302
|
+
end
|
291
303
|
end
|
292
304
|
|
293
305
|
end
|
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
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Young
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby client library for Telerivet REST API
|
14
14
|
email: support@telerivet.com
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- lib/telerivet/organization.rb
|
33
33
|
- lib/telerivet/phone.rb
|
34
34
|
- lib/telerivet/project.rb
|
35
|
+
- lib/telerivet/relativescheduledmessage.rb
|
35
36
|
- lib/telerivet/route.rb
|
36
37
|
- lib/telerivet/scheduledmessage.rb
|
37
38
|
- lib/telerivet/service.rb
|
@@ -40,7 +41,7 @@ homepage: http://telerivet.com
|
|
40
41
|
licenses:
|
41
42
|
- MIT
|
42
43
|
metadata: {}
|
43
|
-
post_install_message:
|
44
|
+
post_install_message:
|
44
45
|
rdoc_options: []
|
45
46
|
require_paths:
|
46
47
|
- lib
|
@@ -55,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: '0'
|
57
58
|
requirements: []
|
58
|
-
rubygems_version: 3.
|
59
|
-
signing_key:
|
59
|
+
rubygems_version: 3.3.15
|
60
|
+
signing_key:
|
60
61
|
specification_version: 4
|
61
62
|
summary: Telerivet REST API Client
|
62
63
|
test_files: []
|