telerivet 1.5.0 → 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
@@ -117,6 +138,15 @@ class Service < Entity
117
138
  # or `phone_number` is required if `context` is 'contact'). If no contact exists with
118
139
  # this phone number, a new contact will be created.
119
140
  #
141
+ # - variables (Hash)
142
+ # * Object containing up to 25 temporary variable names and their corresponding values
143
+ # to set when invoking the service. Values may be strings, numbers, or boolean
144
+ # (true/false). String values may be up to 4096 bytes in length. Arrays and objects
145
+ # are not supported. Within Custom Actions, each variable can be used like `[[$name]]`
146
+ # (with a leading `$` character and surrounded by double square brackets). Within a
147
+ # Cloud Script API service or JavaScript action, each variable will be available as a
148
+ # global JavaScript variable like `$name` (with a leading `$` character).
149
+ #
120
150
  # - route_id
121
151
  # * The ID of the phone or route that the service will use for sending messages by
122
152
  # default
@@ -139,7 +169,7 @@ class Service < Entity
139
169
  # async=true.)
140
170
  #
141
171
  # - sent_messages (array of objects)
142
- # * Array of messages sent by the service (Undefined if async=true.)
172
+ # * Array of messages sent by the service.
143
173
  #
144
174
  # - airtime_transactions (array of objects)
145
175
  # * Array of airtime transactions sent by the service (Undefined if async=true.)
@@ -269,6 +299,41 @@ class Service < Entity
269
299
  @api.cursor(ContactServiceState, get_base_api_path() + "/states", options)
270
300
  end
271
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
+
272
337
  #
273
338
  # Saves any fields or custom variables that have changed for this service.
274
339
  #
@@ -276,6 +341,13 @@ class Service < Entity
276
341
  super
277
342
  end
278
343
 
344
+ #
345
+ # Deletes this service.
346
+ #
347
+ def delete()
348
+ @api.do_request("DELETE", get_base_api_path())
349
+ end
350
+
279
351
  def id
280
352
  get('id')
281
353
  end
@@ -288,6 +360,10 @@ class Service < Entity
288
360
  set('name', value)
289
361
  end
290
362
 
363
+ def service_type
364
+ get('service_type')
365
+ end
366
+
291
367
  def active
292
368
  get('active')
293
369
  end
@@ -312,24 +388,56 @@ class Service < Entity
312
388
  get('project_id')
313
389
  end
314
390
 
315
- def label_id
316
- get('label_id')
317
- end
318
-
319
391
  def response_table_id
320
392
  get('response_table_id')
321
393
  end
322
394
 
323
- def sample_group_id
324
- 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')
325
433
  end
326
434
 
327
- def respondent_group_id
328
- get('respondent_group_id')
435
+ def direction=(value)
436
+ set('direction', value)
329
437
  end
330
438
 
331
- def questions
332
- get('questions')
439
+ def webhook_url
440
+ get('webhook_url')
333
441
  end
334
442
 
335
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.5.0'
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.5.0
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: 2021-03-27 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