telerivet 1.1.4 → 1.1.6
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/telerivet.rb +1 -1
- data/lib/telerivet/contact.rb +57 -8
- data/lib/telerivet/group.rb +34 -1
- data/lib/telerivet/message.rb +25 -0
- data/lib/telerivet/phone.rb +9 -0
- data/lib/telerivet/project.rb +74 -15
- data/lib/telerivet/service.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 069e4d71945ecfebc99b45656fdf47b36fd35e19
|
4
|
+
data.tar.gz: d5bd1f041f21e6e7b14fd48852cbf8f8d3fecafb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e6b9787dc8fdddbad0ef1b1c35f52bbbefb25c245f8588b49801606f90664b99f52c552a581a46b6bc5f83b5b31477be66f8aa1482002250fca5ffe6091c51d
|
7
|
+
data.tar.gz: 53288dabcb2af64d9e5341e1c1e495f9f676aa1f7decf595e0bdc28a32804408ab2a13fb6a6813cd7d6d8a518d25327af55401431104d73248c157fd0174dad2
|
data/lib/telerivet.rb
CHANGED
data/lib/telerivet/contact.rb
CHANGED
@@ -19,14 +19,38 @@ module Telerivet
|
|
19
19
|
# * Time the contact was added in Telerivet
|
20
20
|
# * Read-only
|
21
21
|
#
|
22
|
+
# - send_blocked (bool)
|
23
|
+
# * True if Telerivet is blocked from sending messages to this contact
|
24
|
+
# * Updatable via API
|
25
|
+
#
|
22
26
|
# - last_message_time (UNIX timestamp)
|
23
27
|
# * Last time the contact sent or received a message (null if no messages have been sent
|
24
28
|
# or received)
|
25
29
|
# * Read-only
|
26
30
|
#
|
31
|
+
# - last_incoming_message_time (UNIX timestamp)
|
32
|
+
# * Last time a message was received from this contact
|
33
|
+
# * Read-only
|
34
|
+
#
|
35
|
+
# - last_outgoing_message_time (UNIX timestamp)
|
36
|
+
# * Last time a message was sent to this contact
|
37
|
+
# * Read-only
|
38
|
+
#
|
39
|
+
# - message_count (int)
|
40
|
+
# * Total number of non-deleted messages sent to or received from this contact
|
41
|
+
# * Read-only
|
42
|
+
#
|
43
|
+
# - incoming_message_count (int)
|
44
|
+
# * Number of messages received from this contact
|
45
|
+
# * Read-only
|
46
|
+
#
|
47
|
+
# - outgoing_message_count (int)
|
48
|
+
# * Number of messages sent to this contact
|
49
|
+
# * Read-only
|
50
|
+
#
|
27
51
|
# - last_message_id
|
28
|
-
# * ID of the last message sent or received
|
29
|
-
# been sent or received)
|
52
|
+
# * ID of the last message sent to or received from this contact (null if no messages
|
53
|
+
# have been sent or received)
|
30
54
|
# * Read-only
|
31
55
|
#
|
32
56
|
# - default_route_id
|
@@ -164,6 +188,9 @@ class Contact < Entity
|
|
164
188
|
# * Allowed modifiers: name[ne], name[prefix], name[not_prefix], name[gte], name[gt],
|
165
189
|
# name[lt], name[lte]
|
166
190
|
#
|
191
|
+
# - dynamic (bool)
|
192
|
+
# * Filter groups by dynamic/non-dynamic
|
193
|
+
#
|
167
194
|
# - sort
|
168
195
|
# * Sort the results based on a field
|
169
196
|
# * Allowed values: default, name
|
@@ -246,12 +273,6 @@ class Contact < Entity
|
|
246
273
|
# * Filter data rows by the time they were created
|
247
274
|
# * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
|
248
275
|
#
|
249
|
-
# - vars (Hash)
|
250
|
-
# * Filter data rows by value of a custom variable (e.g. vars[q1], vars[foo], etc.)
|
251
|
-
# * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
|
252
|
-
# vars[foo][not_prefix], vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte],
|
253
|
-
# vars[foo][min], vars[foo][max]
|
254
|
-
#
|
255
276
|
# - sort
|
256
277
|
# * Sort the results based on a field
|
257
278
|
# * Allowed values: default
|
@@ -359,10 +380,38 @@ class Contact < Entity
|
|
359
380
|
get('time_created')
|
360
381
|
end
|
361
382
|
|
383
|
+
def send_blocked
|
384
|
+
get('send_blocked')
|
385
|
+
end
|
386
|
+
|
387
|
+
def send_blocked=(value)
|
388
|
+
set('send_blocked', value)
|
389
|
+
end
|
390
|
+
|
362
391
|
def last_message_time
|
363
392
|
get('last_message_time')
|
364
393
|
end
|
365
394
|
|
395
|
+
def last_incoming_message_time
|
396
|
+
get('last_incoming_message_time')
|
397
|
+
end
|
398
|
+
|
399
|
+
def last_outgoing_message_time
|
400
|
+
get('last_outgoing_message_time')
|
401
|
+
end
|
402
|
+
|
403
|
+
def message_count
|
404
|
+
get('message_count')
|
405
|
+
end
|
406
|
+
|
407
|
+
def incoming_message_count
|
408
|
+
get('incoming_message_count')
|
409
|
+
end
|
410
|
+
|
411
|
+
def outgoing_message_count
|
412
|
+
get('outgoing_message_count')
|
413
|
+
end
|
414
|
+
|
366
415
|
def last_message_id
|
367
416
|
get('last_message_id')
|
368
417
|
end
|
data/lib/telerivet/group.rb
CHANGED
@@ -14,8 +14,12 @@ module Telerivet
|
|
14
14
|
# * Name of the group
|
15
15
|
# * Updatable via API
|
16
16
|
#
|
17
|
+
# - dynamic (bool)
|
18
|
+
# * Whether this is a dynamic or normal group
|
19
|
+
# * Read-only
|
20
|
+
#
|
17
21
|
# - num_members (int)
|
18
|
-
# * Number of contacts in the group
|
22
|
+
# * Number of contacts in the group (null if the group is dynamic)
|
19
23
|
# * Read-only
|
20
24
|
#
|
21
25
|
# - time_created (UNIX timestamp)
|
@@ -57,6 +61,31 @@ class Group < Entity
|
|
57
61
|
# * Allowed modifiers: last_message_time[exists], last_message_time[ne],
|
58
62
|
# last_message_time[min], last_message_time[max]
|
59
63
|
#
|
64
|
+
# - last_incoming_message_time (UNIX timestamp)
|
65
|
+
# * Filter contacts by last time a message was received
|
66
|
+
# * Allowed modifiers: last_incoming_message_time[exists],
|
67
|
+
# last_incoming_message_time[ne], last_incoming_message_time[min],
|
68
|
+
# last_incoming_message_time[max]
|
69
|
+
#
|
70
|
+
# - last_outgoing_message_time (UNIX timestamp)
|
71
|
+
# * Filter contacts by last time a message was sent
|
72
|
+
# * Allowed modifiers: last_outgoing_message_time[exists],
|
73
|
+
# last_outgoing_message_time[ne], last_outgoing_message_time[min],
|
74
|
+
# last_outgoing_message_time[max]
|
75
|
+
#
|
76
|
+
# - incoming_message_count (int)
|
77
|
+
# * Filter contacts by number of messages received from the contact
|
78
|
+
# * Allowed modifiers: incoming_message_count[ne], incoming_message_count[min],
|
79
|
+
# incoming_message_count[max]
|
80
|
+
#
|
81
|
+
# - outgoing_message_count (int)
|
82
|
+
# * Filter contacts by number of messages sent to the contact
|
83
|
+
# * Allowed modifiers: outgoing_message_count[ne], outgoing_message_count[min],
|
84
|
+
# outgoing_message_count[max]
|
85
|
+
#
|
86
|
+
# - send_blocked (bool)
|
87
|
+
# * Filter contacts by blocked status
|
88
|
+
#
|
60
89
|
# - vars (Hash)
|
61
90
|
# * Filter contacts by value of a custom variable (e.g. vars[email], vars[foo], etc.)
|
62
91
|
# * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
|
@@ -160,6 +189,10 @@ class Group < Entity
|
|
160
189
|
set('name', value)
|
161
190
|
end
|
162
191
|
|
192
|
+
def dynamic
|
193
|
+
get('dynamic')
|
194
|
+
end
|
195
|
+
|
163
196
|
def num_members
|
164
197
|
get('num_members')
|
165
198
|
end
|
data/lib/telerivet/message.rb
CHANGED
@@ -89,6 +89,15 @@ module Telerivet
|
|
89
89
|
# * The currency of the message price, if applicable.
|
90
90
|
# * Read-only
|
91
91
|
#
|
92
|
+
# - duration (number)
|
93
|
+
# * The duration of the call in seconds, if known, or -1 if the call was not answered.
|
94
|
+
# * Read-only
|
95
|
+
#
|
96
|
+
# - ring_time (number)
|
97
|
+
# * The length of time the call rang in seconds before being answered or hung up, if
|
98
|
+
# known.
|
99
|
+
# * Read-only
|
100
|
+
#
|
92
101
|
# - mms_parts (array)
|
93
102
|
# * A list of parts in the MMS message, the same as returned by the
|
94
103
|
# [getMMSParts](#Message.getMMSParts) method.
|
@@ -110,6 +119,10 @@ module Telerivet
|
|
110
119
|
# * ID of the route that sent the message (if applicable)
|
111
120
|
# * Read-only
|
112
121
|
#
|
122
|
+
# - user_id (string, max 34 characters)
|
123
|
+
# * ID of the Telerivet user who sent the message (if applicable)
|
124
|
+
# * Read-only
|
125
|
+
#
|
113
126
|
# - project_id
|
114
127
|
# * ID of the project this contact belongs to
|
115
128
|
# * Read-only
|
@@ -301,6 +314,14 @@ class Message < Entity
|
|
301
314
|
get('price_currency')
|
302
315
|
end
|
303
316
|
|
317
|
+
def duration
|
318
|
+
get('duration')
|
319
|
+
end
|
320
|
+
|
321
|
+
def ring_time
|
322
|
+
get('ring_time')
|
323
|
+
end
|
324
|
+
|
304
325
|
def mms_parts
|
305
326
|
get('mms_parts')
|
306
327
|
end
|
@@ -317,6 +338,10 @@ class Message < Entity
|
|
317
338
|
get('route_id')
|
318
339
|
end
|
319
340
|
|
341
|
+
def user_id
|
342
|
+
get('user_id')
|
343
|
+
end
|
344
|
+
|
320
345
|
def project_id
|
321
346
|
get('project_id')
|
322
347
|
end
|
data/lib/telerivet/phone.rb
CHANGED
@@ -57,6 +57,11 @@ module Telerivet
|
|
57
57
|
# the last time it connected to Telerivet (only present for Android phones)
|
58
58
|
# * Read-only
|
59
59
|
#
|
60
|
+
# - internet_type
|
61
|
+
# * String describing the current type of internet connectivity for an Android phone,
|
62
|
+
# for example WIFI or MOBILE (only present for Android phones)
|
63
|
+
# * Read-only
|
64
|
+
#
|
60
65
|
# - app_version
|
61
66
|
# * Currently installed version of Telerivet Android app (only present for Android
|
62
67
|
# phones)
|
@@ -217,6 +222,10 @@ class Phone < Entity
|
|
217
222
|
get('charging')
|
218
223
|
end
|
219
224
|
|
225
|
+
def internet_type
|
226
|
+
get('internet_type')
|
227
|
+
end
|
228
|
+
|
220
229
|
def app_version
|
221
230
|
get('app_version')
|
222
231
|
end
|
data/lib/telerivet/project.rb
CHANGED
@@ -114,12 +114,12 @@ class Project < Entity
|
|
114
114
|
# - status_url
|
115
115
|
# * Webhook callback URL to be notified when message status changes
|
116
116
|
#
|
117
|
-
# - label_ids (array)
|
118
|
-
# * Array of IDs of labels to add to all messages sent (maximum 5)
|
119
|
-
#
|
120
117
|
# - status_secret
|
121
118
|
# * POST parameter 'secret' passed to status_url
|
122
119
|
#
|
120
|
+
# - label_ids (array)
|
121
|
+
# * Array of IDs of labels to add to all messages sent (maximum 5)
|
122
|
+
#
|
123
123
|
# - exclude_contact_id
|
124
124
|
# * Optionally excludes one contact from receiving the message (only when group_id is
|
125
125
|
# set)
|
@@ -264,29 +264,48 @@ class Project < Entity
|
|
264
264
|
#
|
265
265
|
# Retrieves OR creates and possibly updates a contact by name or phone number.
|
266
266
|
#
|
267
|
-
# If a phone number is provided, Telerivet will search for
|
268
|
-
# contact with that phone number (including suffix matches to allow finding
|
269
|
-
# phone numbers in a different format).
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
267
|
+
# If a phone number is provided, by default, Telerivet will search for
|
268
|
+
# an existing contact with that phone number (including suffix matches to allow finding
|
269
|
+
# contacts with phone numbers in a different format). If a phone number is not provided but a
|
270
|
+
# name is provided, Telerivet will search for a contact with that exact name (case
|
271
|
+
# insensitive). This behavior can be modified by setting the lookup_key parameter to look up a
|
272
|
+
# contact by another field, including a custom variable.
|
273
273
|
#
|
274
274
|
# If no existing contact is found, a new contact will be created.
|
275
275
|
#
|
276
276
|
# Then that contact will be updated with any parameters provided
|
277
|
-
# (name, phone_number,
|
277
|
+
# (name, phone_number, vars, default\_route\_id, send\_blocked, add\_group\_ids,
|
278
|
+
# remove\_group\_ids).
|
278
279
|
#
|
279
280
|
# Arguments:
|
280
281
|
# - options (Hash)
|
281
|
-
# * Required
|
282
282
|
#
|
283
283
|
# - name
|
284
284
|
# * Name of the contact
|
285
|
-
# * Required if phone_number not set
|
286
285
|
#
|
287
286
|
# - phone_number
|
288
287
|
# * Phone number of the contact
|
289
|
-
#
|
288
|
+
#
|
289
|
+
# - lookup_key
|
290
|
+
# * The field used to search for a matching contact, or 'none' to always create a new
|
291
|
+
# contact. To search by a custom variable, precede the variable name with 'vars.'.
|
292
|
+
# * Allowed values: phone_number, name, id, vars.variable_name, none
|
293
|
+
# * Default: phone_number
|
294
|
+
#
|
295
|
+
# - send_blocked (bool)
|
296
|
+
# * True if Telerivet is blocked from sending messages to this contact
|
297
|
+
#
|
298
|
+
# - default_route_id
|
299
|
+
# * ID of the route to use by default to send messages to this contact
|
300
|
+
#
|
301
|
+
# - add_group_ids (array)
|
302
|
+
# * ID of one or more groups to add this contact as a member (max 20)
|
303
|
+
#
|
304
|
+
# - id
|
305
|
+
# * ID of an existing contact (only used if lookup_key is 'id')
|
306
|
+
#
|
307
|
+
# - remove_group_ids (array)
|
308
|
+
# * ID of one or more groups to remove this contact as a member (max 20)
|
290
309
|
#
|
291
310
|
# - vars (Hash)
|
292
311
|
# * Custom variables and values to update on the contact
|
@@ -294,7 +313,7 @@ class Project < Entity
|
|
294
313
|
# Returns:
|
295
314
|
# Telerivet::Contact
|
296
315
|
#
|
297
|
-
def get_or_create_contact(options)
|
316
|
+
def get_or_create_contact(options = nil)
|
298
317
|
require_relative 'contact'
|
299
318
|
Contact.new(@api, @api.do_request("POST", get_base_api_path() + "/contacts", options))
|
300
319
|
end
|
@@ -325,6 +344,31 @@ class Project < Entity
|
|
325
344
|
# * Allowed modifiers: last_message_time[exists], last_message_time[ne],
|
326
345
|
# last_message_time[min], last_message_time[max]
|
327
346
|
#
|
347
|
+
# - last_incoming_message_time (UNIX timestamp)
|
348
|
+
# * Filter contacts by last time a message was received
|
349
|
+
# * Allowed modifiers: last_incoming_message_time[exists],
|
350
|
+
# last_incoming_message_time[ne], last_incoming_message_time[min],
|
351
|
+
# last_incoming_message_time[max]
|
352
|
+
#
|
353
|
+
# - last_outgoing_message_time (UNIX timestamp)
|
354
|
+
# * Filter contacts by last time a message was sent
|
355
|
+
# * Allowed modifiers: last_outgoing_message_time[exists],
|
356
|
+
# last_outgoing_message_time[ne], last_outgoing_message_time[min],
|
357
|
+
# last_outgoing_message_time[max]
|
358
|
+
#
|
359
|
+
# - incoming_message_count (int)
|
360
|
+
# * Filter contacts by number of messages received from the contact
|
361
|
+
# * Allowed modifiers: incoming_message_count[ne], incoming_message_count[min],
|
362
|
+
# incoming_message_count[max]
|
363
|
+
#
|
364
|
+
# - outgoing_message_count (int)
|
365
|
+
# * Filter contacts by number of messages sent to the contact
|
366
|
+
# * Allowed modifiers: outgoing_message_count[ne], outgoing_message_count[min],
|
367
|
+
# outgoing_message_count[max]
|
368
|
+
#
|
369
|
+
# - send_blocked (bool)
|
370
|
+
# * Filter contacts by blocked status
|
371
|
+
#
|
328
372
|
# - vars (Hash)
|
329
373
|
# * Filter contacts by value of a custom variable (e.g. vars[email], vars[foo], etc.)
|
330
374
|
# * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
|
@@ -576,6 +620,9 @@ class Project < Entity
|
|
576
620
|
# * Allowed modifiers: name[ne], name[prefix], name[not_prefix], name[gte], name[gt],
|
577
621
|
# name[lt], name[lte]
|
578
622
|
#
|
623
|
+
# - dynamic (bool)
|
624
|
+
# * Filter groups by dynamic/non-dynamic
|
625
|
+
#
|
579
626
|
# - sort
|
580
627
|
# * Sort the results based on a field
|
581
628
|
# * Allowed values: default, name
|
@@ -913,7 +960,7 @@ class Project < Entity
|
|
913
960
|
#
|
914
961
|
# - context
|
915
962
|
# * Filter services that can be invoked in a particular context
|
916
|
-
# * Allowed values: message, contact, project
|
963
|
+
# * Allowed values: message, contact, project
|
917
964
|
#
|
918
965
|
# - sort
|
919
966
|
# * Sort the results based on a field
|
@@ -1129,6 +1176,18 @@ class Project < Entity
|
|
1129
1176
|
return Route.new(@api, {'project_id' => self.id, 'id' => id}, false)
|
1130
1177
|
end
|
1131
1178
|
|
1179
|
+
#
|
1180
|
+
# Returns an array of user accounts that have access to this project. Each item in the array
|
1181
|
+
# is an object containing `id`, `email`, and `name` properties. (The id corresponds to the
|
1182
|
+
# `user_id` property of the Message object.)
|
1183
|
+
#
|
1184
|
+
# Returns:
|
1185
|
+
# array
|
1186
|
+
#
|
1187
|
+
def get_users()
|
1188
|
+
return @api.do_request("GET", get_base_api_path() + "/users")
|
1189
|
+
end
|
1190
|
+
|
1132
1191
|
#
|
1133
1192
|
# Saves any fields or custom variables that have changed for the project.
|
1134
1193
|
#
|
data/lib/telerivet/service.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Young
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby client library for Telerivet REST API
|
14
14
|
email: support@telerivet.com
|
@@ -16,8 +16,8 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
-
- lib/telerivet.rb
|
20
19
|
- lib/cacert.pem
|
20
|
+
- lib/telerivet.rb
|
21
21
|
- lib/telerivet/apicursor.rb
|
22
22
|
- lib/telerivet/contact.rb
|
23
23
|
- lib/telerivet/contactservicestate.rb
|
@@ -43,17 +43,17 @@ require_paths:
|
|
43
43
|
- lib
|
44
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.4.5
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Telerivet REST API Client
|