telerivet 1.3.0 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/telerivet.rb +12 -4
- data/lib/telerivet/airtimetransaction.rb +131 -0
- data/lib/telerivet/broadcast.rb +56 -8
- data/lib/telerivet/contact.rb +37 -9
- data/lib/telerivet/datatable.rb +71 -3
- data/lib/telerivet/group.rb +3 -3
- data/lib/telerivet/label.rb +11 -4
- data/lib/telerivet/message.rb +74 -4
- data/lib/telerivet/organization.rb +1 -1
- data/lib/telerivet/phone.rb +17 -6
- data/lib/telerivet/project.rb +365 -147
- data/lib/telerivet/route.rb +8 -2
- data/lib/telerivet/scheduledmessage.rb +22 -1
- data/lib/telerivet/service.rb +31 -5
- metadata +4 -5
- data/lib/telerivet/mobilemoneyreceipt.rb +0 -187
data/lib/telerivet/route.rb
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
module Telerivet
|
3
3
|
|
4
4
|
#
|
5
|
-
# Represents a custom route that can be used to send messages via one or more
|
5
|
+
# Represents a custom route that can be used to send messages via one or more basic routes
|
6
|
+
# (phones).
|
6
7
|
#
|
7
|
-
#
|
8
|
+
# Custom Routes were formerly referred to simply as "Routes" within Telerivet. API methods,
|
9
|
+
# parameters, and properties related to Custom Routes continue to use the term "Route" to
|
10
|
+
# maintain backwards compatibility.
|
11
|
+
#
|
12
|
+
# Custom routing rules can currently only be configured via Telerivet's web
|
13
|
+
# UI.
|
8
14
|
#
|
9
15
|
# Fields:
|
10
16
|
#
|
@@ -87,7 +87,7 @@ module Telerivet
|
|
87
87
|
#
|
88
88
|
# - message_type
|
89
89
|
# * Type of scheduled message
|
90
|
-
# * Allowed values: sms, ussd, call
|
90
|
+
# * Allowed values: sms, mms, ussd, call, service
|
91
91
|
# * Read-only
|
92
92
|
#
|
93
93
|
# - time_created (UNIX timestamp)
|
@@ -122,6 +122,19 @@ module Telerivet
|
|
122
122
|
# content, false otherwise
|
123
123
|
# * Read-only
|
124
124
|
#
|
125
|
+
# - track_clicks (boolean)
|
126
|
+
# * If true, URLs in the message content will automatically be replaced with unique
|
127
|
+
# short URLs
|
128
|
+
# * Read-only
|
129
|
+
#
|
130
|
+
# - media (array)
|
131
|
+
# * For text messages containing media files, this is an array of objects with the
|
132
|
+
# properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
|
133
|
+
# Unknown properties are null. This property is undefined for messages that do not
|
134
|
+
# contain media files. Note: For files uploaded via the Telerivet web app, the URL is
|
135
|
+
# temporary and may not be valid for more than 1 day.
|
136
|
+
# * Read-only
|
137
|
+
#
|
125
138
|
# - vars (Hash)
|
126
139
|
# * Custom variables stored for this scheduled message (copied to Message when sent)
|
127
140
|
# * Updatable via API
|
@@ -237,6 +250,14 @@ class ScheduledMessage < Entity
|
|
237
250
|
get('is_template')
|
238
251
|
end
|
239
252
|
|
253
|
+
def track_clicks
|
254
|
+
get('track_clicks')
|
255
|
+
end
|
256
|
+
|
257
|
+
def media
|
258
|
+
get('media')
|
259
|
+
end
|
260
|
+
|
240
261
|
def label_ids
|
241
262
|
get('label_ids')
|
242
263
|
end
|
data/lib/telerivet/service.rb
CHANGED
@@ -82,7 +82,9 @@ class Service < Entity
|
|
82
82
|
#
|
83
83
|
# For example, to send a poll to a particular contact (or resend the
|
84
84
|
# current question), you can invoke the poll service with context=contact, and `contact_id` as
|
85
|
-
# the ID of the contact to send the poll to.
|
85
|
+
# the ID of the contact to send the poll to. (To trigger a service to multiple contacts, use
|
86
|
+
# [project.sendBroadcast](#Project.sendBroadcast). To schedule a service in the future, use
|
87
|
+
# [project.scheduleMessage](#Project.scheduleMessage).)
|
86
88
|
#
|
87
89
|
# Or, to manually apply a service for an incoming message, you can
|
88
90
|
# invoke the service with `context`=`message`, `event`=`incoming_message`, and `message_id` as
|
@@ -107,11 +109,35 @@ class Service < Entity
|
|
107
109
|
# * Required if context is 'message'
|
108
110
|
#
|
109
111
|
# - contact_id
|
110
|
-
# * The ID of the contact this service is triggered for
|
111
|
-
#
|
112
|
+
# * The ID of the contact this service is triggered for (either `contact_id` or
|
113
|
+
# `phone_number` is required if `context` is 'contact')
|
114
|
+
#
|
115
|
+
# - phone_number
|
116
|
+
# * The phone number of the contact this service is triggered for (either `contact_id`
|
117
|
+
# or `phone_number` is required if `context` is 'contact'). If no contact exists with
|
118
|
+
# this phone number, a new contact will be created.
|
119
|
+
#
|
120
|
+
# - route_id
|
121
|
+
# * The ID of the phone or route that the service will use for sending messages by
|
122
|
+
# default
|
112
123
|
#
|
113
124
|
# Returns:
|
114
|
-
#
|
125
|
+
# (associative array)
|
126
|
+
# - return_value (any)
|
127
|
+
# * Return value of the service. May be any JSON type (boolean, number, string,
|
128
|
+
# array, object, or null).
|
129
|
+
#
|
130
|
+
# - log_entries (array)
|
131
|
+
# * Array of log entry strings generated by the service
|
132
|
+
#
|
133
|
+
# - errors (array)
|
134
|
+
# * Array of error message strings generated by the service
|
135
|
+
#
|
136
|
+
# - sent_messages (array of objects)
|
137
|
+
# * Array of messages sent by the service
|
138
|
+
#
|
139
|
+
# - airtime_transactions (array of objects)
|
140
|
+
# * Array of airtime transactions sent by the service
|
115
141
|
#
|
116
142
|
def invoke(options)
|
117
143
|
invoke_result = @api.do_request('POST', get_base_api_path() + '/invoke', options)
|
@@ -223,7 +249,7 @@ class Service < Entity
|
|
223
249
|
# * Default: asc
|
224
250
|
#
|
225
251
|
# - page_size (int)
|
226
|
-
# * Number of results returned per page (max
|
252
|
+
# * Number of results returned per page (max 500)
|
227
253
|
# * Default: 50
|
228
254
|
#
|
229
255
|
# - offset (int)
|
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.
|
4
|
+
version: 1.4.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:
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby client library for Telerivet REST API
|
14
14
|
email: support@telerivet.com
|
@@ -18,6 +18,7 @@ extra_rdoc_files: []
|
|
18
18
|
files:
|
19
19
|
- lib/cacert.pem
|
20
20
|
- lib/telerivet.rb
|
21
|
+
- lib/telerivet/airtimetransaction.rb
|
21
22
|
- lib/telerivet/apicursor.rb
|
22
23
|
- lib/telerivet/broadcast.rb
|
23
24
|
- lib/telerivet/contact.rb
|
@@ -28,7 +29,6 @@ files:
|
|
28
29
|
- lib/telerivet/group.rb
|
29
30
|
- lib/telerivet/label.rb
|
30
31
|
- lib/telerivet/message.rb
|
31
|
-
- lib/telerivet/mobilemoneyreceipt.rb
|
32
32
|
- lib/telerivet/organization.rb
|
33
33
|
- lib/telerivet/phone.rb
|
34
34
|
- lib/telerivet/project.rb
|
@@ -54,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
|
58
|
-
rubygems_version: 2.6.7
|
57
|
+
rubygems_version: 3.0.3
|
59
58
|
signing_key:
|
60
59
|
specification_version: 4
|
61
60
|
summary: Telerivet REST API Client
|
@@ -1,187 +0,0 @@
|
|
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
|