telerivet 1.6.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 303a6df0ce9d23233621cac3732ab09afb1b9bf968d784441e29bd343a4ec105
4
- data.tar.gz: fad6a45b9e7b0cd84668f49a129a6600b3fcd4898b18d193d476deede36c9323
3
+ metadata.gz: 2276ff47e23f0670121a7295c0cf3d860740ebb0c1980de13e15ae2f25c2659d
4
+ data.tar.gz: 55db2507c8bcfa9f8ed0c3102f830dea689fd57ef57d0a00f1b488eebf46f4b5
5
5
  SHA512:
6
- metadata.gz: 4b030343b0e5d79d4c1d520d348baccfe77a7d171fab5b86f1f3a0b16e914f82ad3c5eab796fd2ddcec3480a1f952e030208f5db2eaaa568b3eb079fddbaa1ca
7
- data.tar.gz: a8c12e9cfbb08f568f40cb4647646d033aa55d1864b1acd28219ff27d587d04ef2bff994b8aa0ab43c3082446de03bebe2ad90a99ba25a22ea40700505954e68
6
+ metadata.gz: cdd68937b393e61a1ec76e536b0abfcf30e3bb16127b2ea6a37f221013c8ee9d43aa99f5bf758eeb70d04c0366ffcfe1a2e4af576d0620507412b92ac8ceeab7
7
+ data.tar.gz: 50cf5362c2926a104d8e1d6cd15ee5473589cdf31e78e516f9e6ad1af335baec040de5b5cf8598dc8e95008e08fe9775a448da465fffc708030b8e217d86e52a
@@ -28,6 +28,14 @@ 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
41
  # `queued`, `pending_approval`, or `pending_payment`)
@@ -90,6 +98,14 @@ class AirtimeTransaction < Entity
90
98
  get('country')
91
99
  end
92
100
 
101
+ def time_created
102
+ get('time_created')
103
+ end
104
+
105
+ def transaction_time
106
+ get('transaction_time')
107
+ end
108
+
93
109
  def status
94
110
  get('status')
95
111
  end
@@ -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
- return cls.new(@api, item_data, true)
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']
@@ -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
- # - is_template (bool)
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
@@ -257,8 +257,8 @@ class Broadcast < Entity
257
257
  get('tts_voice')
258
258
  end
259
259
 
260
- def is_template
261
- get('is_template')
260
+ def replace_variables
261
+ get('replace_variables')
262
262
  end
263
263
 
264
264
  def status
@@ -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 send messages to this
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)
@@ -134,7 +134,7 @@ class Contact < Entity
134
134
  #
135
135
  # - message_type
136
136
  # * Filter messages by message_type
137
- # * Allowed values: sms, mms, ussd, call, service
137
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
138
138
  #
139
139
  # - source
140
140
  # * Filter messages by source
@@ -253,7 +253,7 @@ class Contact < Entity
253
253
  #
254
254
  # - message_type
255
255
  # * Filter scheduled messages by message_type
256
- # * Allowed values: sms, mms, ussd, call, service
256
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
257
257
  #
258
258
  # - time_created (UNIX timestamp)
259
259
  # * Filter scheduled messages by time_created
@@ -263,6 +263,9 @@ class Contact < Entity
263
263
  # * Filter scheduled messages by next_time
264
264
  # * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
265
265
  #
266
+ # - relative_scheduled_id
267
+ # * Filter scheduled messages created for a relative scheduled message
268
+ #
266
269
  # - sort
267
270
  # * Sort the results based on a field
268
271
  # * Allowed values: default, next_time
@@ -176,8 +176,8 @@ class DataTable < Entity
176
176
  #
177
177
  # - type (string)
178
178
  # * Field type
179
- # * Allowed values: text, long_text, phone_number, email, url, audio, date, date_time,
180
- # number, boolean, select
179
+ # * Allowed values: text, long_text, secret, phone_number, email, url, audio, date,
180
+ # date_time, number, boolean, checkbox, select, radio
181
181
  #
182
182
  # - order (int)
183
183
  # * Order in which to display the field
@@ -124,7 +124,7 @@ class Group < Entity
124
124
  #
125
125
  # - message_type
126
126
  # * Filter scheduled messages by message_type
127
- # * Allowed values: sms, mms, ussd, call, service
127
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
128
128
  #
129
129
  # - time_created (UNIX timestamp)
130
130
  # * Filter scheduled messages by time_created
@@ -134,6 +134,9 @@ class Group < Entity
134
134
  # * Filter scheduled messages by next_time
135
135
  # * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
136
136
  #
137
+ # - relative_scheduled_id
138
+ # * Filter scheduled messages created for a relative scheduled message
139
+ #
137
140
  # - sort
138
141
  # * Sort the results based on a field
139
142
  # * Allowed values: default, next_time
@@ -39,7 +39,7 @@ class Label < Entity
39
39
  #
40
40
  # - message_type
41
41
  # * Filter messages by message_type
42
- # * Allowed values: sms, mms, ussd, call, service
42
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
43
43
  #
44
44
  # - source
45
45
  # * Filter messages by source
@@ -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
@@ -93,8 +93,12 @@ module Telerivet
93
93
  # * Updatable via API
94
94
  #
95
95
  # - external_id
96
- # * The ID of this message from an external SMS gateway provider (e.g. Twilio or Nexmo),
97
- # if available.
96
+ # * The ID of this message from an external SMS gateway provider (e.g. Twilio or
97
+ # Vonage), if available.
98
+ # * Read-only
99
+ #
100
+ # - num_parts (number)
101
+ # * The number of SMS parts associated with the message, if applicable and if known.
98
102
  # * Read-only
99
103
  #
100
104
  # - price (number)
@@ -144,6 +148,16 @@ module Telerivet
144
148
  # undefined for messages that do not contain short URLs.
145
149
  # * Read-only
146
150
  #
151
+ # - network_code (string)
152
+ # * A string identifying the network that sent or received the message, if known. For
153
+ # mobile networks, this string contains the 3-digit mobile country code (MCC) followed
154
+ # by the 2- or 3-digit mobile network code (MNC), which results in a 5- or 6-digit
155
+ # number. For lists of mobile network operators and their corresponding MCC/MNC values,
156
+ # see [Mobile country code Wikipedia
157
+ # article](https://en.wikipedia.org/wiki/Mobile_country_code). The network_code property
158
+ # may be non-numeric for messages not sent via mobile networks.
159
+ # * Read-only
160
+ #
147
161
  # - media (array)
148
162
  # * For text messages containing media files, this is an array of objects with the
149
163
  # properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
@@ -400,6 +414,10 @@ class Message < Entity
400
414
  get('external_id')
401
415
  end
402
416
 
417
+ def num_parts
418
+ get('num_parts')
419
+ end
420
+
403
421
  def price
404
422
  get('price')
405
423
  end
@@ -436,6 +454,10 @@ class Message < Entity
436
454
  get('short_urls')
437
455
  end
438
456
 
457
+ def network_code
458
+ get('network_code')
459
+ end
460
+
439
461
  def media
440
462
  get('media')
441
463
  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
- # <http://en.wikipedia.org/wiki/List_of_tz_database_time_zones>
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
  #
@@ -2,7 +2,8 @@
2
2
  module Telerivet
3
3
 
4
4
  #
5
- # Represents a phone or gateway that you use to send/receive messages via Telerivet.
5
+ # Represents a basic route (i.e. a phone or gateway) that you use to send/receive messages via
6
+ # Telerivet.
6
7
  #
7
8
  # Basic Routes were formerly referred to as "Phones" within Telerivet. API
8
9
  # methods, parameters, and properties related to Basic Routes continue to use the term "Phone"
@@ -73,15 +74,16 @@ module Telerivet
73
74
  #
74
75
  # - android_sdk (int)
75
76
  # * Android SDK level, indicating the approximate version of the Android OS installed on
76
- # this phone; see
77
- # <http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels>
77
+ # this phone; see [list of Android SDK
78
+ # levels](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)
78
79
  # (only present for Android phones)
79
80
  # * Read-only
80
81
  #
81
82
  # - mccmnc
82
83
  # * Code indicating the Android phone's current country (MCC) and mobile network
83
- # operator (MNC); see <http://en.wikipedia.org/wiki/Mobile_country_code> (only present
84
- # for Android phones). Note this is a string containing numeric digits, not an integer.
84
+ # operator (MNC); see [Mobile country code Wikipedia
85
+ # article](https://en.wikipedia.org/wiki/Mobile_country_code) (only present for Android
86
+ # phones). Note this is a string containing numeric digits, not an integer.
85
87
  # * Read-only
86
88
  #
87
89
  # - manufacturer
@@ -100,7 +102,7 @@ module Telerivet
100
102
  #
101
103
  class Phone < Entity
102
104
  #
103
- # Queries messages sent or received by this phone.
105
+ # Queries messages sent or received by this basic route.
104
106
  #
105
107
  # Arguments:
106
108
  # - options (Hash)
@@ -111,7 +113,7 @@ class Phone < Entity
111
113
  #
112
114
  # - message_type
113
115
  # * Filter messages by message_type
114
- # * Allowed values: sms, mms, ussd, call, service
116
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
115
117
  #
116
118
  # - source
117
119
  # * Filter messages by source
@@ -182,7 +184,7 @@ class Phone < Entity
182
184
  end
183
185
 
184
186
  #
185
- # Saves any fields or custom variables that have changed for this phone.
187
+ # Saves any fields or custom variables that have changed for this basic route.
186
188
  #
187
189
  def save()
188
190
  super