telerivet 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/cacert.pem +3895 -0
- data/lib/telerivet/apicursor.rb +156 -0
- data/lib/telerivet/contact.rb +403 -0
- data/lib/telerivet/contactservicestate.rb +108 -0
- data/lib/telerivet/datarow.rb +91 -0
- data/lib/telerivet/datatable.rb +191 -0
- data/lib/telerivet/entity.rb +124 -0
- data/lib/telerivet/group.rb +181 -0
- data/lib/telerivet/label.rb +134 -0
- data/lib/telerivet/message.rb +300 -0
- data/lib/telerivet/mobilemoneyreceipt.rb +187 -0
- data/lib/telerivet/phone.rb +229 -0
- data/lib/telerivet/project.rb +919 -0
- data/lib/telerivet/scheduledmessage.rb +185 -0
- data/lib/telerivet/service.rb +296 -0
- data/lib/telerivet.rb +193 -0
- metadata +59 -0
@@ -0,0 +1,300 @@
|
|
1
|
+
module Telerivet
|
2
|
+
|
3
|
+
#
|
4
|
+
# Represents a single message.
|
5
|
+
#
|
6
|
+
# Fields:
|
7
|
+
#
|
8
|
+
# - id (string, max 34 characters)
|
9
|
+
# * ID of the message
|
10
|
+
# * Read-only
|
11
|
+
#
|
12
|
+
# - direction
|
13
|
+
# * Direction of the message: incoming messages are sent from one of your contacts to
|
14
|
+
# your phone; outgoing messages are sent from your phone to one of your contacts
|
15
|
+
# * Allowed values: incoming, outgoing
|
16
|
+
# * Read-only
|
17
|
+
#
|
18
|
+
# - status
|
19
|
+
# * Current status of the message
|
20
|
+
# * Allowed values: ignored, processing, received, sent, queued, failed, failed_queued,
|
21
|
+
# cancelled, delivered, not_delivered
|
22
|
+
# * Read-only
|
23
|
+
#
|
24
|
+
# - message_type
|
25
|
+
# * Type of the message
|
26
|
+
# * Allowed values: sms, mms, ussd, call
|
27
|
+
# * Read-only
|
28
|
+
#
|
29
|
+
# - source
|
30
|
+
# * How the message originated within Telerivet
|
31
|
+
# * Allowed values: phone, provider, web, api, service, webhook, scheduled
|
32
|
+
# * Read-only
|
33
|
+
#
|
34
|
+
# - time_created (UNIX timestamp)
|
35
|
+
# * The time that the message was created on Telerivet's servers
|
36
|
+
# * Read-only
|
37
|
+
#
|
38
|
+
# - time_sent (UNIX timestamp)
|
39
|
+
# * The time that the message was reported to have been sent (null for incoming messages
|
40
|
+
# and messages that have not yet been sent)
|
41
|
+
# * Read-only
|
42
|
+
#
|
43
|
+
# - from_number (string)
|
44
|
+
# * The phone number that the message originated from (your number for outgoing
|
45
|
+
# messages, the contact's number for incoming messages)
|
46
|
+
# * Read-only
|
47
|
+
#
|
48
|
+
# - to_number (string)
|
49
|
+
# * The phone number that the message was sent to (your number for incoming messages,
|
50
|
+
# the contact's number for outgoing messages)
|
51
|
+
# * Read-only
|
52
|
+
#
|
53
|
+
# - content (string)
|
54
|
+
# * The text content of the message (null for USSD messages and calls)
|
55
|
+
# * Read-only
|
56
|
+
#
|
57
|
+
# - starred (bool)
|
58
|
+
# * Whether this message is starred in Telerivet
|
59
|
+
# * Updatable via API
|
60
|
+
#
|
61
|
+
# - simulated (bool)
|
62
|
+
# * Whether this message is was simulated within Telerivet for testing (and not actually
|
63
|
+
# sent to or received by a real phone)
|
64
|
+
# * Read-only
|
65
|
+
#
|
66
|
+
# - label_ids (array)
|
67
|
+
# * List of IDs of labels applied to this message
|
68
|
+
# * Read-only
|
69
|
+
#
|
70
|
+
# - vars (Hash)
|
71
|
+
# * Custom variables stored for this message
|
72
|
+
# * Updatable via API
|
73
|
+
#
|
74
|
+
# - error_message
|
75
|
+
# * A description of the error encountered while sending a message. (This field is
|
76
|
+
# omitted from the API response if there is no error message.)
|
77
|
+
# * Updatable via API
|
78
|
+
#
|
79
|
+
# - external_id
|
80
|
+
# * The ID of this message from an external SMS gateway provider (e.g. Twilio or Nexmo),
|
81
|
+
# if available.
|
82
|
+
# * Read-only
|
83
|
+
#
|
84
|
+
# - price
|
85
|
+
# * The price of this message, if known. By convention, message prices are negative.
|
86
|
+
# * Read-only
|
87
|
+
#
|
88
|
+
# - price_currency
|
89
|
+
# * The currency of the message price, if applicable.
|
90
|
+
# * Read-only
|
91
|
+
#
|
92
|
+
# - mms_parts (array)
|
93
|
+
# * A list of parts in the MMS message, the same as returned by the
|
94
|
+
# [getMMSParts](#Message.getMMSParts) method.
|
95
|
+
#
|
96
|
+
# Note: This property is only present when retrieving an individual
|
97
|
+
# MMS message by ID, not when querying a list of messages. In other cases, use
|
98
|
+
# [getMMSParts](#Message.getMMSParts).
|
99
|
+
# * Read-only
|
100
|
+
#
|
101
|
+
# - phone_id (string, max 34 characters)
|
102
|
+
# * ID of the phone that sent or received the message
|
103
|
+
# * Read-only
|
104
|
+
#
|
105
|
+
# - contact_id (string, max 34 characters)
|
106
|
+
# * ID of the contact that sent or received the message
|
107
|
+
# * Read-only
|
108
|
+
#
|
109
|
+
# - project_id
|
110
|
+
# * ID of the project this contact belongs to
|
111
|
+
# * Read-only
|
112
|
+
#
|
113
|
+
class Message < Entity
|
114
|
+
|
115
|
+
#
|
116
|
+
# Returns true if this message has a particular label, false otherwise.
|
117
|
+
#
|
118
|
+
# Arguments:
|
119
|
+
# - label (Telerivet::Label)
|
120
|
+
# * Required
|
121
|
+
#
|
122
|
+
# Returns:
|
123
|
+
# bool
|
124
|
+
#
|
125
|
+
def has_label?(label)
|
126
|
+
load_data()
|
127
|
+
return @label_ids_set.has_key?(label.id)
|
128
|
+
end
|
129
|
+
|
130
|
+
#
|
131
|
+
# Adds a label to the given message.
|
132
|
+
#
|
133
|
+
# Arguments:
|
134
|
+
# - label (Telerivet::Label)
|
135
|
+
# * Required
|
136
|
+
#
|
137
|
+
def add_label(label)
|
138
|
+
@api.do_request("PUT", label.get_base_api_path() + "/messages/" + get('id'));
|
139
|
+
@label_ids_set[label.id] = true
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# Removes a label from the given message.
|
144
|
+
#
|
145
|
+
# Arguments:
|
146
|
+
# - label (Telerivet::Label)
|
147
|
+
# * Required
|
148
|
+
#
|
149
|
+
def remove_label(label)
|
150
|
+
@api.do_request("DELETE", label.get_base_api_path() + "/messages/" + get('id'))
|
151
|
+
if @label_ids_set.has_key?(label.id)
|
152
|
+
@label_ids_set.delete(label.id)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Retrieves a list of MMS parts for this message (empty for non-MMS messages).
|
158
|
+
#
|
159
|
+
# Each MMS part in the list is an object with the following
|
160
|
+
# properties:
|
161
|
+
#
|
162
|
+
# - cid: MMS content-id
|
163
|
+
# - type: MIME type
|
164
|
+
# - filename: original filename
|
165
|
+
# - size (int): number of bytes
|
166
|
+
# - url: URL where the content for this part is stored (secret but
|
167
|
+
# publicly accessible, so you could link/embed it in a web page without having to re-host it
|
168
|
+
# yourself)
|
169
|
+
#
|
170
|
+
# Returns:
|
171
|
+
# array
|
172
|
+
#
|
173
|
+
def get_mmsparts()
|
174
|
+
return @api.do_request("GET", get_base_api_path() + "/mms_parts")
|
175
|
+
end
|
176
|
+
|
177
|
+
#
|
178
|
+
# Saves any fields that have changed for this message.
|
179
|
+
#
|
180
|
+
def save()
|
181
|
+
super
|
182
|
+
end
|
183
|
+
|
184
|
+
#
|
185
|
+
# Deletes this message.
|
186
|
+
#
|
187
|
+
def delete()
|
188
|
+
@api.do_request("DELETE", get_base_api_path())
|
189
|
+
end
|
190
|
+
|
191
|
+
def id
|
192
|
+
get('id')
|
193
|
+
end
|
194
|
+
|
195
|
+
def direction
|
196
|
+
get('direction')
|
197
|
+
end
|
198
|
+
|
199
|
+
def status
|
200
|
+
get('status')
|
201
|
+
end
|
202
|
+
|
203
|
+
def message_type
|
204
|
+
get('message_type')
|
205
|
+
end
|
206
|
+
|
207
|
+
def source
|
208
|
+
get('source')
|
209
|
+
end
|
210
|
+
|
211
|
+
def time_created
|
212
|
+
get('time_created')
|
213
|
+
end
|
214
|
+
|
215
|
+
def time_sent
|
216
|
+
get('time_sent')
|
217
|
+
end
|
218
|
+
|
219
|
+
def from_number
|
220
|
+
get('from_number')
|
221
|
+
end
|
222
|
+
|
223
|
+
def to_number
|
224
|
+
get('to_number')
|
225
|
+
end
|
226
|
+
|
227
|
+
def content
|
228
|
+
get('content')
|
229
|
+
end
|
230
|
+
|
231
|
+
def starred
|
232
|
+
get('starred')
|
233
|
+
end
|
234
|
+
|
235
|
+
def starred=(value)
|
236
|
+
set('starred', value)
|
237
|
+
end
|
238
|
+
|
239
|
+
def simulated
|
240
|
+
get('simulated')
|
241
|
+
end
|
242
|
+
|
243
|
+
def label_ids
|
244
|
+
get('label_ids')
|
245
|
+
end
|
246
|
+
|
247
|
+
def error_message
|
248
|
+
get('error_message')
|
249
|
+
end
|
250
|
+
|
251
|
+
def error_message=(value)
|
252
|
+
set('error_message', value)
|
253
|
+
end
|
254
|
+
|
255
|
+
def external_id
|
256
|
+
get('external_id')
|
257
|
+
end
|
258
|
+
|
259
|
+
def price
|
260
|
+
get('price')
|
261
|
+
end
|
262
|
+
|
263
|
+
def price_currency
|
264
|
+
get('price_currency')
|
265
|
+
end
|
266
|
+
|
267
|
+
def mms_parts
|
268
|
+
get('mms_parts')
|
269
|
+
end
|
270
|
+
|
271
|
+
def phone_id
|
272
|
+
get('phone_id')
|
273
|
+
end
|
274
|
+
|
275
|
+
def contact_id
|
276
|
+
get('contact_id')
|
277
|
+
end
|
278
|
+
|
279
|
+
def project_id
|
280
|
+
get('project_id')
|
281
|
+
end
|
282
|
+
|
283
|
+
def get_base_api_path()
|
284
|
+
"/projects/#{get('project_id')}/messages/#{get('id')}"
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
def set_data(data)
|
289
|
+
super
|
290
|
+
|
291
|
+
@label_ids_set = {}
|
292
|
+
|
293
|
+
if data.has_key?('label_ids')
|
294
|
+
data['label_ids'].each { |id| @label_ids_set[id] = true }
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
|
2
|
+
module Telerivet
|
3
|
+
|
4
|
+
#
|
5
|
+
# Represents a receipt received from a mobile money system such as Safaricom M-Pesa (Kenya),
|
6
|
+
# Vodacom M-Pesa (Tanzania), or Tigo Pesa (Tanzania).
|
7
|
+
#
|
8
|
+
# When your Android phone receives a SMS receipt from a supported mobile money
|
9
|
+
# service that Telerivet can understand, Telerivet will automatically parse it and create a
|
10
|
+
# MobileMoneyReceipt object.
|
11
|
+
#
|
12
|
+
# Fields:
|
13
|
+
#
|
14
|
+
# - id (string, max 34 characters)
|
15
|
+
# * Telerivet's internal ID for the receipt
|
16
|
+
# * Read-only
|
17
|
+
#
|
18
|
+
# - tx_id
|
19
|
+
# * Transaction ID from the receipt
|
20
|
+
# * Read-only
|
21
|
+
#
|
22
|
+
# - tx_type
|
23
|
+
# * Type of mobile money transaction
|
24
|
+
# * Allowed values: receive_money, send_money, pay_bill, deposit, withdrawal,
|
25
|
+
# airtime_purchase, balance_inquiry, reversal
|
26
|
+
# * Read-only
|
27
|
+
#
|
28
|
+
# - currency
|
29
|
+
# * [ISO 4217 Currency code](http://en.wikipedia.org/wiki/ISO_4217) for the transaction,
|
30
|
+
# e.g. KES or TZS. Amount, balance, and fee are expressed in units of this currency.
|
31
|
+
# * Read-only
|
32
|
+
#
|
33
|
+
# - amount (number)
|
34
|
+
# * Amount of this transaction; positive numbers indicate money added to your account,
|
35
|
+
# negative numbers indicate money removed from your account
|
36
|
+
# * Read-only
|
37
|
+
#
|
38
|
+
# - balance (number)
|
39
|
+
# * The current balance of your mobile money account (null if not available)
|
40
|
+
# * Read-only
|
41
|
+
#
|
42
|
+
# - fee (number)
|
43
|
+
# * The transaction fee charged by the mobile money system (null if not available)
|
44
|
+
# * Read-only
|
45
|
+
#
|
46
|
+
# - name
|
47
|
+
# * The name of the other person in the transaction (null if not available)
|
48
|
+
# * Read-only
|
49
|
+
#
|
50
|
+
# - phone_number
|
51
|
+
# * The phone number of the other person in the transaction (null if not available)
|
52
|
+
# * Read-only
|
53
|
+
#
|
54
|
+
# - time_created (UNIX timestamp)
|
55
|
+
# * The time this receipt was created in Telerivet
|
56
|
+
# * Read-only
|
57
|
+
#
|
58
|
+
# - other_tx_id
|
59
|
+
# * The other transaction ID listed in the receipt (e.g. the transaction ID for a
|
60
|
+
# reversed transaction)
|
61
|
+
# * Read-only
|
62
|
+
#
|
63
|
+
# - content
|
64
|
+
# * The raw content of the mobile money receipt
|
65
|
+
# * Read-only
|
66
|
+
#
|
67
|
+
# - provider_id
|
68
|
+
# * Telerivet's internal ID for the mobile money provider
|
69
|
+
# * Read-only
|
70
|
+
#
|
71
|
+
# - vars (Hash)
|
72
|
+
# * Custom variables stored for this mobile money receipt
|
73
|
+
# * Updatable via API
|
74
|
+
#
|
75
|
+
# - contact_id
|
76
|
+
# * ID of the contact associated with the name/phone number on the receipt. Note that
|
77
|
+
# some mobile money systems do not provide the other person's phone number, so it's
|
78
|
+
# possible Telerivet may not automatically assign a contact_id, or may assign it to a
|
79
|
+
# different contact with the same name.
|
80
|
+
# * Updatable via API
|
81
|
+
#
|
82
|
+
# - phone_id
|
83
|
+
# * ID of the phone that received the receipt
|
84
|
+
# * Read-only
|
85
|
+
#
|
86
|
+
# - message_id
|
87
|
+
# * ID of the message corresponding to the receipt
|
88
|
+
# * Read-only
|
89
|
+
#
|
90
|
+
# - project_id
|
91
|
+
# * ID of the project this receipt belongs to
|
92
|
+
# * Read-only
|
93
|
+
#
|
94
|
+
class MobileMoneyReceipt < Entity
|
95
|
+
#
|
96
|
+
# Saves any fields or custom variables that have changed for this mobile money receipt.
|
97
|
+
#
|
98
|
+
def save()
|
99
|
+
super
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# Deletes this receipt.
|
104
|
+
#
|
105
|
+
def delete()
|
106
|
+
@api.do_request("DELETE", get_base_api_path())
|
107
|
+
end
|
108
|
+
|
109
|
+
def id
|
110
|
+
get('id')
|
111
|
+
end
|
112
|
+
|
113
|
+
def tx_id
|
114
|
+
get('tx_id')
|
115
|
+
end
|
116
|
+
|
117
|
+
def tx_type
|
118
|
+
get('tx_type')
|
119
|
+
end
|
120
|
+
|
121
|
+
def currency
|
122
|
+
get('currency')
|
123
|
+
end
|
124
|
+
|
125
|
+
def amount
|
126
|
+
get('amount')
|
127
|
+
end
|
128
|
+
|
129
|
+
def balance
|
130
|
+
get('balance')
|
131
|
+
end
|
132
|
+
|
133
|
+
def fee
|
134
|
+
get('fee')
|
135
|
+
end
|
136
|
+
|
137
|
+
def name
|
138
|
+
get('name')
|
139
|
+
end
|
140
|
+
|
141
|
+
def phone_number
|
142
|
+
get('phone_number')
|
143
|
+
end
|
144
|
+
|
145
|
+
def time_created
|
146
|
+
get('time_created')
|
147
|
+
end
|
148
|
+
|
149
|
+
def other_tx_id
|
150
|
+
get('other_tx_id')
|
151
|
+
end
|
152
|
+
|
153
|
+
def content
|
154
|
+
get('content')
|
155
|
+
end
|
156
|
+
|
157
|
+
def provider_id
|
158
|
+
get('provider_id')
|
159
|
+
end
|
160
|
+
|
161
|
+
def contact_id
|
162
|
+
get('contact_id')
|
163
|
+
end
|
164
|
+
|
165
|
+
def contact_id=(value)
|
166
|
+
set('contact_id', value)
|
167
|
+
end
|
168
|
+
|
169
|
+
def phone_id
|
170
|
+
get('phone_id')
|
171
|
+
end
|
172
|
+
|
173
|
+
def message_id
|
174
|
+
get('message_id')
|
175
|
+
end
|
176
|
+
|
177
|
+
def project_id
|
178
|
+
get('project_id')
|
179
|
+
end
|
180
|
+
|
181
|
+
def get_base_api_path()
|
182
|
+
"/projects/#{get('project_id')}/receipts/#{get('id')}"
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
@@ -0,0 +1,229 @@
|
|
1
|
+
|
2
|
+
module Telerivet
|
3
|
+
|
4
|
+
#
|
5
|
+
# Represents a phone or gateway that you use to send/receive messages via Telerivet.
|
6
|
+
#
|
7
|
+
# Fields:
|
8
|
+
#
|
9
|
+
# - id (string, max 34 characters)
|
10
|
+
# * ID of the phone
|
11
|
+
# * Read-only
|
12
|
+
#
|
13
|
+
# - name
|
14
|
+
# * Name of the phone
|
15
|
+
# * Updatable via API
|
16
|
+
#
|
17
|
+
# - phone_number (string)
|
18
|
+
# * Phone number of the phone
|
19
|
+
# * Updatable via API
|
20
|
+
#
|
21
|
+
# - phone_type
|
22
|
+
# * Type of this phone/gateway (e.g. android, twilio, nexmo, etc)
|
23
|
+
# * Read-only
|
24
|
+
#
|
25
|
+
# - time_created (UNIX timestamp)
|
26
|
+
# * Time the phone was created in Telerivet
|
27
|
+
# * Read-only
|
28
|
+
#
|
29
|
+
# - last_active_time (UNIX timestamp)
|
30
|
+
# * Approximate time this phone last connected to Telerivet
|
31
|
+
# * Read-only
|
32
|
+
#
|
33
|
+
# - vars (Hash)
|
34
|
+
# * Custom variables stored for this phone
|
35
|
+
# * Updatable via API
|
36
|
+
#
|
37
|
+
# - project_id
|
38
|
+
# * ID of the project this phone belongs to
|
39
|
+
# * Read-only
|
40
|
+
#
|
41
|
+
# - battery (int)
|
42
|
+
# * Current battery level, on a scale from 0 to 100, as of the last time the phone
|
43
|
+
# connected to Telerivet (only present for Android phones)
|
44
|
+
# * Read-only
|
45
|
+
#
|
46
|
+
# - charging (bool)
|
47
|
+
# * True if the phone is currently charging, false if it is running on battery, as of
|
48
|
+
# the last time it connected to Telerivet (only present for Android phones)
|
49
|
+
# * Read-only
|
50
|
+
#
|
51
|
+
# - app_version
|
52
|
+
# * Currently installed version of Telerivet Android app (only present for Android
|
53
|
+
# phones)
|
54
|
+
# * Read-only
|
55
|
+
#
|
56
|
+
# - android_sdk (int)
|
57
|
+
# * Android SDK level, indicating the approximate version of the Android OS installed on
|
58
|
+
# this phone; see
|
59
|
+
# <http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels>
|
60
|
+
# (only present for Android phones)
|
61
|
+
# * Read-only
|
62
|
+
#
|
63
|
+
# - mccmnc
|
64
|
+
# * Code indicating the Android phone's current country (MCC) and mobile network
|
65
|
+
# operator (MNC); see <http://en.wikipedia.org/wiki/Mobile_country_code> (only present
|
66
|
+
# for Android phones). Note this is a string containing numeric digits, not an integer.
|
67
|
+
# * Read-only
|
68
|
+
#
|
69
|
+
# - manufacturer
|
70
|
+
# * Android phone manufacturer (only present for Android phones)
|
71
|
+
# * Read-only
|
72
|
+
#
|
73
|
+
# - model
|
74
|
+
# * Android phone model (only present for Android phones)
|
75
|
+
# * Read-only
|
76
|
+
#
|
77
|
+
# - send_limit (int)
|
78
|
+
# * Maximum number of SMS messages per hour that can be sent by this Android phone. To
|
79
|
+
# increase this limit, install additional SMS expansion packs in the Telerivet app.
|
80
|
+
# (only present for Android phones)
|
81
|
+
# * Read-only
|
82
|
+
#
|
83
|
+
class Phone < Entity
|
84
|
+
#
|
85
|
+
# Queries messages sent or received by this phone.
|
86
|
+
#
|
87
|
+
# Arguments:
|
88
|
+
# - options (Hash)
|
89
|
+
#
|
90
|
+
# - direction
|
91
|
+
# * Filter messages by direction
|
92
|
+
# * Allowed values: incoming, outgoing
|
93
|
+
#
|
94
|
+
# - message_type
|
95
|
+
# * Filter messages by message_type
|
96
|
+
# * Allowed values: sms, mms, ussd, call
|
97
|
+
#
|
98
|
+
# - source
|
99
|
+
# * Filter messages by source
|
100
|
+
# * Allowed values: phone, provider, web, api, service, webhook, scheduled
|
101
|
+
#
|
102
|
+
# - starred (bool)
|
103
|
+
# * Filter messages by starred/unstarred
|
104
|
+
#
|
105
|
+
# - status
|
106
|
+
# * Filter messages by status
|
107
|
+
# * Allowed values: ignored, processing, received, sent, queued, failed,
|
108
|
+
# failed_queued, cancelled, delivered, not_delivered
|
109
|
+
#
|
110
|
+
# - time_created[min] (UNIX timestamp)
|
111
|
+
# * Filter messages created on or after a particular time
|
112
|
+
#
|
113
|
+
# - time_created[max] (UNIX timestamp)
|
114
|
+
# * Filter messages created before a particular time
|
115
|
+
#
|
116
|
+
# - contact_id
|
117
|
+
# * ID of the contact who sent/received the message
|
118
|
+
#
|
119
|
+
# - phone_id
|
120
|
+
# * ID of the phone that sent/received the message
|
121
|
+
#
|
122
|
+
# - sort
|
123
|
+
# * Sort the results based on a field
|
124
|
+
# * Allowed values: default
|
125
|
+
# * Default: default
|
126
|
+
#
|
127
|
+
# - sort_dir
|
128
|
+
# * Sort the results in ascending or descending order
|
129
|
+
# * Allowed values: asc, desc
|
130
|
+
# * Default: asc
|
131
|
+
#
|
132
|
+
# - page_size (int)
|
133
|
+
# * Number of results returned per page (max 200)
|
134
|
+
# * Default: 50
|
135
|
+
#
|
136
|
+
# - offset (int)
|
137
|
+
# * Number of items to skip from beginning of result set
|
138
|
+
# * Default: 0
|
139
|
+
#
|
140
|
+
# Returns:
|
141
|
+
# Telerivet::APICursor (of Telerivet::Message)
|
142
|
+
#
|
143
|
+
def query_messages(options = nil)
|
144
|
+
require_relative 'message'
|
145
|
+
@api.cursor(Message, get_base_api_path() + "/messages", options)
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
# Saves any fields or custom variables that have changed for this phone.
|
150
|
+
#
|
151
|
+
def save()
|
152
|
+
super
|
153
|
+
end
|
154
|
+
|
155
|
+
def id
|
156
|
+
get('id')
|
157
|
+
end
|
158
|
+
|
159
|
+
def name
|
160
|
+
get('name')
|
161
|
+
end
|
162
|
+
|
163
|
+
def name=(value)
|
164
|
+
set('name', value)
|
165
|
+
end
|
166
|
+
|
167
|
+
def phone_number
|
168
|
+
get('phone_number')
|
169
|
+
end
|
170
|
+
|
171
|
+
def phone_number=(value)
|
172
|
+
set('phone_number', value)
|
173
|
+
end
|
174
|
+
|
175
|
+
def phone_type
|
176
|
+
get('phone_type')
|
177
|
+
end
|
178
|
+
|
179
|
+
def time_created
|
180
|
+
get('time_created')
|
181
|
+
end
|
182
|
+
|
183
|
+
def last_active_time
|
184
|
+
get('last_active_time')
|
185
|
+
end
|
186
|
+
|
187
|
+
def project_id
|
188
|
+
get('project_id')
|
189
|
+
end
|
190
|
+
|
191
|
+
def battery
|
192
|
+
get('battery')
|
193
|
+
end
|
194
|
+
|
195
|
+
def charging
|
196
|
+
get('charging')
|
197
|
+
end
|
198
|
+
|
199
|
+
def app_version
|
200
|
+
get('app_version')
|
201
|
+
end
|
202
|
+
|
203
|
+
def android_sdk
|
204
|
+
get('android_sdk')
|
205
|
+
end
|
206
|
+
|
207
|
+
def mccmnc
|
208
|
+
get('mccmnc')
|
209
|
+
end
|
210
|
+
|
211
|
+
def manufacturer
|
212
|
+
get('manufacturer')
|
213
|
+
end
|
214
|
+
|
215
|
+
def model
|
216
|
+
get('model')
|
217
|
+
end
|
218
|
+
|
219
|
+
def send_limit
|
220
|
+
get('send_limit')
|
221
|
+
end
|
222
|
+
|
223
|
+
def get_base_api_path()
|
224
|
+
"/projects/#{get('project_id')}/phones/#{get('id')}"
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|