telerivet 1.6.1 → 1.7.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.
@@ -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.
@@ -48,31 +52,48 @@ module Telerivet
48
52
  # * ID of the project this service belongs to
49
53
  # * Read-only
50
54
  #
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
55
  # - response_table_id
57
- # * ID of the data table where responses to this service will be stored (currently only
58
- # used for polls)
59
- # * Read-only
56
+ # * ID of the data table where responses to this service will be stored
57
+ # * Updatable via API
60
58
  #
61
- # - sample_group_id
62
- # * ID of the group containing contacts that have been invited to interact with this
63
- # service (currently only used for polls)
64
- # * Read-only
59
+ # - phone_ids
60
+ # * IDs of phones (basic routes) associated with this service, or null if the service is
61
+ # associated with all routes. Only applies for service types that handle incoming
62
+ # messages, voice calls, or USSD sessions.
63
+ # * Updatable via API
65
64
  #
66
- # - respondent_group_id
67
- # * ID of the group containing contacts that have completed an interaction with this
68
- # service (currently only used for polls)
69
- # * Read-only
65
+ # - apply_mode
66
+ # * If apply_mode is `unhandled`, the service will not be triggered if another service
67
+ # has already handled the incoming message. If apply_mode is `always`, the service will
68
+ # always be triggered regardless of other services. Only applies to services that handle
69
+ # incoming messages.
70
+ # * Allowed values: always, unhandled
71
+ # * Updatable via API
72
+ #
73
+ # - contact_number_filter
74
+ # * If contact_number_filter is `long_number`, this service will only be triggered if
75
+ # the contact phone number has at least 7 digits (ignoring messages from shortcodes and
76
+ # alphanumeric senders). If contact_number_filter is `all`, the service will be
77
+ # triggered for all contact phone numbers. Only applies to services that handle
78
+ # incoming messages.
79
+ # * Allowed values: long_number, all
80
+ # * Updatable via API
81
+ #
82
+ # - show_action (bool)
83
+ # * Whether this service is shown in the 'Actions' menu within the Telerivet web app
84
+ # when the service is active. Only provided for service types that are manually
85
+ # triggered.
86
+ # * Updatable via API
87
+ #
88
+ # - direction
89
+ # * Determines whether the service handles incoming voice calls, outgoing voice calls,
90
+ # or both. Only applies to services that handle voice calls.
91
+ # * Allowed values: incoming, outgoing, both
92
+ # * Updatable via API
70
93
  #
71
- # - questions (array)
72
- # * Array of objects describing each question in a poll (only used for polls). Each
73
- # object has the properties `"id"` (the question ID), `"content"` (the text of the
74
- # question), and `"question_type"` (either `"multiple_choice"`, `"missed_call"`, or
75
- # `"open"`).
94
+ # - webhook_url
95
+ # * URL that a third-party can invoke to trigger this service. Only provided for
96
+ # services that are triggered by a webhook request.
76
97
  # * Read-only
77
98
  #
78
99
  class Service < Entity
@@ -148,7 +169,7 @@ class Service < Entity
148
169
  # async=true.)
149
170
  #
150
171
  # - sent_messages (array of objects)
151
- # * Array of messages sent by the service (Undefined if async=true.)
172
+ # * Array of messages sent by the service.
152
173
  #
153
174
  # - airtime_transactions (array of objects)
154
175
  # * Array of airtime transactions sent by the service (Undefined if async=true.)
@@ -278,6 +299,41 @@ class Service < Entity
278
299
  @api.cursor(ContactServiceState, get_base_api_path() + "/states", options)
279
300
  end
280
301
 
302
+ #
303
+ # Gets configuration specific to the type of automated service.
304
+ #
305
+ # Only certain types of services provide their configuration via the
306
+ # API.
307
+ #
308
+ # Returns:
309
+ # object
310
+ #
311
+ def get_config()
312
+ return @api.do_request("GET", get_base_api_path() + "/config")
313
+ end
314
+
315
+ #
316
+ # Updates configuration specific to the type of automated service.
317
+ #
318
+ # Only certain types of services support updating their configuration
319
+ # via the API.
320
+ #
321
+ # Note: when updating a service of type custom_template_instance,
322
+ # the validation script will be invoked when calling this method.
323
+ #
324
+ # Arguments:
325
+ # - options (Hash)
326
+ # * Configuration for this service type. See
327
+ # [project.createService](#Project.createService) for available configuration options.
328
+ # * Required
329
+ #
330
+ # Returns:
331
+ # object
332
+ #
333
+ def set_config(options)
334
+ return @api.do_request("POST", get_base_api_path() + "/config", options)
335
+ end
336
+
281
337
  #
282
338
  # Saves any fields or custom variables that have changed for this service.
283
339
  #
@@ -285,6 +341,13 @@ class Service < Entity
285
341
  super
286
342
  end
287
343
 
344
+ #
345
+ # Deletes this service.
346
+ #
347
+ def delete()
348
+ @api.do_request("DELETE", get_base_api_path())
349
+ end
350
+
288
351
  def id
289
352
  get('id')
290
353
  end
@@ -297,6 +360,10 @@ class Service < Entity
297
360
  set('name', value)
298
361
  end
299
362
 
363
+ def service_type
364
+ get('service_type')
365
+ end
366
+
300
367
  def active
301
368
  get('active')
302
369
  end
@@ -321,24 +388,56 @@ class Service < Entity
321
388
  get('project_id')
322
389
  end
323
390
 
324
- def label_id
325
- get('label_id')
326
- end
327
-
328
391
  def response_table_id
329
392
  get('response_table_id')
330
393
  end
331
394
 
332
- def sample_group_id
333
- get('sample_group_id')
395
+ def response_table_id=(value)
396
+ set('response_table_id', value)
397
+ end
398
+
399
+ def phone_ids
400
+ get('phone_ids')
401
+ end
402
+
403
+ def phone_ids=(value)
404
+ set('phone_ids', value)
405
+ end
406
+
407
+ def apply_mode
408
+ get('apply_mode')
409
+ end
410
+
411
+ def apply_mode=(value)
412
+ set('apply_mode', value)
413
+ end
414
+
415
+ def contact_number_filter
416
+ get('contact_number_filter')
417
+ end
418
+
419
+ def contact_number_filter=(value)
420
+ set('contact_number_filter', value)
421
+ end
422
+
423
+ def show_action
424
+ get('show_action')
425
+ end
426
+
427
+ def show_action=(value)
428
+ set('show_action', value)
429
+ end
430
+
431
+ def direction
432
+ get('direction')
334
433
  end
335
434
 
336
- def respondent_group_id
337
- get('respondent_group_id')
435
+ def direction=(value)
436
+ set('direction', value)
338
437
  end
339
438
 
340
- def questions
341
- get('questions')
439
+ def webhook_url
440
+ get('webhook_url')
342
441
  end
343
442
 
344
443
  def get_base_api_path()
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.6.1'
12
+ @@client_version = '1.7.0'
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.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-18 00:00:00.000000000 Z
11
+ date: 2023-06-28 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