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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53eb2eb3eda20f383f980d2b94f38955f16ae139b588b14ad547dbbd371642f9
|
4
|
+
data.tar.gz: d65a986a9fa2e2ed62bb0245595ad7d3d76bc607774f13314efd64b4d2405762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 748e80a811e0791268fb144fec9eca46e8c0beaea561d616a21c01b461d3baf4ca1063ead62ed9c6b9ce9070036f3db46b133878bc2d021dad8b7d010cf24d89
|
7
|
+
data.tar.gz: 85630bd869da8d7a42c0ef137d2e95c583b47796e4efbe581c86ebf15542022a08f2d27d42a97b5efc7007008525ad5ba5756a4f714b86ab4b6ef734deac200d
|
data/lib/cacert.pem
CHANGED
File without changes
|
@@ -28,9 +28,17 @@ module Telerivet
|
|
28
28
|
# * Country code
|
29
29
|
# * Read-only
|
30
30
|
#
|
31
|
+
# - time_created (UNIX timestamp)
|
32
|
+
# * The time that the airtime transaction was created on Telerivet's servers
|
33
|
+
# * Read-only
|
34
|
+
#
|
35
|
+
# - transaction_time (UNIX timestamp)
|
36
|
+
# * The time that the airtime transaction was sent, or null if it has not been sent
|
37
|
+
# * Read-only
|
38
|
+
#
|
31
39
|
# - status
|
32
40
|
# * Current status of airtime transaction (`successful`, `failed`, `cancelled`,
|
33
|
-
# `queued`, `pending_approval`, or `pending_payment`)
|
41
|
+
# `queued`, `processing`, `submitted`, `pending_approval`, or `pending_payment`)
|
34
42
|
# * Read-only
|
35
43
|
#
|
36
44
|
# - status_text
|
@@ -69,8 +77,17 @@ module Telerivet
|
|
69
77
|
# * The ID of this transaction from an external airtime gateway provider, if available.
|
70
78
|
# * Read-only
|
71
79
|
#
|
80
|
+
# - user_id (string, max 34 characters)
|
81
|
+
# * ID of the Telerivet user who sent the airtime transaction (if applicable)
|
82
|
+
# * Read-only
|
83
|
+
#
|
72
84
|
# - vars (Hash)
|
73
|
-
# * Custom variables stored for this transaction
|
85
|
+
# * Custom variables stored for this transaction. Variable names may be up to 32
|
86
|
+
# characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
87
|
+
# Values may be strings, numbers, or boolean (true/false).
|
88
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
89
|
+
# Up to 100 variables are supported per object.
|
90
|
+
# Setting a variable to null will delete the variable.
|
74
91
|
# * Updatable via API
|
75
92
|
#
|
76
93
|
class AirtimeTransaction < Entity
|
@@ -90,6 +107,14 @@ class AirtimeTransaction < Entity
|
|
90
107
|
get('country')
|
91
108
|
end
|
92
109
|
|
110
|
+
def time_created
|
111
|
+
get('time_created')
|
112
|
+
end
|
113
|
+
|
114
|
+
def transaction_time
|
115
|
+
get('transaction_time')
|
116
|
+
end
|
117
|
+
|
93
118
|
def status
|
94
119
|
get('status')
|
95
120
|
end
|
@@ -130,6 +155,10 @@ class AirtimeTransaction < Entity
|
|
130
155
|
get('external_id')
|
131
156
|
end
|
132
157
|
|
158
|
+
def user_id
|
159
|
+
get('user_id')
|
160
|
+
end
|
161
|
+
|
133
162
|
def get_base_api_path()
|
134
163
|
"/projects/#{get('project_id')}/airtime_transactions/#{get('id')}"
|
135
164
|
end
|
data/lib/telerivet/apicursor.rb
CHANGED
@@ -13,16 +13,16 @@ class APICursor
|
|
13
13
|
|
14
14
|
def initialize(api, item_cls, path, params = nil)
|
15
15
|
params ||= {}
|
16
|
-
|
16
|
+
|
17
17
|
if params.has_key?('count')
|
18
18
|
raise Exception, "Cannot construct APICursor with 'count' parameter. Call the count() method instead."
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
@api = api
|
22
22
|
@item_cls = item_cls
|
23
23
|
@path = path
|
24
24
|
@params = params
|
25
|
-
|
25
|
+
|
26
26
|
@count = -1
|
27
27
|
@pos = nil
|
28
28
|
@data = nil
|
@@ -31,15 +31,15 @@ class APICursor
|
|
31
31
|
@limit = nil
|
32
32
|
@offset = 0
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def each()
|
36
36
|
loop do
|
37
37
|
item = self.next()
|
38
|
-
return if item == nil
|
38
|
+
return if item == nil
|
39
39
|
yield item
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
#
|
44
44
|
# Limits the maximum number of entities fetched by this query.
|
45
45
|
#
|
@@ -60,7 +60,7 @@ class APICursor
|
|
60
60
|
@limit = _limit
|
61
61
|
self
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
#
|
65
65
|
# Returns the total count of entities matching the current query, without actually fetching
|
66
66
|
# the entities themselves.
|
@@ -76,13 +76,13 @@ class APICursor
|
|
76
76
|
if @count == -1
|
77
77
|
params = @params.clone
|
78
78
|
params['count'] = 1
|
79
|
-
|
79
|
+
|
80
80
|
res = @api.do_request("GET", @path, params)
|
81
81
|
@count = res['count'].to_i
|
82
82
|
end
|
83
83
|
@count
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
def all()
|
87
87
|
to_a
|
88
88
|
end
|
@@ -97,37 +97,41 @@ class APICursor
|
|
97
97
|
return false if @limit != nil && @offset >= @limit
|
98
98
|
|
99
99
|
load_next_page() if @data == nil
|
100
|
-
|
100
|
+
|
101
101
|
return true if @pos < @data.length
|
102
|
-
|
102
|
+
|
103
103
|
return false if !@truncated
|
104
|
-
|
104
|
+
|
105
105
|
load_next_page()
|
106
|
-
|
106
|
+
|
107
107
|
@pos < @data.length
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
#
|
111
111
|
# Returns the next entity in the result set.
|
112
112
|
#
|
113
113
|
# Returns:
|
114
114
|
# Telerivet::Entity
|
115
115
|
#
|
116
|
-
def next()
|
116
|
+
def next()
|
117
117
|
if @limit != nil && @offset >= @limit
|
118
118
|
return nil
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
if @data == nil || (@pos >= @data.length && @truncated)
|
122
122
|
load_next_page()
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
if @pos < @data.length
|
126
126
|
item_data = @data[@pos]
|
127
127
|
@pos += 1
|
128
128
|
@offset += 1
|
129
129
|
cls = @item_cls
|
130
|
-
|
130
|
+
if cls
|
131
|
+
return cls.new(@api, item_data, true)
|
132
|
+
else
|
133
|
+
return item_data
|
134
|
+
end
|
131
135
|
else
|
132
136
|
return nil
|
133
137
|
end
|
@@ -135,17 +139,17 @@ class APICursor
|
|
135
139
|
|
136
140
|
def load_next_page()
|
137
141
|
request_params = @params.clone
|
138
|
-
|
142
|
+
|
139
143
|
if @next_marker != nil
|
140
144
|
request_params['marker'] = @next_marker
|
141
145
|
end
|
142
|
-
|
146
|
+
|
143
147
|
if @limit != nil && !request_params.has_key?("page_size")
|
144
148
|
request_params['page_size'] = [@limit, 200].min
|
145
149
|
end
|
146
|
-
|
150
|
+
|
147
151
|
response = @api.do_request("GET", @path, request_params)
|
148
|
-
|
152
|
+
|
149
153
|
@data = response['data']
|
150
154
|
@truncated = response['truncated']
|
151
155
|
@next_marker = response['next_marker']
|
data/lib/telerivet/broadcast.rb
CHANGED
@@ -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, service
|
78
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
79
79
|
# * Read-only
|
80
80
|
#
|
81
81
|
# - content (string)
|
@@ -97,7 +97,7 @@ module Telerivet
|
|
97
97
|
# * Allowed values: female, male
|
98
98
|
# * Read-only
|
99
99
|
#
|
100
|
-
# -
|
100
|
+
# - replace_variables (bool)
|
101
101
|
# * Set to true if Telerivet will render variables like [[contact.name]] in the message
|
102
102
|
# content, false otherwise
|
103
103
|
# * Read-only
|
@@ -141,14 +141,22 @@ module Telerivet
|
|
141
141
|
# * Read-only
|
142
142
|
#
|
143
143
|
# - vars (Hash)
|
144
|
-
# * Custom variables stored for this broadcast
|
144
|
+
# * Custom variables stored for this broadcast. Variable names may be up to 32
|
145
|
+
# characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
146
|
+
# Values may be strings, numbers, or boolean (true/false).
|
147
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
148
|
+
# Up to 100 variables are supported per object.
|
149
|
+
# Setting a variable to null will delete the variable.
|
145
150
|
# * Read-only
|
146
151
|
#
|
147
152
|
# - route_params (Hash)
|
148
|
-
# * Route-specific parameters for the messages in the broadcast.
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
153
|
+
# * Route-specific parameters for the messages in the broadcast.
|
154
|
+
#
|
155
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
156
|
+
# parameter can be used to send messages with app-specific features such as quick
|
157
|
+
# replies and link buttons.
|
158
|
+
#
|
159
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
152
160
|
# * Read-only
|
153
161
|
#
|
154
162
|
# - price (number)
|
@@ -257,8 +265,8 @@ class Broadcast < Entity
|
|
257
265
|
get('tts_voice')
|
258
266
|
end
|
259
267
|
|
260
|
-
def
|
261
|
-
get('
|
268
|
+
def replace_variables
|
269
|
+
get('replace_variables')
|
262
270
|
end
|
263
271
|
|
264
272
|
def status
|
data/lib/telerivet/contact.rb
CHANGED
@@ -63,8 +63,8 @@ module Telerivet
|
|
63
63
|
# * Read-only
|
64
64
|
#
|
65
65
|
# - default_route_id
|
66
|
-
# * ID of the phone or route that Telerivet will use by default to
|
67
|
-
# contact (null if using project default route)
|
66
|
+
# * ID of the basic route (phone) or custom route that Telerivet will use by default to
|
67
|
+
# send messages to this contact (null if using project default route)
|
68
68
|
# * Updatable via API
|
69
69
|
#
|
70
70
|
# - group_ids (array of strings)
|
@@ -72,7 +72,12 @@ module Telerivet
|
|
72
72
|
# * Read-only
|
73
73
|
#
|
74
74
|
# - vars (Hash)
|
75
|
-
# * Custom variables stored for this contact
|
75
|
+
# * Custom variables stored for this contact. Variable names may be up to 32 characters
|
76
|
+
# in length and can contain the characters a-z, A-Z, 0-9, and _.
|
77
|
+
# Values may be strings, numbers, or boolean (true/false).
|
78
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
79
|
+
# Up to 100 variables are supported per object.
|
80
|
+
# Setting a variable to null will delete the variable.
|
76
81
|
# * Updatable via API
|
77
82
|
#
|
78
83
|
# - project_id
|
@@ -134,7 +139,7 @@ class Contact < Entity
|
|
134
139
|
#
|
135
140
|
# - message_type
|
136
141
|
# * Filter messages by message_type
|
137
|
-
# * Allowed values: sms, mms, ussd, call, service
|
142
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
138
143
|
#
|
139
144
|
# - source
|
140
145
|
# * Filter messages by source
|
@@ -253,7 +258,7 @@ class Contact < Entity
|
|
253
258
|
#
|
254
259
|
# - message_type
|
255
260
|
# * Filter scheduled messages by message_type
|
256
|
-
# * Allowed values: sms, mms, ussd, call, service
|
261
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
257
262
|
#
|
258
263
|
# - time_created (UNIX timestamp)
|
259
264
|
# * Filter scheduled messages by time_created
|
@@ -263,6 +268,9 @@ class Contact < Entity
|
|
263
268
|
# * Filter scheduled messages by next_time
|
264
269
|
# * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
|
265
270
|
#
|
271
|
+
# - relative_scheduled_id
|
272
|
+
# * Filter scheduled messages created for a relative scheduled message
|
273
|
+
#
|
266
274
|
# - sort
|
267
275
|
# * Sort the results based on a field
|
268
276
|
# * Allowed values: default, next_time
|
@@ -40,7 +40,12 @@ module Telerivet
|
|
40
40
|
# * Read-only
|
41
41
|
#
|
42
42
|
# - vars (Hash)
|
43
|
-
# * Custom variables stored for this contact/service state
|
43
|
+
# * Custom variables stored for this contact/service state. Variable names may be up to
|
44
|
+
# 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
45
|
+
# Values may be strings, numbers, or boolean (true/false).
|
46
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
47
|
+
# Up to 100 variables are supported per object.
|
48
|
+
# Setting a variable to null will delete the variable.
|
44
49
|
# * Updatable via API
|
45
50
|
#
|
46
51
|
# - time_created (UNIX timestamp)
|
data/lib/telerivet/datarow.rb
CHANGED
@@ -28,7 +28,12 @@ module Telerivet
|
|
28
28
|
# * Updatable via API
|
29
29
|
#
|
30
30
|
# - vars (Hash)
|
31
|
-
# * Custom variables stored for this data row
|
31
|
+
# * Custom variables stored for this data row. Variable names may be up to 32 characters
|
32
|
+
# in length and can contain the characters a-z, A-Z, 0-9, and _.
|
33
|
+
# Values may be strings, numbers, or boolean (true/false).
|
34
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
35
|
+
# Up to 100 variables are supported per object.
|
36
|
+
# Setting a variable to null will delete the variable.
|
32
37
|
# * Updatable via API
|
33
38
|
#
|
34
39
|
# - time_created (UNIX timestamp)
|
data/lib/telerivet/datatable.rb
CHANGED
@@ -31,7 +31,8 @@ module Telerivet
|
|
31
31
|
# * Updatable via API
|
32
32
|
#
|
33
33
|
# - show_stats (bool)
|
34
|
-
# * Whether to show
|
34
|
+
# * Whether to show summary charts (pie charts, bar charts, tables of top values) for
|
35
|
+
# this data table in the web app
|
35
36
|
# * Updatable via API
|
36
37
|
#
|
37
38
|
# - show_contact_columns (bool)
|
@@ -39,7 +40,12 @@ module Telerivet
|
|
39
40
|
# * Updatable via API
|
40
41
|
#
|
41
42
|
# - vars (Hash)
|
42
|
-
# * Custom variables stored for this data table
|
43
|
+
# * Custom variables stored for this data table. Variable names may be up to 32
|
44
|
+
# characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
45
|
+
# Values may be strings, numbers, or boolean (true/false).
|
46
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
47
|
+
# Up to 100 variables are supported per object.
|
48
|
+
# Setting a variable to null will delete the variable.
|
43
49
|
# * Updatable via API
|
44
50
|
#
|
45
51
|
# - project_id
|
@@ -105,7 +111,12 @@ class DataTable < Entity
|
|
105
111
|
# * Phone number that this row is associated with (if applicable)
|
106
112
|
#
|
107
113
|
# - vars
|
108
|
-
# * Custom variables and values to set for this data row
|
114
|
+
# * Custom variables and values to set for this data row. Variable names may be up to
|
115
|
+
# 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
116
|
+
# Values may be strings, numbers, or boolean (true/false).
|
117
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
118
|
+
# Up to 100 variables are supported per object.
|
119
|
+
# Setting a variable to null will delete the variable.
|
109
120
|
#
|
110
121
|
# Returns:
|
111
122
|
# Telerivet::DataRow
|
@@ -163,6 +174,9 @@ class DataTable < Entity
|
|
163
174
|
#
|
164
175
|
# Allows customizing how a field (column) is displayed in the Telerivet web app.
|
165
176
|
#
|
177
|
+
# The variable path parameter can contain the characters a-z, A-Z,
|
178
|
+
# 0-9, and _, and may be up to 32 characters in length.
|
179
|
+
#
|
166
180
|
# Arguments:
|
167
181
|
# - variable
|
168
182
|
# * The variable name of the field to create or update.
|
@@ -176,8 +190,8 @@ class DataTable < Entity
|
|
176
190
|
#
|
177
191
|
# - type (string)
|
178
192
|
# * Field type
|
179
|
-
# * Allowed values: text, long_text, phone_number, email, url, audio, date,
|
180
|
-
# number, boolean, select
|
193
|
+
# * Allowed values: text, long_text, secret, phone_number, email, url, audio, date,
|
194
|
+
# date_time, number, boolean, checkbox, select, radio, route
|
181
195
|
#
|
182
196
|
# - order (int)
|
183
197
|
# * Order in which to display the field
|
data/lib/telerivet/entity.rb
CHANGED
File without changes
|
data/lib/telerivet/group.rb
CHANGED
@@ -26,8 +26,23 @@ module Telerivet
|
|
26
26
|
# * Time the group was created in Telerivet
|
27
27
|
# * Read-only
|
28
28
|
#
|
29
|
+
# - allow_sending (bool)
|
30
|
+
# * True if messages can be sent to this group, false otherwise.
|
31
|
+
# * Updatable via API
|
32
|
+
#
|
33
|
+
# - add_time_variable (string)
|
34
|
+
# * Variable name of a custom contact field that will automatically be set to the
|
35
|
+
# current date/time on any contact that is added to the group. This variable will only
|
36
|
+
# be set if the contact does not already have a value for this variable.
|
37
|
+
# * Updatable via API
|
38
|
+
#
|
29
39
|
# - vars (Hash)
|
30
|
-
# * Custom variables stored for this group
|
40
|
+
# * Custom variables stored for this group. Variable names may be up to 32 characters in
|
41
|
+
# length and can contain the characters a-z, A-Z, 0-9, and _.
|
42
|
+
# Values may be strings, numbers, or boolean (true/false).
|
43
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
44
|
+
# Up to 100 variables are supported per object.
|
45
|
+
# Setting a variable to null will delete the variable.
|
31
46
|
# * Updatable via API
|
32
47
|
#
|
33
48
|
# - project_id
|
@@ -124,7 +139,7 @@ class Group < Entity
|
|
124
139
|
#
|
125
140
|
# - message_type
|
126
141
|
# * Filter scheduled messages by message_type
|
127
|
-
# * Allowed values: sms, mms, ussd, call, service
|
142
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
128
143
|
#
|
129
144
|
# - time_created (UNIX timestamp)
|
130
145
|
# * Filter scheduled messages by time_created
|
@@ -134,6 +149,9 @@ class Group < Entity
|
|
134
149
|
# * Filter scheduled messages by next_time
|
135
150
|
# * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
|
136
151
|
#
|
152
|
+
# - relative_scheduled_id
|
153
|
+
# * Filter scheduled messages created for a relative scheduled message
|
154
|
+
#
|
137
155
|
# - sort
|
138
156
|
# * Sort the results based on a field
|
139
157
|
# * Allowed values: default, next_time
|
@@ -198,6 +216,22 @@ class Group < Entity
|
|
198
216
|
get('time_created')
|
199
217
|
end
|
200
218
|
|
219
|
+
def allow_sending
|
220
|
+
get('allow_sending')
|
221
|
+
end
|
222
|
+
|
223
|
+
def allow_sending=(value)
|
224
|
+
set('allow_sending', value)
|
225
|
+
end
|
226
|
+
|
227
|
+
def add_time_variable
|
228
|
+
get('add_time_variable')
|
229
|
+
end
|
230
|
+
|
231
|
+
def add_time_variable=(value)
|
232
|
+
set('add_time_variable', value)
|
233
|
+
end
|
234
|
+
|
201
235
|
def project_id
|
202
236
|
get('project_id')
|
203
237
|
end
|
data/lib/telerivet/label.rb
CHANGED
@@ -19,7 +19,12 @@ module Telerivet
|
|
19
19
|
# * Read-only
|
20
20
|
#
|
21
21
|
# - vars (Hash)
|
22
|
-
# * Custom variables stored for this label
|
22
|
+
# * Custom variables stored for this label. Variable names may be up to 32 characters in
|
23
|
+
# length and can contain the characters a-z, A-Z, 0-9, and _.
|
24
|
+
# Values may be strings, numbers, or boolean (true/false).
|
25
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
26
|
+
# Up to 100 variables are supported per object.
|
27
|
+
# Setting a variable to null will delete the variable.
|
23
28
|
# * Updatable via API
|
24
29
|
#
|
25
30
|
# - project_id
|
@@ -39,7 +44,7 @@ class Label < Entity
|
|
39
44
|
#
|
40
45
|
# - message_type
|
41
46
|
# * Filter messages by message_type
|
42
|
-
# * Allowed values: sms, mms, ussd, call, service
|
47
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
43
48
|
#
|
44
49
|
# - source
|
45
50
|
# * Filter messages by source
|
data/lib/telerivet/message.rb
CHANGED
@@ -23,7 +23,7 @@ module Telerivet
|
|
23
23
|
#
|
24
24
|
# - message_type
|
25
25
|
# * Type of the message
|
26
|
-
# * Allowed values: sms, mms, ussd, call, service
|
26
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
27
27
|
# * Read-only
|
28
28
|
#
|
29
29
|
# - source
|
@@ -72,14 +72,22 @@ module Telerivet
|
|
72
72
|
# * Read-only
|
73
73
|
#
|
74
74
|
# - route_params (Hash)
|
75
|
-
# * Route-specific parameters for the message.
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
75
|
+
# * Route-specific parameters for the message.
|
76
|
+
#
|
77
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
78
|
+
# parameter can be used to send messages with app-specific features such as quick
|
79
|
+
# replies and link buttons.
|
80
|
+
#
|
81
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
79
82
|
# * Read-only
|
80
83
|
#
|
81
84
|
# - vars (Hash)
|
82
|
-
# * Custom variables stored for this message
|
85
|
+
# * Custom variables stored for this message. Variable names may be up to 32 characters
|
86
|
+
# in length and can contain the characters a-z, A-Z, 0-9, and _.
|
87
|
+
# Values may be strings, numbers, or boolean (true/false).
|
88
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
89
|
+
# Up to 100 variables are supported per object.
|
90
|
+
# Setting a variable to null will delete the variable.
|
83
91
|
# * Updatable via API
|
84
92
|
#
|
85
93
|
# - priority (int)
|
@@ -92,9 +100,20 @@ module Telerivet
|
|
92
100
|
# omitted from the API response if there is no error message.)
|
93
101
|
# * Updatable via API
|
94
102
|
#
|
103
|
+
# - error_code
|
104
|
+
# * A route-specific error code encountered while sending a message. The error code
|
105
|
+
# values depend on the provider and may be described in the provider's API
|
106
|
+
# documentation. Error codes may be strings or numbers, depending on the provider. (This
|
107
|
+
# field is omitted from the API response if there is no error code.)
|
108
|
+
# * Read-only
|
109
|
+
#
|
95
110
|
# - external_id
|
96
|
-
# * The ID of this message from an external SMS gateway provider (e.g. Twilio or
|
97
|
-
# if available.
|
111
|
+
# * The ID of this message from an external SMS gateway provider (e.g. Twilio or
|
112
|
+
# Vonage), if available.
|
113
|
+
# * Read-only
|
114
|
+
#
|
115
|
+
# - num_parts (number)
|
116
|
+
# * The number of SMS parts associated with the message, if applicable and if known.
|
98
117
|
# * Read-only
|
99
118
|
#
|
100
119
|
# - price (number)
|
@@ -144,6 +163,16 @@ module Telerivet
|
|
144
163
|
# undefined for messages that do not contain short URLs.
|
145
164
|
# * Read-only
|
146
165
|
#
|
166
|
+
# - network_code (string)
|
167
|
+
# * A string identifying the network that sent or received the message, if known. For
|
168
|
+
# mobile networks, this string contains the 3-digit mobile country code (MCC) followed
|
169
|
+
# by the 2- or 3-digit mobile network code (MNC), which results in a 5- or 6-digit
|
170
|
+
# number. For lists of mobile network operators and their corresponding MCC/MNC values,
|
171
|
+
# see [Mobile country code Wikipedia
|
172
|
+
# article](https://en.wikipedia.org/wiki/Mobile_country_code). The network_code property
|
173
|
+
# may be non-numeric for messages not sent via mobile networks.
|
174
|
+
# * Read-only
|
175
|
+
#
|
147
176
|
# - media (array)
|
148
177
|
# * For text messages containing media files, this is an array of objects with the
|
149
178
|
# properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
|
@@ -396,10 +425,18 @@ class Message < Entity
|
|
396
425
|
set('error_message', value)
|
397
426
|
end
|
398
427
|
|
428
|
+
def error_code
|
429
|
+
get('error_code')
|
430
|
+
end
|
431
|
+
|
399
432
|
def external_id
|
400
433
|
get('external_id')
|
401
434
|
end
|
402
435
|
|
436
|
+
def num_parts
|
437
|
+
get('num_parts')
|
438
|
+
end
|
439
|
+
|
403
440
|
def price
|
404
441
|
get('price')
|
405
442
|
end
|
@@ -436,6 +473,10 @@ class Message < Entity
|
|
436
473
|
get('short_urls')
|
437
474
|
end
|
438
475
|
|
476
|
+
def network_code
|
477
|
+
get('network_code')
|
478
|
+
end
|
479
|
+
|
439
480
|
def media
|
440
481
|
get('media')
|
441
482
|
end
|
@@ -15,11 +15,53 @@ module Telerivet
|
|
15
15
|
# * Updatable via API
|
16
16
|
#
|
17
17
|
# - timezone_id
|
18
|
-
# * Billing quota time zone ID; see
|
19
|
-
#
|
18
|
+
# * Billing quota time zone ID; see [List of tz database time zones Wikipedia
|
19
|
+
# article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
20
20
|
# * Updatable via API
|
21
21
|
#
|
22
22
|
class Organization < Entity
|
23
|
+
#
|
24
|
+
# Creates a new project.
|
25
|
+
#
|
26
|
+
# Some project settings are not currently possible to configure via
|
27
|
+
# the API, and can only be edited via the web app after the project is created.
|
28
|
+
#
|
29
|
+
# Arguments:
|
30
|
+
# - options (Hash)
|
31
|
+
# * Required
|
32
|
+
#
|
33
|
+
# - name (string)
|
34
|
+
# * Name of the project to create, which must be unique in the organization.
|
35
|
+
# * Required
|
36
|
+
#
|
37
|
+
# - timezone_id
|
38
|
+
# * Default TZ database timezone ID; see [List of tz database time zones Wikipedia
|
39
|
+
# article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones). This timezone
|
40
|
+
# is used when computing statistics by date.
|
41
|
+
#
|
42
|
+
# - url_slug
|
43
|
+
# * Unique string used as a component of the project's URL in the Telerivet web app.
|
44
|
+
# If not provided, a URL slug will be generated automatically.
|
45
|
+
#
|
46
|
+
# - auto_create_contacts (bool)
|
47
|
+
# * If true, a contact will be automatically created for each unique phone number that
|
48
|
+
# a message is sent to or received from. If false, contacts will not automatically be
|
49
|
+
# created (unless contact information is modified by an automated service). The
|
50
|
+
# Conversations tab in the web app will only show messages that are associated with a
|
51
|
+
# contact.
|
52
|
+
# * Default: 1
|
53
|
+
#
|
54
|
+
# - vars
|
55
|
+
# * Custom variables and values to set for this project
|
56
|
+
#
|
57
|
+
# Returns:
|
58
|
+
# Telerivet::Project
|
59
|
+
#
|
60
|
+
def create_project(options)
|
61
|
+
require_relative 'project'
|
62
|
+
Project.new(@api, @api.do_request("POST", get_base_api_path() + "/projects", options))
|
63
|
+
end
|
64
|
+
|
23
65
|
#
|
24
66
|
# Saves any fields that have changed for this organization.
|
25
67
|
#
|