telerivet 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0633af0317a3ef409a86481a483f934d2832d2f6a11fd545221997c3ebb495ad
4
- data.tar.gz: 344a694d8cc84a5231cefa14d26f89fceecf6d140f201e013705794684f94015
3
+ metadata.gz: b442bc6d2aab45f4be47acc976f991bbd399de9a68ac092ec6dd2d717c3373e9
4
+ data.tar.gz: 7c629053a6f168be87bb4e705e6cad78c9e7ec3aebe34cbb7553843dcf0cb02b
5
5
  SHA512:
6
- metadata.gz: 74a877df3a572e3b1d96922343d0bc54ed58a2f2d28b36bf883691a3b440244e777cdb74cfed10f701a2f8a768dd157e5ada0f116b1c588774744080699fabc8
7
- data.tar.gz: b75d13f319943c2f899200a1845932aad01205a902b280c2128d8bf19c7453b696386a539c278df2a1a19cba14c018189a817a622f2897d229b63eba3f94b7f3
6
+ metadata.gz: b2585a9e281177331fe9615cbf02d91169f5f6bb178ebe228cd81b4def87576a7486b4e5457261b324f6fe1b958bace906e2e3a28d5b9bef8cb7c77f09bc9586
7
+ data.tar.gz: 35cb63dc5fbcdb5400808a8f3c4db85e4e5b07d85bd273c01d4693975ae10682e758a67e92797b7e771ccaba6fcd573e3629389aed7696346eff142da6186ef7
@@ -9,7 +9,7 @@ module Telerivet
9
9
  class API
10
10
  attr_reader :num_requests
11
11
 
12
- @@client_version = '1.4.5'
12
+ @@client_version = '1.4.6'
13
13
 
14
14
  #
15
15
  # Initializes a client handle to the Telerivet REST API.
@@ -0,0 +1,131 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a transaction where airtime is sent to a mobile phone number.
6
+ #
7
+ # To send airtime, first [create a Custom Actions service to send a particular amount of
8
+ # airtime](/dashboard/add_service?subtype_id=main.service.rules.contact&action_id=main.rule.sendairtime),
9
+ # then trigger the service using [service.invoke](#Service.invoke),
10
+ # [project.sendBroadcast](#Project.sendBroadcast), or
11
+ # [project.scheduleMessage](#Project.scheduleMessage).
12
+ #
13
+ # Fields:
14
+ #
15
+ # - id
16
+ # * ID of the airtime transaction
17
+ # * Read-only
18
+ #
19
+ # - to_number
20
+ # * Destination phone number in international format (no leading +)
21
+ # * Read-only
22
+ #
23
+ # - operator_name
24
+ # * Operator name
25
+ # * Read-only
26
+ #
27
+ # - country
28
+ # * Country code
29
+ # * Read-only
30
+ #
31
+ # - status
32
+ # * Current status of airtime transaction (`successful`, `failed`, `cancelled`,
33
+ # `queued`, `pending_approval`, or `pending_payment`)
34
+ # * Read-only
35
+ #
36
+ # - status_text
37
+ # * Error or success message returned by airtime provider, if available
38
+ # * Read-only
39
+ #
40
+ # - value
41
+ # * Value of airtime sent to destination phone number, in units of value_currency
42
+ # * Read-only
43
+ #
44
+ # - value_currency
45
+ # * Currency code of price
46
+ # * Read-only
47
+ #
48
+ # - price
49
+ # * Price charged for airtime transaction, in units of price_currency
50
+ # * Read-only
51
+ #
52
+ # - price_currency
53
+ # * Currency code of price
54
+ # * Read-only
55
+ #
56
+ # - contact_id
57
+ # * ID of the contact the airtime was sent to
58
+ # * Read-only
59
+ #
60
+ # - service_id
61
+ # * ID of the service that sent the airtime
62
+ # * Read-only
63
+ #
64
+ # - project_id
65
+ # * ID of the project that the airtime transaction belongs to
66
+ # * Read-only
67
+ #
68
+ # - vars (Hash)
69
+ # * Custom variables stored for this transaction
70
+ # * Updatable via API
71
+ #
72
+ class AirtimeTransaction < Entity
73
+ def id
74
+ get('id')
75
+ end
76
+
77
+ def to_number
78
+ get('to_number')
79
+ end
80
+
81
+ def operator_name
82
+ get('operator_name')
83
+ end
84
+
85
+ def country
86
+ get('country')
87
+ end
88
+
89
+ def status
90
+ get('status')
91
+ end
92
+
93
+ def status_text
94
+ get('status_text')
95
+ end
96
+
97
+ def value
98
+ get('value')
99
+ end
100
+
101
+ def value_currency
102
+ get('value_currency')
103
+ end
104
+
105
+ def price
106
+ get('price')
107
+ end
108
+
109
+ def price_currency
110
+ get('price_currency')
111
+ end
112
+
113
+ def contact_id
114
+ get('contact_id')
115
+ end
116
+
117
+ def service_id
118
+ get('service_id')
119
+ end
120
+
121
+ def project_id
122
+ get('project_id')
123
+ end
124
+
125
+ def get_base_api_path()
126
+ "/projects/#{get('project_id')}/airtime_transactions/#{get('id')}"
127
+ end
128
+
129
+ end
130
+
131
+ end
@@ -109,7 +109,7 @@ module Telerivet
109
109
  #
110
110
  # - source
111
111
  # * How the message originated within Telerivet
112
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
112
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration
113
113
  # * Read-only
114
114
  #
115
115
  # - simulated (bool)
@@ -27,6 +27,11 @@ module Telerivet
27
27
  # * True if Telerivet is blocked from sending messages to this contact
28
28
  # * Updatable via API
29
29
  #
30
+ # - conversation_status
31
+ # * Current status of the conversation with this contact
32
+ # * Allowed values: closed, active, handled
33
+ # * Updatable via API
34
+ #
30
35
  # - last_message_time (UNIX timestamp)
31
36
  # * Last time the contact sent or received a message (null if no messages have been sent
32
37
  # or received)
@@ -133,7 +138,8 @@ class Contact < Entity
133
138
  #
134
139
  # - source
135
140
  # * Filter messages by source
136
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
141
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
142
+ # integration
137
143
  #
138
144
  # - starred (bool)
139
145
  # * Filter messages by starred/unstarred
@@ -405,6 +411,14 @@ class Contact < Entity
405
411
  set('send_blocked', value)
406
412
  end
407
413
 
414
+ def conversation_status
415
+ get('conversation_status')
416
+ end
417
+
418
+ def conversation_status=(value)
419
+ set('conversation_status', value)
420
+ end
421
+
408
422
  def last_message_time
409
423
  get('last_message_time')
410
424
  end
@@ -43,7 +43,8 @@ class Label < Entity
43
43
  #
44
44
  # - source
45
45
  # * Filter messages by source
46
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
46
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
47
+ # integration
47
48
  #
48
49
  # - starred (bool)
49
50
  # * Filter messages by starred/unstarred
@@ -28,7 +28,7 @@ module Telerivet
28
28
  #
29
29
  # - source
30
30
  # * How the message originated within Telerivet
31
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
31
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration
32
32
  # * Read-only
33
33
  #
34
34
  # - time_created (UNIX timestamp)
@@ -115,7 +115,8 @@ class Phone < Entity
115
115
  #
116
116
  # - source
117
117
  # * Filter messages by source
118
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
118
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
119
+ # integration
119
120
  #
120
121
  # - starred (bool)
121
122
  # * Filter messages by starred/unstarred
@@ -853,7 +853,8 @@ class Project < Entity
853
853
  #
854
854
  # - source
855
855
  # * Filter messages by source
856
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
856
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
857
+ # integration
857
858
  #
858
859
  # - starred (bool)
859
860
  # * Filter messages by starred/unstarred
@@ -1510,6 +1511,85 @@ class Project < Entity
1510
1511
  return @api.do_request("GET", get_base_api_path() + "/users")
1511
1512
  end
1512
1513
 
1514
+ #
1515
+ # Returns information about each airtime transaction.
1516
+ #
1517
+ # Arguments:
1518
+ # - options (Hash)
1519
+ #
1520
+ # - time_created[min] (UNIX timestamp)
1521
+ # * Filter transactions created on or after a particular time
1522
+ #
1523
+ # - time_created[max] (UNIX timestamp)
1524
+ # * Filter transactions created before a particular time
1525
+ #
1526
+ # - contact_id
1527
+ # * Filter transactions sent to a particular contact
1528
+ #
1529
+ # - to_number
1530
+ # * Filter transactions sent to a particular phone number
1531
+ #
1532
+ # - service_id
1533
+ # * Filter transactions sent by a particular service
1534
+ #
1535
+ # - status
1536
+ # * Filter transactions by status
1537
+ # * Allowed values: pending, queued, processing, successful, failed, cancelled,
1538
+ # pending_payment, pending_approval
1539
+ #
1540
+ # - sort_dir
1541
+ # * Sort the results in ascending or descending order
1542
+ # * Allowed values: asc, desc
1543
+ # * Default: asc
1544
+ #
1545
+ # - page_size (int)
1546
+ # * Number of results returned per page (max 500)
1547
+ # * Default: 50
1548
+ #
1549
+ # - offset (int)
1550
+ # * Number of items to skip from beginning of result set
1551
+ # * Default: 0
1552
+ #
1553
+ # Returns:
1554
+ # Telerivet::APICursor (of Telerivet::AirtimeTransaction)
1555
+ #
1556
+ def query_airtime_transactions(options = nil)
1557
+ require_relative 'airtimetransaction'
1558
+ @api.cursor(AirtimeTransaction, get_base_api_path() + "/airtime_transactions", options)
1559
+ end
1560
+
1561
+ #
1562
+ # Gets an airtime transaction by ID
1563
+ #
1564
+ # Arguments:
1565
+ # - id
1566
+ # * ID of the airtime transaction
1567
+ # * Required
1568
+ #
1569
+ # Returns:
1570
+ # Telerivet::AirtimeTransaction
1571
+ #
1572
+ def get_airtime_transaction_by_id(id)
1573
+ require_relative 'airtimetransaction'
1574
+ AirtimeTransaction.new(@api, @api.do_request("GET", get_base_api_path() + "/airtime_transactions/#{id}"))
1575
+ end
1576
+
1577
+ #
1578
+ # Initializes an airtime transaction by ID without making an API request.
1579
+ #
1580
+ # Arguments:
1581
+ # - id
1582
+ # * ID of the airtime transaction
1583
+ # * Required
1584
+ #
1585
+ # Returns:
1586
+ # Telerivet::AirtimeTransaction
1587
+ #
1588
+ def init_airtime_transaction_by_id(id)
1589
+ require_relative 'airtimetransaction'
1590
+ return AirtimeTransaction.new(@api, {'project_id' => self.id, 'id' => id}, false)
1591
+ end
1592
+
1513
1593
  #
1514
1594
  # Saves any fields or custom variables that have changed for the project.
1515
1595
  #
@@ -109,11 +109,35 @@ class Service < Entity
109
109
  # * Required if context is 'message'
110
110
  #
111
111
  # - contact_id
112
- # * The ID of the contact this service is triggered for
113
- # * 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
114
123
  #
115
124
  # Returns:
116
- # object
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
117
141
  #
118
142
  def invoke(options)
119
143
  invoke_result = @api.do_request('POST', get_base_api_path() + '/invoke', options)
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.5
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: 2019-11-15 00:00:00.000000000 Z
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