twilio-ruby 5.23.1 → 5.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +30 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
- data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +26 -0
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb +437 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/insights/v1/summary.rb +7 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +61 -5
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +3 -19
- data/lib/twilio-ruby/rest/sync.rb +1 -1
- data/lib/twilio-ruby/rest/sync/v1.rb +1 -1
- data/lib/twilio-ruby/rest/sync/v1/service.rb +62 -6
- data/lib/twilio-ruby/rest/verify/v2/service.rb +26 -0
- data/lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb +416 -0
- data/lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb +424 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +6 -1
- data/lib/twilio-ruby/twiml/voice_response.rb +3 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +142 -15
- data/spec/integration/api/v2010/account/conference_spec.rb +190 -20
- data/spec/integration/api/v2010/account/message_spec.rb +125 -51
- data/spec/integration/autopilot/v1/assistant/webhook_spec.rb +246 -0
- data/spec/integration/autopilot/v1/assistant_spec.rb +8 -4
- data/spec/integration/flex_api/v1/configuration_spec.rb +48 -0
- data/spec/integration/insights/v1/summary_spec.rb +1 -0
- data/spec/integration/preview/trusted_comms/current_call_spec.rb +9 -1
- data/spec/integration/sync/v1/service_spec.rb +12 -4
- data/spec/integration/verify/v2/service/rate_limit/bucket_spec.rb +249 -0
- data/spec/integration/verify/v2/service/rate_limit_spec.rb +221 -0
- data/spec/integration/verify/v2/service/verification_spec.rb +36 -0
- data/spec/integration/verify/v2/service_spec.rb +8 -4
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 077deab208a16373c55b6c378b6fb13b88c7bba67c5d77aa0669fb1ff7474aaf
|
4
|
+
data.tar.gz: 82e664f4ce7e99fe023149c361346a6c766fe17e6169eef8310fa4bd857e1d30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044d627a580368a9b835addc0b49ce97c15fc2dc6b133da974d0c960ab3ffb2933dcfebe741502df8a60bbe1ca2d6adff5ad4aa99a70e6065c34bbd2f9bd3bb1
|
7
|
+
data.tar.gz: 784716a736dfcd236bc3551a2757d0e19dd17f44c1d82a24cebb5e34e1218c3607811fccec4720cc3126042369fe16f1b94f7b31887119ed238856ac5145d8f0
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,36 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2019-06-12] Version 5.24.0
|
5
|
+
----------------------------
|
6
|
+
**Autopilot**
|
7
|
+
- Add Webhooks resource to Autopilot Assistant.
|
8
|
+
|
9
|
+
**Flex**
|
10
|
+
- Added missing 'custom' type to Flex Flow
|
11
|
+
- Adding `integrations` to Flex Configuration
|
12
|
+
|
13
|
+
**Insights**
|
14
|
+
- Added attributes to summary.
|
15
|
+
|
16
|
+
**Messaging**
|
17
|
+
- Message API Create updated with conditional params **(breaking change)**
|
18
|
+
|
19
|
+
**Proxy**
|
20
|
+
- Document that Proxy will return a maximum of 100 records for read/list endpoints **(breaking change)**
|
21
|
+
- Remove non-updatable property parameters for Session update (mode, participants) **(breaking change)**
|
22
|
+
|
23
|
+
**Sync**
|
24
|
+
- Added reachability debouncing configuration options.
|
25
|
+
|
26
|
+
**Verify**
|
27
|
+
- Add `RateLimits` and `Buckets` resources to Verify Services
|
28
|
+
- Add `RateLimits` optional parameter on `Verification` creation.
|
29
|
+
|
30
|
+
**Twiml**
|
31
|
+
- Fix `<Room>` participantIdentity casing
|
32
|
+
|
33
|
+
|
4
34
|
[2019-05-29] Version 5.23.1
|
5
35
|
----------------------------
|
6
36
|
**Verify**
|
data/README.md
CHANGED
@@ -26,13 +26,13 @@ in-line code documentation here in the library.
|
|
26
26
|
To install using [Bundler][bundler] grab the latest stable version:
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
gem 'twilio-ruby', '~> 5.
|
29
|
+
gem 'twilio-ruby', '~> 5.24.0'
|
30
30
|
```
|
31
31
|
|
32
32
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
33
33
|
|
34
34
|
```bash
|
35
|
-
gem install twilio-ruby -v 5.
|
35
|
+
gem install twilio-ruby -v 5.24.0
|
36
36
|
```
|
37
37
|
|
38
38
|
To build and install the development branch yourself from the latest source:
|
@@ -416,13 +416,13 @@ module Twilio
|
|
416
416
|
'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
|
417
417
|
'date_sent' => Twilio.deserialize_rfc2822(payload['date_sent']),
|
418
418
|
'direction' => payload['direction'],
|
419
|
-
'error_code' => payload['error_code'].to_i,
|
419
|
+
'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
|
420
420
|
'error_message' => payload['error_message'],
|
421
421
|
'from' => payload['from'],
|
422
422
|
'messaging_service_sid' => payload['messaging_service_sid'],
|
423
423
|
'num_media' => payload['num_media'],
|
424
424
|
'num_segments' => payload['num_segments'],
|
425
|
-
'price' => payload['price']
|
425
|
+
'price' => payload['price'],
|
426
426
|
'price_unit' => payload['price_unit'],
|
427
427
|
'sid' => payload['sid'],
|
428
428
|
'status' => payload['status'],
|
@@ -208,6 +208,7 @@ module Twilio
|
|
208
208
|
@style_sheet = nil
|
209
209
|
@defaults = nil
|
210
210
|
@dialogues = nil
|
211
|
+
@webhooks = nil
|
211
212
|
end
|
212
213
|
|
213
214
|
##
|
@@ -376,6 +377,24 @@ module Twilio
|
|
376
377
|
@dialogues
|
377
378
|
end
|
378
379
|
|
380
|
+
##
|
381
|
+
# Access the webhooks
|
382
|
+
# @return [WebhookList]
|
383
|
+
# @return [WebhookContext] if sid was passed.
|
384
|
+
def webhooks(sid=:unset)
|
385
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
386
|
+
|
387
|
+
if sid != :unset
|
388
|
+
return WebhookContext.new(@version, @solution[:sid], sid, )
|
389
|
+
end
|
390
|
+
|
391
|
+
unless @webhooks
|
392
|
+
@webhooks = WebhookList.new(@version, assistant_sid: @solution[:sid], )
|
393
|
+
end
|
394
|
+
|
395
|
+
@webhooks
|
396
|
+
end
|
397
|
+
|
379
398
|
##
|
380
399
|
# Provide a user friendly representation
|
381
400
|
def to_s
|
@@ -601,6 +620,13 @@ module Twilio
|
|
601
620
|
context.dialogues
|
602
621
|
end
|
603
622
|
|
623
|
+
##
|
624
|
+
# Access the webhooks
|
625
|
+
# @return [webhooks] webhooks
|
626
|
+
def webhooks
|
627
|
+
context.webhooks
|
628
|
+
end
|
629
|
+
|
604
630
|
##
|
605
631
|
# Provide a user friendly representation
|
606
632
|
def to_s
|
@@ -0,0 +1,437 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Autopilot < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class AssistantContext < InstanceContext
|
14
|
+
##
|
15
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
16
|
+
class WebhookList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the WebhookList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] assistant_sid The SID of the
|
21
|
+
# [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the
|
22
|
+
# parent of the resource.
|
23
|
+
# @return [WebhookList] WebhookList
|
24
|
+
def initialize(version, assistant_sid: nil)
|
25
|
+
super(version)
|
26
|
+
|
27
|
+
# Path Solution
|
28
|
+
@solution = {assistant_sid: assistant_sid}
|
29
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks"
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Lists WebhookInstance records from the API as a list.
|
34
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
35
|
+
# memory before returning.
|
36
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
37
|
+
# guarantees to never return more than limit. Default is no limit
|
38
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
39
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
40
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
41
|
+
# efficient page size, i.e. min(limit, 1000)
|
42
|
+
# @return [Array] Array of up to limit results
|
43
|
+
def list(limit: nil, page_size: nil)
|
44
|
+
self.stream(limit: limit, page_size: page_size).entries
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Streams WebhookInstance records from the API as an Enumerable.
|
49
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
50
|
+
# is reached.
|
51
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
52
|
+
# guarantees to never return more than limit. Default is no limit.
|
53
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
54
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
55
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
56
|
+
# efficient page size, i.e. min(limit, 1000)
|
57
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
58
|
+
def stream(limit: nil, page_size: nil)
|
59
|
+
limits = @version.read_limits(limit, page_size)
|
60
|
+
|
61
|
+
page = self.page(page_size: limits[:page_size], )
|
62
|
+
|
63
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# When passed a block, yields WebhookInstance records from the API.
|
68
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
69
|
+
# is reached.
|
70
|
+
def each
|
71
|
+
limits = @version.read_limits
|
72
|
+
|
73
|
+
page = self.page(page_size: limits[:page_size], )
|
74
|
+
|
75
|
+
@version.stream(page,
|
76
|
+
limit: limits[:limit],
|
77
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Retrieve a single page of WebhookInstance records from the API.
|
82
|
+
# Request is executed immediately.
|
83
|
+
# @param [String] page_token PageToken provided by the API
|
84
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
85
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
86
|
+
# @return [Page] Page of WebhookInstance
|
87
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
88
|
+
params = Twilio::Values.of({
|
89
|
+
'PageToken' => page_token,
|
90
|
+
'Page' => page_number,
|
91
|
+
'PageSize' => page_size,
|
92
|
+
})
|
93
|
+
response = @version.page(
|
94
|
+
'GET',
|
95
|
+
@uri,
|
96
|
+
params
|
97
|
+
)
|
98
|
+
WebhookPage.new(@version, response, @solution)
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Retrieve a single page of WebhookInstance records from the API.
|
103
|
+
# Request is executed immediately.
|
104
|
+
# @param [String] target_url API-generated URL for the requested results page
|
105
|
+
# @return [Page] Page of WebhookInstance
|
106
|
+
def get_page(target_url)
|
107
|
+
response = @version.domain.request(
|
108
|
+
'GET',
|
109
|
+
target_url
|
110
|
+
)
|
111
|
+
WebhookPage.new(@version, response, @solution)
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Retrieve a single page of WebhookInstance records from the API.
|
116
|
+
# Request is executed immediately.
|
117
|
+
# @param [String] unique_name An application-defined string that uniquely
|
118
|
+
# identifies the new resource. It can be used as an alternative to the `sid` in
|
119
|
+
# the URL path to address the resource. This value must be unique and 64
|
120
|
+
# characters or less in length.
|
121
|
+
# @param [String] events The list of space-separated events that this Webhook will
|
122
|
+
# subscribe to.
|
123
|
+
# @param [String] webhook_url The URL associated with this Webhook.
|
124
|
+
# @param [String] webhook_method The method to be used when calling the webhook's
|
125
|
+
# URL.
|
126
|
+
# @return [WebhookInstance] Newly created WebhookInstance
|
127
|
+
def create(unique_name: nil, events: nil, webhook_url: nil, webhook_method: :unset)
|
128
|
+
data = Twilio::Values.of({
|
129
|
+
'UniqueName' => unique_name,
|
130
|
+
'Events' => events,
|
131
|
+
'WebhookUrl' => webhook_url,
|
132
|
+
'WebhookMethod' => webhook_method,
|
133
|
+
})
|
134
|
+
|
135
|
+
payload = @version.create(
|
136
|
+
'POST',
|
137
|
+
@uri,
|
138
|
+
data: data
|
139
|
+
)
|
140
|
+
|
141
|
+
WebhookInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# Provide a user friendly representation
|
146
|
+
def to_s
|
147
|
+
'#<Twilio.Autopilot.V1.WebhookList>'
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
153
|
+
class WebhookPage < Page
|
154
|
+
##
|
155
|
+
# Initialize the WebhookPage
|
156
|
+
# @param [Version] version Version that contains the resource
|
157
|
+
# @param [Response] response Response from the API
|
158
|
+
# @param [Hash] solution Path solution for the resource
|
159
|
+
# @return [WebhookPage] WebhookPage
|
160
|
+
def initialize(version, response, solution)
|
161
|
+
super(version, response)
|
162
|
+
|
163
|
+
# Path Solution
|
164
|
+
@solution = solution
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Build an instance of WebhookInstance
|
169
|
+
# @param [Hash] payload Payload response from the API
|
170
|
+
# @return [WebhookInstance] WebhookInstance
|
171
|
+
def get_instance(payload)
|
172
|
+
WebhookInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# Provide a user friendly representation
|
177
|
+
def to_s
|
178
|
+
'<Twilio.Autopilot.V1.WebhookPage>'
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
184
|
+
class WebhookContext < InstanceContext
|
185
|
+
##
|
186
|
+
# Initialize the WebhookContext
|
187
|
+
# @param [Version] version Version that contains the resource
|
188
|
+
# @param [String] assistant_sid The SID of the
|
189
|
+
# [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the
|
190
|
+
# parent of the resource to fetch.
|
191
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
192
|
+
# Webhook resource to fetch.
|
193
|
+
# @return [WebhookContext] WebhookContext
|
194
|
+
def initialize(version, assistant_sid, sid)
|
195
|
+
super(version)
|
196
|
+
|
197
|
+
# Path Solution
|
198
|
+
@solution = {assistant_sid: assistant_sid, sid: sid, }
|
199
|
+
@uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks/#{@solution[:sid]}"
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# Fetch a WebhookInstance
|
204
|
+
# @return [WebhookInstance] Fetched WebhookInstance
|
205
|
+
def fetch
|
206
|
+
params = Twilio::Values.of({})
|
207
|
+
|
208
|
+
payload = @version.fetch(
|
209
|
+
'GET',
|
210
|
+
@uri,
|
211
|
+
params,
|
212
|
+
)
|
213
|
+
|
214
|
+
WebhookInstance.new(
|
215
|
+
@version,
|
216
|
+
payload,
|
217
|
+
assistant_sid: @solution[:assistant_sid],
|
218
|
+
sid: @solution[:sid],
|
219
|
+
)
|
220
|
+
end
|
221
|
+
|
222
|
+
##
|
223
|
+
# Update the WebhookInstance
|
224
|
+
# @param [String] unique_name An application-defined string that uniquely
|
225
|
+
# identifies the new resource. It can be used as an alternative to the `sid` in
|
226
|
+
# the URL path to address the resource. This value must be unique and 64
|
227
|
+
# characters or less in length.
|
228
|
+
# @param [String] events The list of space-separated events that this Webhook will
|
229
|
+
# subscribe to.
|
230
|
+
# @param [String] webhook_url The URL associated with this Webhook.
|
231
|
+
# @param [String] webhook_method The method to be used when calling the webhook's
|
232
|
+
# URL.
|
233
|
+
# @return [WebhookInstance] Updated WebhookInstance
|
234
|
+
def update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset)
|
235
|
+
data = Twilio::Values.of({
|
236
|
+
'UniqueName' => unique_name,
|
237
|
+
'Events' => events,
|
238
|
+
'WebhookUrl' => webhook_url,
|
239
|
+
'WebhookMethod' => webhook_method,
|
240
|
+
})
|
241
|
+
|
242
|
+
payload = @version.update(
|
243
|
+
'POST',
|
244
|
+
@uri,
|
245
|
+
data: data,
|
246
|
+
)
|
247
|
+
|
248
|
+
WebhookInstance.new(
|
249
|
+
@version,
|
250
|
+
payload,
|
251
|
+
assistant_sid: @solution[:assistant_sid],
|
252
|
+
sid: @solution[:sid],
|
253
|
+
)
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# Deletes the WebhookInstance
|
258
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
259
|
+
def delete
|
260
|
+
@version.delete('delete', @uri)
|
261
|
+
end
|
262
|
+
|
263
|
+
##
|
264
|
+
# Provide a user friendly representation
|
265
|
+
def to_s
|
266
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
267
|
+
"#<Twilio.Autopilot.V1.WebhookContext #{context}>"
|
268
|
+
end
|
269
|
+
|
270
|
+
##
|
271
|
+
# Provide a detailed, user friendly representation
|
272
|
+
def inspect
|
273
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
274
|
+
"#<Twilio.Autopilot.V1.WebhookContext #{context}>"
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
280
|
+
class WebhookInstance < InstanceResource
|
281
|
+
##
|
282
|
+
# Initialize the WebhookInstance
|
283
|
+
# @param [Version] version Version that contains the resource
|
284
|
+
# @param [Hash] payload payload that contains response from Twilio
|
285
|
+
# @param [String] assistant_sid The SID of the
|
286
|
+
# [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the
|
287
|
+
# parent of the resource.
|
288
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
289
|
+
# Webhook resource to fetch.
|
290
|
+
# @return [WebhookInstance] WebhookInstance
|
291
|
+
def initialize(version, payload, assistant_sid: nil, sid: nil)
|
292
|
+
super(version)
|
293
|
+
|
294
|
+
# Marshaled Properties
|
295
|
+
@properties = {
|
296
|
+
'url' => payload['url'],
|
297
|
+
'account_sid' => payload['account_sid'],
|
298
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
299
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
300
|
+
'assistant_sid' => payload['assistant_sid'],
|
301
|
+
'sid' => payload['sid'],
|
302
|
+
'unique_name' => payload['unique_name'],
|
303
|
+
'events' => payload['events'],
|
304
|
+
'webhook_url' => payload['webhook_url'],
|
305
|
+
'webhook_method' => payload['webhook_method'],
|
306
|
+
}
|
307
|
+
|
308
|
+
# Context
|
309
|
+
@instance_context = nil
|
310
|
+
@params = {'assistant_sid' => assistant_sid, 'sid' => sid || @properties['sid'], }
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# Generate an instance context for the instance, the context is capable of
|
315
|
+
# performing various actions. All instance actions are proxied to the context
|
316
|
+
# @return [WebhookContext] WebhookContext for this WebhookInstance
|
317
|
+
def context
|
318
|
+
unless @instance_context
|
319
|
+
@instance_context = WebhookContext.new(@version, @params['assistant_sid'], @params['sid'], )
|
320
|
+
end
|
321
|
+
@instance_context
|
322
|
+
end
|
323
|
+
|
324
|
+
##
|
325
|
+
# @return [String] The absolute URL of the Webhook resource
|
326
|
+
def url
|
327
|
+
@properties['url']
|
328
|
+
end
|
329
|
+
|
330
|
+
##
|
331
|
+
# @return [String] The SID of the Account that created the resource
|
332
|
+
def account_sid
|
333
|
+
@properties['account_sid']
|
334
|
+
end
|
335
|
+
|
336
|
+
##
|
337
|
+
# @return [Time] The RFC 2822 date and time in GMT when the resource was created
|
338
|
+
def date_created
|
339
|
+
@properties['date_created']
|
340
|
+
end
|
341
|
+
|
342
|
+
##
|
343
|
+
# @return [Time] The RFC 2822 date and time in GMT when the resource was last updated
|
344
|
+
def date_updated
|
345
|
+
@properties['date_updated']
|
346
|
+
end
|
347
|
+
|
348
|
+
##
|
349
|
+
# @return [String] The SID of the Assistant that is the parent of the resource
|
350
|
+
def assistant_sid
|
351
|
+
@properties['assistant_sid']
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# @return [String] The unique string that identifies the resource
|
356
|
+
def sid
|
357
|
+
@properties['sid']
|
358
|
+
end
|
359
|
+
|
360
|
+
##
|
361
|
+
# @return [String] An application-defined string that uniquely identifies the resource
|
362
|
+
def unique_name
|
363
|
+
@properties['unique_name']
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# @return [String] The list of space-separated events that this Webhook is subscribed to.
|
368
|
+
def events
|
369
|
+
@properties['events']
|
370
|
+
end
|
371
|
+
|
372
|
+
##
|
373
|
+
# @return [String] The URL associated with this Webhook.
|
374
|
+
def webhook_url
|
375
|
+
@properties['webhook_url']
|
376
|
+
end
|
377
|
+
|
378
|
+
##
|
379
|
+
# @return [String] The method used when calling the webhook's URL.
|
380
|
+
def webhook_method
|
381
|
+
@properties['webhook_method']
|
382
|
+
end
|
383
|
+
|
384
|
+
##
|
385
|
+
# Fetch a WebhookInstance
|
386
|
+
# @return [WebhookInstance] Fetched WebhookInstance
|
387
|
+
def fetch
|
388
|
+
context.fetch
|
389
|
+
end
|
390
|
+
|
391
|
+
##
|
392
|
+
# Update the WebhookInstance
|
393
|
+
# @param [String] unique_name An application-defined string that uniquely
|
394
|
+
# identifies the new resource. It can be used as an alternative to the `sid` in
|
395
|
+
# the URL path to address the resource. This value must be unique and 64
|
396
|
+
# characters or less in length.
|
397
|
+
# @param [String] events The list of space-separated events that this Webhook will
|
398
|
+
# subscribe to.
|
399
|
+
# @param [String] webhook_url The URL associated with this Webhook.
|
400
|
+
# @param [String] webhook_method The method to be used when calling the webhook's
|
401
|
+
# URL.
|
402
|
+
# @return [WebhookInstance] Updated WebhookInstance
|
403
|
+
def update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset)
|
404
|
+
context.update(
|
405
|
+
unique_name: unique_name,
|
406
|
+
events: events,
|
407
|
+
webhook_url: webhook_url,
|
408
|
+
webhook_method: webhook_method,
|
409
|
+
)
|
410
|
+
end
|
411
|
+
|
412
|
+
##
|
413
|
+
# Deletes the WebhookInstance
|
414
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
415
|
+
def delete
|
416
|
+
context.delete
|
417
|
+
end
|
418
|
+
|
419
|
+
##
|
420
|
+
# Provide a user friendly representation
|
421
|
+
def to_s
|
422
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
423
|
+
"<Twilio.Autopilot.V1.WebhookInstance #{values}>"
|
424
|
+
end
|
425
|
+
|
426
|
+
##
|
427
|
+
# Provide a detailed, user friendly representation
|
428
|
+
def inspect
|
429
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
430
|
+
"<Twilio.Autopilot.V1.WebhookInstance #{values}>"
|
431
|
+
end
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|