telerivet 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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
@@ -95,7 +97,7 @@ class Service < Entity
95
97
  #
96
98
  # - context
97
99
  # * The name of the context in which this service is invoked
98
- # * Allowed values: message, call, contact, project
100
+ # * Allowed values: message, call, ussd_session, row, contact, project
99
101
  # * Required
100
102
  #
101
103
  # - event
@@ -107,11 +109,40 @@ 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
- # * Required if context is 'contact'
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
123
+ #
124
+ # - async (bool)
125
+ # * If set to true, the service will be invoked asynchronously. By default, queued
126
+ # services will be invoked one at a time for each project.
112
127
  #
113
128
  # Returns:
114
- # object
129
+ # (associative array)
130
+ # - return_value (any)
131
+ # * Return value of the service. May be any JSON type (boolean, number, string,
132
+ # array, object, or null). (Undefined if async=true.)
133
+ #
134
+ # - log_entries (array)
135
+ # * Array of log entry strings generated by the service. (Undefined if async=true.)
136
+ #
137
+ # - errors (array)
138
+ # * Array of error message strings generated by the service. (Undefined if
139
+ # async=true.)
140
+ #
141
+ # - sent_messages (array of objects)
142
+ # * Array of messages sent by the service (Undefined if async=true.)
143
+ #
144
+ # - airtime_transactions (array of objects)
145
+ # * Array of airtime transactions sent by the service (Undefined if async=true.)
115
146
  #
116
147
  def invoke(options)
117
148
  invoke_result = @api.do_request('POST', get_base_api_path() + '/invoke', options)
@@ -208,9 +239,9 @@ class Service < Entity
208
239
  #
209
240
  # - vars (Hash)
210
241
  # * Filter states by value of a custom variable (e.g. vars[email], vars[foo], etc.)
211
- # * Allowed modifiers: vars[foo][exists], vars[foo][ne], vars[foo][prefix],
212
- # vars[foo][not_prefix], vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte],
213
- # vars[foo][min], vars[foo][max]
242
+ # * Allowed modifiers: vars[foo][ne], vars[foo][prefix], vars[foo][not_prefix],
243
+ # vars[foo][gte], vars[foo][gt], vars[foo][lt], vars[foo][lte], vars[foo][min],
244
+ # vars[foo][max], vars[foo][exists]
214
245
  #
215
246
  # - sort
216
247
  # * Sort the results based on a field
@@ -223,7 +254,7 @@ class Service < Entity
223
254
  # * Default: asc
224
255
  #
225
256
  # - page_size (int)
226
- # * Number of results returned per page (max 200)
257
+ # * Number of results returned per page (max 500)
227
258
  # * Default: 50
228
259
  #
229
260
  # - offset (int)
@@ -0,0 +1,151 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents an asynchronous task that is applied to all entities matching a filter.
6
+ #
7
+ # Tasks include services applied to contacts, messages, or data rows; adding
8
+ # or removing contacts from a group; blocking or unblocking sending messages to a contact;
9
+ # updating a custom variable; deleting contacts, messages, or data rows; or
10
+ # exporting data to CSV.
11
+ #
12
+ # Fields:
13
+ #
14
+ # - id (string, max 34 characters)
15
+ # * ID of the task
16
+ # * Read-only
17
+ #
18
+ # - task_type (string)
19
+ # * The task type
20
+ # * Read-only
21
+ #
22
+ # - task_params (Hash)
23
+ # * Parameters applied to all matching rows (specific to `task_type`). See
24
+ # [project.createTask](#Project.createTask).
25
+ # * Read-only
26
+ #
27
+ # - filter_type
28
+ # * Type of filter defining the rows that the task is applied to
29
+ # * Read-only
30
+ #
31
+ # - filter_params (Hash)
32
+ # * Parameters defining the rows that the task is applied to (specific to
33
+ # `filter_type`). See [project.createTask](#Project.createTask).
34
+ # * Read-only
35
+ #
36
+ # - time_created (UNIX timestamp)
37
+ # * Time the task was created in Telerivet
38
+ # * Read-only
39
+ #
40
+ # - time_active (UNIX timestamp)
41
+ # * Time Telerivet started executing the task
42
+ # * Read-only
43
+ #
44
+ # - time_complete (UNIX timestamp)
45
+ # * Time Telerivet finished executing the task
46
+ # * Read-only
47
+ #
48
+ # - total_rows (int)
49
+ # * The total number of rows matching the filter (null if not known)
50
+ # * Read-only
51
+ #
52
+ # - current_row (int)
53
+ # * The number of rows that have been processed so far
54
+ # * Read-only
55
+ #
56
+ # - status (string)
57
+ # * The current status of the task
58
+ # * Allowed values: created, queued, active, complete, failed, cancelled
59
+ # * Read-only
60
+ #
61
+ # - vars (Hash)
62
+ # * Custom variables stored for this task
63
+ # * Read-only
64
+ #
65
+ # - table_id (string, max 34 characters)
66
+ # * ID of the data table this task is applied to (if applicable)
67
+ # * Read-only
68
+ #
69
+ # - user_id (string, max 34 characters)
70
+ # * ID of the Telerivet user who created the task (if applicable)
71
+ # * Read-only
72
+ #
73
+ # - project_id
74
+ # * ID of the project this task belongs to
75
+ # * Read-only
76
+ #
77
+ class Task < Entity
78
+ #
79
+ # Cancels a task that is not yet complete.
80
+ #
81
+ # Returns:
82
+ # Telerivet::Task
83
+ #
84
+ def cancel()
85
+ require_relative 'task'
86
+ Task.new(@api, @api.do_request("POST", get_base_api_path() + "/cancel"))
87
+ end
88
+
89
+ def id
90
+ get('id')
91
+ end
92
+
93
+ def task_type
94
+ get('task_type')
95
+ end
96
+
97
+ def task_params
98
+ get('task_params')
99
+ end
100
+
101
+ def filter_type
102
+ get('filter_type')
103
+ end
104
+
105
+ def filter_params
106
+ get('filter_params')
107
+ end
108
+
109
+ def time_created
110
+ get('time_created')
111
+ end
112
+
113
+ def time_active
114
+ get('time_active')
115
+ end
116
+
117
+ def time_complete
118
+ get('time_complete')
119
+ end
120
+
121
+ def total_rows
122
+ get('total_rows')
123
+ end
124
+
125
+ def current_row
126
+ get('current_row')
127
+ end
128
+
129
+ def status
130
+ get('status')
131
+ end
132
+
133
+ def table_id
134
+ get('table_id')
135
+ end
136
+
137
+ def user_id
138
+ get('user_id')
139
+ end
140
+
141
+ def project_id
142
+ get('project_id')
143
+ end
144
+
145
+ def get_base_api_path()
146
+ "/projects/#{get('project_id')}/tasks/#{get('id')}"
147
+ end
148
+
149
+ end
150
+
151
+ end
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.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2021-03-27 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
@@ -34,6 +35,7 @@ files:
34
35
  - lib/telerivet/route.rb
35
36
  - lib/telerivet/scheduledmessage.rb
36
37
  - lib/telerivet/service.rb
38
+ - lib/telerivet/task.rb
37
39
  homepage: http://telerivet.com
38
40
  licenses:
39
41
  - MIT
@@ -53,8 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
55
  - !ruby/object:Gem::Version
54
56
  version: '0'
55
57
  requirements: []
56
- rubyforge_project:
57
- rubygems_version: 2.6.7
58
+ rubygems_version: 3.0.3
58
59
  signing_key:
59
60
  specification_version: 4
60
61
  summary: Telerivet REST API Client