telerivet 1.1.0 → 1.1.4

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
  SHA1:
3
- metadata.gz: 318bae0777cbacdccba67044f107f9f2a468b6d5
4
- data.tar.gz: 005116ddbd32e76a91feafe5794ff3f13ec3503b
3
+ metadata.gz: be1f221262cc98190c641723d908f68310443816
4
+ data.tar.gz: a6226f0040d537a9d57e8cb0ba5096cd146d86b1
5
5
  SHA512:
6
- metadata.gz: 7a6de21710242c4db07004bd23ba4ee6730457a4c03389d34e5bc1d92b4e15fb953003319198e61dd923b20c2a9a1abbfe741109e5cdc156e0dfd07742a760b2
7
- data.tar.gz: cd1d5bf58e26fe7e3b5fe6cde3b4152ff8e8d515437fb24cec4440198bf42161d7acb019b252266f4bfa51a535495e76bc56d0b090993e682bee2dfc56b37d9c
6
+ metadata.gz: d4305ddcd83b4eb883be1cc34a182034e34911e7bf511532c28db91f728b5341d974b722d4b679de2954583e4f22b760745b01c9ec4e7e9be707bc8fb12ce4b8
7
+ data.tar.gz: d4fa2bd64725feb1459cbfa018a0755154e5dd8a9cf79cf75244248b254a566a6d71fccc71004e6ce3e9471c79fad55063ddd9f6cbdc93d5a21b16b11d08d73e
data/lib/telerivet.rb CHANGED
@@ -8,7 +8,7 @@ module Telerivet
8
8
  class API
9
9
  attr_reader :num_requests
10
10
 
11
- @@client_version = '1.1.0'
11
+ @@client_version = '1.1.4'
12
12
 
13
13
  #
14
14
  # Initializes a client handle to the Telerivet REST API.
@@ -106,6 +106,10 @@ module Telerivet
106
106
  # * ID of the contact that sent or received the message
107
107
  # * Read-only
108
108
  #
109
+ # - route_id (string, max 34 characters)
110
+ # * ID of the route that sent the message (if applicable)
111
+ # * Read-only
112
+ #
109
113
  # - project_id
110
114
  # * ID of the project this contact belongs to
111
115
  # * Read-only
@@ -181,6 +185,39 @@ class Message < Entity
181
185
  super
182
186
  end
183
187
 
188
+ #
189
+ # Resends a message, for example if the message failed to send or if it was not delivered. If
190
+ # the message was originally in the queued, retrying, failed, or cancelled states, then
191
+ # Telerivet will return the same message object. Otherwise, Telerivet will create and return a
192
+ # new message object.
193
+ #
194
+ # Arguments:
195
+ # - options (Hash)
196
+ #
197
+ # - route_id
198
+ # * ID of the phone or route to send the message from
199
+ #
200
+ # Returns:
201
+ # Telerivet::Message
202
+ #
203
+ def resend(options = nil)
204
+ require_relative 'message'
205
+ Message.new(@api, @api.do_request("POST", get_base_api_path() + "/resend", options))
206
+ end
207
+
208
+ #
209
+ # Cancels sending a message that has not yet been sent. Returns the updated message object.
210
+ # Only valid for outgoing messages that are currently in the queued, retrying, or cancelled
211
+ # states. For other messages, the API will return an error with the code 'not_cancellable'.
212
+ #
213
+ # Returns:
214
+ # Telerivet::Message
215
+ #
216
+ def cancel()
217
+ require_relative 'message'
218
+ Message.new(@api, @api.do_request("POST", get_base_api_path() + "/cancel"))
219
+ end
220
+
184
221
  #
185
222
  # Deletes this message.
186
223
  #
@@ -276,6 +313,10 @@ class Message < Entity
276
313
  get('contact_id')
277
314
  end
278
315
 
316
+ def route_id
317
+ get('route_id')
318
+ end
319
+
279
320
  def project_id
280
321
  get('project_id')
281
322
  end
@@ -22,6 +22,15 @@ module Telerivet
22
22
  # * Type of this phone/gateway (e.g. android, twilio, nexmo, etc)
23
23
  # * Read-only
24
24
  #
25
+ # - country
26
+ # * 2-letter country code (ISO 3166-1 alpha-2) where phone is from
27
+ # * Read-only
28
+ #
29
+ # - send_paused (bool)
30
+ # * True if sending messages is currently paused, false if the phone can currently send
31
+ # messages
32
+ # * Updatable via API
33
+ #
25
34
  # - time_created (UNIX timestamp)
26
35
  # * Time the phone was created in Telerivet
27
36
  # * Read-only
@@ -176,6 +185,18 @@ class Phone < Entity
176
185
  get('phone_type')
177
186
  end
178
187
 
188
+ def country
189
+ get('country')
190
+ end
191
+
192
+ def send_paused
193
+ get('send_paused')
194
+ end
195
+
196
+ def send_paused=(value)
197
+ set('send_paused', value)
198
+ end
199
+
179
200
  def time_created
180
201
  get('time_created')
181
202
  end
@@ -212,6 +212,55 @@ class Project < Entity
212
212
  ScheduledMessage.new(@api, @api.do_request("POST", get_base_api_path() + "/scheduled", options))
213
213
  end
214
214
 
215
+ #
216
+ # Add an incoming message to Telerivet. Acts the same as if the message was received by a
217
+ # phone. Also triggers any automated services that apply to the message.
218
+ #
219
+ # Arguments:
220
+ # - options (Hash)
221
+ # * Required
222
+ #
223
+ # - content
224
+ # * Content of the incoming message
225
+ # * Required unless message_type is call
226
+ #
227
+ # - message_type
228
+ # * Type of message
229
+ # * Allowed values: sms, call
230
+ # * Default: sms
231
+ #
232
+ # - from_number
233
+ # * Phone number that sent the incoming message
234
+ # * Required
235
+ #
236
+ # - phone_id
237
+ # * ID of the phone that received the message
238
+ # * Required
239
+ #
240
+ # - to_number
241
+ # * Phone number that the incoming message was sent to
242
+ # * Default: phone number of the phone that received the message
243
+ #
244
+ # - simulated (bool)
245
+ # * If true, Telerivet will not send automated replies to actual phones
246
+ #
247
+ # - starred (bool)
248
+ # * True if this message should be starred
249
+ #
250
+ # - label_ids (array)
251
+ # * Array of IDs of labels to add to this message (maximum 5)
252
+ #
253
+ # - vars (Hash)
254
+ # * Custom variables to set for this message
255
+ #
256
+ # Returns:
257
+ # Telerivet::Message
258
+ #
259
+ def receive_message(options)
260
+ require_relative 'message'
261
+ Message.new(@api, @api.do_request("POST", get_base_api_path() + "/messages/receive", options))
262
+ end
263
+
215
264
  #
216
265
  # Retrieves OR creates and possibly updates a contact by name or phone number.
217
266
  #
@@ -37,7 +37,7 @@ module Telerivet
37
37
  # * Read-only
38
38
  #
39
39
  # - route_id
40
- # * ID of the phone or route to the message will be sent from
40
+ # * ID of the phone or route the message will be sent from
41
41
  # * Read-only
42
42
  #
43
43
  # - message_type
@@ -67,6 +67,12 @@ module Telerivet
67
67
  # * ID of the group containing contacts that have completed an interaction with this
68
68
  # service (currently only used for polls)
69
69
  # * Read-only
70
+ #
71
+ # - questions (array)
72
+ # * Array of objects describing each question in a poll (only used for polls). Each
73
+ # object has the properties "id" (the question ID), "content" (the text of the
74
+ # question), and "question_type" (either "multiple_choice", "missed_call", or "open").
75
+ # * Read-only
70
76
  #
71
77
  class Service < Entity
72
78
 
@@ -290,6 +296,10 @@ class Service < Entity
290
296
  get('respondent_group_id')
291
297
  end
292
298
 
299
+ def questions
300
+ get('questions')
301
+ end
302
+
293
303
  def get_base_api_path()
294
304
  "/projects/#{get('project_id')}/services/#{get('id')}"
295
305
  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.1.0
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client library for Telerivet REST API
14
14
  email: support@telerivet.com