telerivet 1.4.0 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2d2fced513f7484cd8ea41bc16c1e95a20dbe18d
4
- data.tar.gz: e4fc99c1924272a9872262ece7f291c6f92060b4
2
+ SHA256:
3
+ metadata.gz: 4e063e2ce507f6d45b86d12c584475887c050c3d439863d91d545b0ba331e823
4
+ data.tar.gz: d8040eb663854c7df190aa8f49984d9854687238532b6278af53dea6ebc77250
5
5
  SHA512:
6
- metadata.gz: f027ddecadb6e32b3dded7c0ee27b4d7afeede434d02848bc2a23f69186765e2bc77ec0dac6cc4bde926d0959b889e29bf76490037bb24ce19cb772874c21c82
7
- data.tar.gz: 82ccab2d76a1b30183d39945d958901fe85ab575003fa1341aca0d5087d3b3a277cd19d0f96126d9a4ad1e01e9de8252556c20e3b0ab8d48b504005d6f869790
6
+ metadata.gz: da5e09e1c639a5e1bd3b704214c4a276d62469e6ae0853d71cbe4b9dc2a2aacbb1f58d5e5bcbf1093e5cbf24a7a99abcf30d029883aca055d4b41ae9f3a7f8ff
7
+ data.tar.gz: 4ad80ced036f9d8810e3e7f693443247740791ed4097b26ce179c2c2ef0ca06986b41942fde40401ea8989df19591f84834439efb74900f9bb57ec7f939d8f25
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.4.0'
12
+ @@client_version = '1.5.0'
13
13
 
14
14
  #
15
15
  # Initializes a client handle to the Telerivet REST API.
@@ -153,7 +153,7 @@ class API
153
153
  # * Default: asc
154
154
  #
155
155
  # - page_size (int)
156
- # * Number of results returned per page (max 200)
156
+ # * Number of results returned per page (max 500)
157
157
  # * Default: 50
158
158
  #
159
159
  # - offset (int)
@@ -222,7 +222,7 @@ class API
222
222
  # * Default: asc
223
223
  #
224
224
  # - page_size (int)
225
- # * Number of results returned per page (max 200)
225
+ # * Number of results returned per page (max 500)
226
226
  # * Default: 50
227
227
  #
228
228
  # - offset (int)
@@ -0,0 +1,139 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a transaction where airtime is sent to a mobile phone number.
6
+ #
7
+ # To send airtime, first [create a Custom Actions service to send a particular amount of
8
+ # airtime](/dashboard/add_service?subtype_id=main.service.rules.contact&action_id=main.rule.sendairtime),
9
+ # then trigger the service using [service.invoke](#Service.invoke),
10
+ # [project.sendBroadcast](#Project.sendBroadcast), or
11
+ # [project.scheduleMessage](#Project.scheduleMessage).
12
+ #
13
+ # Fields:
14
+ #
15
+ # - id
16
+ # * ID of the airtime transaction
17
+ # * Read-only
18
+ #
19
+ # - to_number
20
+ # * Destination phone number in international format (no leading +)
21
+ # * Read-only
22
+ #
23
+ # - operator_name
24
+ # * Operator name
25
+ # * Read-only
26
+ #
27
+ # - country
28
+ # * Country code
29
+ # * Read-only
30
+ #
31
+ # - status
32
+ # * Current status of airtime transaction (`successful`, `failed`, `cancelled`,
33
+ # `queued`, `pending_approval`, or `pending_payment`)
34
+ # * Read-only
35
+ #
36
+ # - status_text
37
+ # * Error or success message returned by airtime provider, if available
38
+ # * Read-only
39
+ #
40
+ # - value
41
+ # * Value of airtime sent to destination phone number, in units of value_currency
42
+ # * Read-only
43
+ #
44
+ # - value_currency
45
+ # * Currency code of price
46
+ # * Read-only
47
+ #
48
+ # - price
49
+ # * Price charged for airtime transaction, in units of price_currency
50
+ # * Read-only
51
+ #
52
+ # - price_currency
53
+ # * Currency code of price
54
+ # * Read-only
55
+ #
56
+ # - contact_id
57
+ # * ID of the contact the airtime was sent to
58
+ # * Read-only
59
+ #
60
+ # - service_id
61
+ # * ID of the service that sent the airtime
62
+ # * Read-only
63
+ #
64
+ # - project_id
65
+ # * ID of the project that the airtime transaction belongs to
66
+ # * Read-only
67
+ #
68
+ # - external_id
69
+ # * The ID of this transaction from an external airtime gateway provider, if available.
70
+ # * Read-only
71
+ #
72
+ # - vars (Hash)
73
+ # * Custom variables stored for this transaction
74
+ # * Updatable via API
75
+ #
76
+ class AirtimeTransaction < Entity
77
+ def id
78
+ get('id')
79
+ end
80
+
81
+ def to_number
82
+ get('to_number')
83
+ end
84
+
85
+ def operator_name
86
+ get('operator_name')
87
+ end
88
+
89
+ def country
90
+ get('country')
91
+ end
92
+
93
+ def status
94
+ get('status')
95
+ end
96
+
97
+ def status_text
98
+ get('status_text')
99
+ end
100
+
101
+ def value
102
+ get('value')
103
+ end
104
+
105
+ def value_currency
106
+ get('value_currency')
107
+ end
108
+
109
+ def price
110
+ get('price')
111
+ end
112
+
113
+ def price_currency
114
+ get('price_currency')
115
+ end
116
+
117
+ def contact_id
118
+ get('contact_id')
119
+ end
120
+
121
+ def service_id
122
+ get('service_id')
123
+ end
124
+
125
+ def project_id
126
+ get('project_id')
127
+ end
128
+
129
+ def external_id
130
+ get('external_id')
131
+ end
132
+
133
+ def get_base_api_path()
134
+ "/projects/#{get('project_id')}/airtime_transactions/#{get('id')}"
135
+ end
136
+
137
+ end
138
+
139
+ end
@@ -75,7 +75,7 @@ module Telerivet
75
75
  #
76
76
  # - message_type
77
77
  # * Type of message sent from this broadcast
78
- # * Allowed values: sms, mms, ussd, call
78
+ # * Allowed values: sms, mms, ussd, call, service
79
79
  # * Read-only
80
80
  #
81
81
  # - content (string)
@@ -109,7 +109,7 @@ module Telerivet
109
109
  #
110
110
  # - source
111
111
  # * How the message originated within Telerivet
112
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
112
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration
113
113
  # * Read-only
114
114
  #
115
115
  # - simulated (bool)
@@ -117,10 +117,29 @@ module Telerivet
117
117
  # sent to or received by a real phone)
118
118
  # * Read-only
119
119
  #
120
+ # - track_clicks (boolean)
121
+ # * If true, URLs in the message content will automatically be replaced with unique
122
+ # short URLs.
123
+ # * Read-only
124
+ #
125
+ # - clicked_count (int)
126
+ # * The number of messages in this broadcast containing short links that were clicked.
127
+ # At most one click per message is counted. If track_clicks is false, this property will
128
+ # be null.
129
+ # * Read-only
130
+ #
120
131
  # - label_ids (array)
121
132
  # * List of IDs of labels applied to all messages in the broadcast
122
133
  # * Read-only
123
134
  #
135
+ # - media (array)
136
+ # * For text messages containing media files, this is an array of objects with the
137
+ # properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
138
+ # Unknown properties are null. This property is undefined for messages that do not
139
+ # contain media files. Note: For files uploaded via the Telerivet web app, the URL is
140
+ # temporary and may not be valid for more than 1 day.
141
+ # * Read-only
142
+ #
124
143
  # - vars (Hash)
125
144
  # * Custom variables stored for this broadcast
126
145
  # * Read-only
@@ -147,6 +166,11 @@ module Telerivet
147
166
  # * ID of the phone or route used to send the broadcast (if applicable)
148
167
  # * Read-only
149
168
  #
169
+ # - service_id (string, max 34 characters)
170
+ # * The service associated with this broadcast (for voice calls, the service defines the
171
+ # call flow)
172
+ # * Read-only
173
+ #
150
174
  # - user_id (string, max 34 characters)
151
175
  # * ID of the Telerivet user who sent the broadcast (if applicable)
152
176
  # * Read-only
@@ -242,10 +266,22 @@ class Broadcast < Entity
242
266
  get('simulated')
243
267
  end
244
268
 
269
+ def track_clicks
270
+ get('track_clicks')
271
+ end
272
+
273
+ def clicked_count
274
+ get('clicked_count')
275
+ end
276
+
245
277
  def label_ids
246
278
  get('label_ids')
247
279
  end
248
280
 
281
+ def media
282
+ get('media')
283
+ end
284
+
249
285
  def price
250
286
  get('price')
251
287
  end
@@ -266,6 +302,10 @@ class Broadcast < Entity
266
302
  get('route_id')
267
303
  end
268
304
 
305
+ def service_id
306
+ get('service_id')
307
+ end
308
+
269
309
  def user_id
270
310
  get('user_id')
271
311
  end
@@ -19,10 +19,19 @@ module Telerivet
19
19
  # * Time the contact was added in Telerivet
20
20
  # * Read-only
21
21
  #
22
+ # - time_updated (UNIX timestamp)
23
+ # * Time the contact was last updated in Telerivet
24
+ # * Read-only
25
+ #
22
26
  # - send_blocked (bool)
23
27
  # * True if Telerivet is blocked from sending messages to this contact
24
28
  # * Updatable via API
25
29
  #
30
+ # - conversation_status
31
+ # * Current status of the conversation with this contact
32
+ # * Allowed values: closed, active, handled
33
+ # * Updatable via API
34
+ #
26
35
  # - last_message_time (UNIX timestamp)
27
36
  # * Last time the contact sent or received a message (null if no messages have been sent
28
37
  # or received)
@@ -125,11 +134,12 @@ class Contact < Entity
125
134
  #
126
135
  # - message_type
127
136
  # * Filter messages by message_type
128
- # * Allowed values: sms, mms, ussd, call
137
+ # * Allowed values: sms, mms, ussd, call, service
129
138
  #
130
139
  # - source
131
140
  # * Filter messages by source
132
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
141
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
142
+ # integration
133
143
  #
134
144
  # - starred (bool)
135
145
  # * Filter messages by starred/unstarred
@@ -157,6 +167,9 @@ class Contact < Entity
157
167
  # - broadcast_id
158
168
  # * ID of the broadcast containing the message
159
169
  #
170
+ # - scheduled_id
171
+ # * ID of the scheduled message that created this message
172
+ #
160
173
  # - sort
161
174
  # * Sort the results based on a field
162
175
  # * Allowed values: default
@@ -168,7 +181,7 @@ class Contact < Entity
168
181
  # * Default: asc
169
182
  #
170
183
  # - page_size (int)
171
- # * Number of results returned per page (max 200)
184
+ # * Number of results returned per page (max 500)
172
185
  # * Default: 50
173
186
  #
174
187
  # - offset (int)
@@ -208,7 +221,7 @@ class Contact < Entity
208
221
  # * Default: asc
209
222
  #
210
223
  # - page_size (int)
211
- # * Number of results returned per page (max 200)
224
+ # * Number of results returned per page (max 500)
212
225
  # * Default: 50
213
226
  #
214
227
  # - offset (int)
@@ -232,7 +245,7 @@ class Contact < Entity
232
245
  #
233
246
  # - message_type
234
247
  # * Filter scheduled messages by message_type
235
- # * Allowed values: sms, mms, ussd, call
248
+ # * Allowed values: sms, mms, ussd, call, service
236
249
  #
237
250
  # - time_created (UNIX timestamp)
238
251
  # * Filter scheduled messages by time_created
@@ -240,8 +253,8 @@ class Contact < Entity
240
253
  #
241
254
  # - next_time (UNIX timestamp)
242
255
  # * Filter scheduled messages by next_time
243
- # * Allowed modifiers: next_time[exists], next_time[ne], next_time[min],
244
- # next_time[max]
256
+ # * Allowed modifiers: next_time[ne], next_time[min], next_time[max],
257
+ # next_time[exists]
245
258
  #
246
259
  # - sort
247
260
  # * Sort the results based on a field
@@ -254,7 +267,7 @@ class Contact < Entity
254
267
  # * Default: asc
255
268
  #
256
269
  # - page_size (int)
257
- # * Number of results returned per page (max 200)
270
+ # * Number of results returned per page (max 500)
258
271
  # * Default: 50
259
272
  #
260
273
  # - offset (int)
@@ -290,7 +303,7 @@ class Contact < Entity
290
303
  # * Default: asc
291
304
  #
292
305
  # - page_size (int)
293
- # * Number of results returned per page (max 200)
306
+ # * Number of results returned per page (max 500)
294
307
  # * Default: 50
295
308
  #
296
309
  # - offset (int)
@@ -318,9 +331,9 @@ class Contact < Entity
318
331
  #
319
332
  # - vars (Hash)
320
333
  # * Filter states by value of a custom variable (e.g. vars[email], vars[foo], etc.)
321
- # * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
322
- # vars[foo][not_prefix], vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte],
323
- # vars[foo][min], vars[foo][max]
334
+ # * Allowed modifiers: vars[foo][ne], vars[foo][prefix], vars[foo][not_prefix],
335
+ # vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte], vars[foo][min],
336
+ # vars[foo][max], vars[foo][exists]
324
337
  #
325
338
  # - sort
326
339
  # * Sort the results based on a field
@@ -333,7 +346,7 @@ class Contact < Entity
333
346
  # * Default: asc
334
347
  #
335
348
  # - page_size (int)
336
- # * Number of results returned per page (max 200)
349
+ # * Number of results returned per page (max 500)
337
350
  # * Default: 50
338
351
  #
339
352
  # - offset (int)
@@ -386,6 +399,10 @@ class Contact < Entity
386
399
  get('time_created')
387
400
  end
388
401
 
402
+ def time_updated
403
+ get('time_updated')
404
+ end
405
+
389
406
  def send_blocked
390
407
  get('send_blocked')
391
408
  end
@@ -394,6 +411,14 @@ class Contact < Entity
394
411
  set('send_blocked', value)
395
412
  end
396
413
 
414
+ def conversation_status
415
+ get('conversation_status')
416
+ end
417
+
418
+ def conversation_status=(value)
419
+ set('conversation_status', value)
420
+ end
421
+
397
422
  def last_message_time
398
423
  get('last_message_time')
399
424
  end
@@ -22,9 +22,22 @@ module Telerivet
22
22
  # * Updatable via API
23
23
  #
24
24
  # - num_rows (int)
25
- # * Number of rows in the table
25
+ # * Number of rows in the table. For performance reasons, this number may sometimes be
26
+ # out-of-date.
26
27
  # * Read-only
27
28
  #
29
+ # - show_add_row (bool)
30
+ # * Whether to allow adding or importing rows via the web app
31
+ # * Updatable via API
32
+ #
33
+ # - show_stats (bool)
34
+ # * Whether to show row statistics in the web app
35
+ # * Updatable via API
36
+ #
37
+ # - show_contact_columns (bool)
38
+ # * Whether to show 'Contact Name' and 'Phone Number' columns in the web app
39
+ # * Updatable via API
40
+ #
28
41
  # - vars (Hash)
29
42
  # * Custom variables stored for this data table
30
43
  # * Updatable via API
@@ -49,9 +62,9 @@ class DataTable < Entity
49
62
  #
50
63
  # - vars (Hash)
51
64
  # * Filter data rows by value of a custom variable (e.g. vars[q1], vars[foo], etc.)
52
- # * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
53
- # vars[foo][not_prefix], vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte],
54
- # vars[foo][min], vars[foo][max]
65
+ # * Allowed modifiers: vars[foo][ne], vars[foo][prefix], vars[foo][not_prefix],
66
+ # vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte], vars[foo][min],
67
+ # vars[foo][max], vars[foo][exists]
55
68
  #
56
69
  # - sort
57
70
  # * Sort the results based on a field
@@ -64,7 +77,7 @@ class DataTable < Entity
64
77
  # * Default: asc
65
78
  #
66
79
  # - page_size (int)
67
- # * Number of results returned per page (max 200)
80
+ # * Number of results returned per page (max 500)
68
81
  # * Default: 50
69
82
  #
70
83
  # - offset (int)
@@ -136,8 +149,9 @@ class DataTable < Entity
136
149
 
137
150
  #
138
151
  # Gets a list of all fields (columns) defined for this data table. The return value is an
139
- # array of objects with the properties 'name' and 'variable'. (Fields are automatically
140
- # created any time a DataRow's 'vars' property is updated.)
152
+ # array of objects with the properties 'name', 'variable', 'type', 'order', 'readonly', and
153
+ # 'lookup_key'. (Fields are automatically created any time a DataRow's 'vars' property is
154
+ # updated.)
141
155
  #
142
156
  # Returns:
143
157
  # array
@@ -146,6 +160,37 @@ class DataTable < Entity
146
160
  return @api.do_request("GET", get_base_api_path() + "/fields")
147
161
  end
148
162
 
163
+ #
164
+ # Allows customizing how a field (column) is displayed in the Telerivet web app.
165
+ #
166
+ # Arguments:
167
+ # - variable
168
+ # * The variable name of the field to create or update.
169
+ # * Required
170
+ #
171
+ # - options (Hash)
172
+ #
173
+ # - name (string, max 64 characters)
174
+ # * Display name for the field
175
+ #
176
+ # - type (string)
177
+ # * Field type
178
+ # * Allowed values: text, long_text, number, boolean, email, url, audio, phone_number,
179
+ # date, date_time, groups, route, select, buttons, contact
180
+ #
181
+ # - order (int)
182
+ # * Order in which to display the field
183
+ #
184
+ # - readonly (bool)
185
+ # * Set to true to prevent editing the field in the Telerivet web app
186
+ #
187
+ # Returns:
188
+ # object
189
+ #
190
+ def set_field_metadata(variable, options = nil)
191
+ return @api.do_request("POST", get_base_api_path() + "/fields/#{variable}", options)
192
+ end
193
+
149
194
  #
150
195
  # Returns the number of rows for each value of a given variable. This can be used to get the
151
196
  # total number of responses for each choice in a poll, without making a separate query for
@@ -194,6 +239,30 @@ class DataTable < Entity
194
239
  get('num_rows')
195
240
  end
196
241
 
242
+ def show_add_row
243
+ get('show_add_row')
244
+ end
245
+
246
+ def show_add_row=(value)
247
+ set('show_add_row', value)
248
+ end
249
+
250
+ def show_stats
251
+ get('show_stats')
252
+ end
253
+
254
+ def show_stats=(value)
255
+ set('show_stats', value)
256
+ end
257
+
258
+ def show_contact_columns
259
+ get('show_contact_columns')
260
+ end
261
+
262
+ def show_contact_columns=(value)
263
+ set('show_contact_columns', value)
264
+ end
265
+
197
266
  def project_id
198
267
  get('project_id')
199
268
  end