twilio-ruby 5.12.0 → 5.12.1
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 +4 -4
- data/CHANGES.md +9 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +3 -2
- data/lib/twilio-ruby/rest/preview.rb +0 -15
- data/lib/twilio-ruby/rest/studio/v1/flow.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step.rb +0 -8
- data/lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb +0 -8
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/twiml/voice_response_spec.rb +17 -0
- metadata +3 -13
- data/lib/twilio-ruby/rest/preview/studio.rb +0 -43
- data/lib/twilio-ruby/rest/preview/studio/flow.rb +0 -355
- data/lib/twilio-ruby/rest/preview/studio/flow/engagement.rb +0 -372
- data/lib/twilio-ruby/rest/preview/studio/flow/engagement/step.rb +0 -350
- data/spec/integration/preview/studio/flow/engagement/step_spec.rb +0 -98
- data/spec/integration/preview/studio/flow/engagement_spec.rb +0 -145
- data/spec/integration/preview/studio/flow_spec.rb +0 -117
@@ -1,43 +0,0 @@
|
|
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 Preview
|
12
|
-
class Studio < Version
|
13
|
-
##
|
14
|
-
# Initialize the Studio version of Preview
|
15
|
-
def initialize(domain)
|
16
|
-
super
|
17
|
-
@version = 'Studio'
|
18
|
-
@flows = nil
|
19
|
-
end
|
20
|
-
|
21
|
-
##
|
22
|
-
# @param [String] sid The sid
|
23
|
-
# @return [Twilio::REST::Preview::Studio::FlowContext] if sid was passed.
|
24
|
-
# @return [Twilio::REST::Preview::Studio::FlowList]
|
25
|
-
def flows(sid=:unset)
|
26
|
-
if sid.nil?
|
27
|
-
raise ArgumentError, 'sid cannot be nil'
|
28
|
-
elsif sid == :unset
|
29
|
-
@flows ||= FlowList.new self
|
30
|
-
else
|
31
|
-
FlowContext.new(self, sid)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
##
|
36
|
-
# Provide a user friendly representation
|
37
|
-
def to_s
|
38
|
-
'<Twilio::REST::Preview::Studio>'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,355 +0,0 @@
|
|
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 Preview < Domain
|
12
|
-
class Studio < Version
|
13
|
-
##
|
14
|
-
# 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.
|
15
|
-
class FlowList < ListResource
|
16
|
-
##
|
17
|
-
# Initialize the FlowList
|
18
|
-
# @param [Version] version Version that contains the resource
|
19
|
-
# @return [FlowList] FlowList
|
20
|
-
def initialize(version)
|
21
|
-
super(version)
|
22
|
-
|
23
|
-
# Path Solution
|
24
|
-
@solution = {}
|
25
|
-
@uri = "/Flows"
|
26
|
-
end
|
27
|
-
|
28
|
-
##
|
29
|
-
# Lists FlowInstance records from the API as a list.
|
30
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
31
|
-
# memory before returning.
|
32
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
33
|
-
# guarantees to never return more than limit. Default is no limit
|
34
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
35
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
36
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
37
|
-
# efficient page size, i.e. min(limit, 1000)
|
38
|
-
# @return [Array] Array of up to limit results
|
39
|
-
def list(limit: nil, page_size: nil)
|
40
|
-
self.stream(limit: limit, page_size: page_size).entries
|
41
|
-
end
|
42
|
-
|
43
|
-
##
|
44
|
-
# Streams FlowInstance records from the API as an Enumerable.
|
45
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
46
|
-
# is reached.
|
47
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
48
|
-
# guarantees to never return more than limit. Default is no limit.
|
49
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
50
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
51
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
52
|
-
# efficient page size, i.e. min(limit, 1000)
|
53
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
54
|
-
def stream(limit: nil, page_size: nil)
|
55
|
-
limits = @version.read_limits(limit, page_size)
|
56
|
-
|
57
|
-
page = self.page(page_size: limits[:page_size], )
|
58
|
-
|
59
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
60
|
-
end
|
61
|
-
|
62
|
-
##
|
63
|
-
# When passed a block, yields FlowInstance records from the API.
|
64
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
65
|
-
# is reached.
|
66
|
-
def each
|
67
|
-
limits = @version.read_limits
|
68
|
-
|
69
|
-
page = self.page(page_size: limits[:page_size], )
|
70
|
-
|
71
|
-
@version.stream(page,
|
72
|
-
limit: limits[:limit],
|
73
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
74
|
-
end
|
75
|
-
|
76
|
-
##
|
77
|
-
# Retrieve a single page of FlowInstance records from the API.
|
78
|
-
# Request is executed immediately.
|
79
|
-
# @param [String] page_token PageToken provided by the API
|
80
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
81
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
82
|
-
# @return [Page] Page of FlowInstance
|
83
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
84
|
-
params = Twilio::Values.of({
|
85
|
-
'PageToken' => page_token,
|
86
|
-
'Page' => page_number,
|
87
|
-
'PageSize' => page_size,
|
88
|
-
})
|
89
|
-
response = @version.page(
|
90
|
-
'GET',
|
91
|
-
@uri,
|
92
|
-
params
|
93
|
-
)
|
94
|
-
FlowPage.new(@version, response, @solution)
|
95
|
-
end
|
96
|
-
|
97
|
-
##
|
98
|
-
# Retrieve a single page of FlowInstance records from the API.
|
99
|
-
# Request is executed immediately.
|
100
|
-
# @param [String] target_url API-generated URL for the requested results page
|
101
|
-
# @return [Page] Page of FlowInstance
|
102
|
-
def get_page(target_url)
|
103
|
-
response = @version.domain.request(
|
104
|
-
'GET',
|
105
|
-
target_url
|
106
|
-
)
|
107
|
-
FlowPage.new(@version, response, @solution)
|
108
|
-
end
|
109
|
-
|
110
|
-
##
|
111
|
-
# Provide a user friendly representation
|
112
|
-
def to_s
|
113
|
-
'#<Twilio.Preview.Studio.FlowList>'
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
##
|
118
|
-
# 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.
|
119
|
-
class FlowPage < Page
|
120
|
-
##
|
121
|
-
# Initialize the FlowPage
|
122
|
-
# @param [Version] version Version that contains the resource
|
123
|
-
# @param [Response] response Response from the API
|
124
|
-
# @param [Hash] solution Path solution for the resource
|
125
|
-
# @return [FlowPage] FlowPage
|
126
|
-
def initialize(version, response, solution)
|
127
|
-
super(version, response)
|
128
|
-
|
129
|
-
# Path Solution
|
130
|
-
@solution = solution
|
131
|
-
end
|
132
|
-
|
133
|
-
##
|
134
|
-
# Build an instance of FlowInstance
|
135
|
-
# @param [Hash] payload Payload response from the API
|
136
|
-
# @return [FlowInstance] FlowInstance
|
137
|
-
def get_instance(payload)
|
138
|
-
FlowInstance.new(@version, payload, )
|
139
|
-
end
|
140
|
-
|
141
|
-
##
|
142
|
-
# Provide a user friendly representation
|
143
|
-
def to_s
|
144
|
-
'<Twilio.Preview.Studio.FlowPage>'
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
##
|
149
|
-
# 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.
|
150
|
-
class FlowContext < InstanceContext
|
151
|
-
##
|
152
|
-
# Initialize the FlowContext
|
153
|
-
# @param [Version] version Version that contains the resource
|
154
|
-
# @param [String] sid The sid
|
155
|
-
# @return [FlowContext] FlowContext
|
156
|
-
def initialize(version, sid)
|
157
|
-
super(version)
|
158
|
-
|
159
|
-
# Path Solution
|
160
|
-
@solution = {sid: sid, }
|
161
|
-
@uri = "/Flows/#{@solution[:sid]}"
|
162
|
-
|
163
|
-
# Dependents
|
164
|
-
@engagements = nil
|
165
|
-
end
|
166
|
-
|
167
|
-
##
|
168
|
-
# Fetch a FlowInstance
|
169
|
-
# @return [FlowInstance] Fetched FlowInstance
|
170
|
-
def fetch
|
171
|
-
params = Twilio::Values.of({})
|
172
|
-
|
173
|
-
payload = @version.fetch(
|
174
|
-
'GET',
|
175
|
-
@uri,
|
176
|
-
params,
|
177
|
-
)
|
178
|
-
|
179
|
-
FlowInstance.new(@version, payload, sid: @solution[:sid], )
|
180
|
-
end
|
181
|
-
|
182
|
-
##
|
183
|
-
# Deletes the FlowInstance
|
184
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
185
|
-
def delete
|
186
|
-
@version.delete('delete', @uri)
|
187
|
-
end
|
188
|
-
|
189
|
-
##
|
190
|
-
# Access the engagements
|
191
|
-
# @return [EngagementList]
|
192
|
-
# @return [EngagementContext] if sid was passed.
|
193
|
-
def engagements(sid=:unset)
|
194
|
-
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
195
|
-
|
196
|
-
if sid != :unset
|
197
|
-
return EngagementContext.new(@version, @solution[:sid], sid, )
|
198
|
-
end
|
199
|
-
|
200
|
-
unless @engagements
|
201
|
-
@engagements = EngagementList.new(@version, flow_sid: @solution[:sid], )
|
202
|
-
end
|
203
|
-
|
204
|
-
@engagements
|
205
|
-
end
|
206
|
-
|
207
|
-
##
|
208
|
-
# Provide a user friendly representation
|
209
|
-
def to_s
|
210
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
211
|
-
"#<Twilio.Preview.Studio.FlowContext #{context}>"
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
##
|
216
|
-
# 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.
|
217
|
-
class FlowInstance < InstanceResource
|
218
|
-
##
|
219
|
-
# Initialize the FlowInstance
|
220
|
-
# @param [Version] version Version that contains the resource
|
221
|
-
# @param [Hash] payload payload that contains response from Twilio
|
222
|
-
# @param [String] sid The sid
|
223
|
-
# @return [FlowInstance] FlowInstance
|
224
|
-
def initialize(version, payload, sid: nil)
|
225
|
-
super(version)
|
226
|
-
|
227
|
-
# Marshaled Properties
|
228
|
-
@properties = {
|
229
|
-
'sid' => payload['sid'],
|
230
|
-
'account_sid' => payload['account_sid'],
|
231
|
-
'friendly_name' => payload['friendly_name'],
|
232
|
-
'status' => payload['status'],
|
233
|
-
'debug' => payload['debug'],
|
234
|
-
'version' => payload['version'].to_i,
|
235
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
236
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
237
|
-
'url' => payload['url'],
|
238
|
-
'links' => payload['links'],
|
239
|
-
}
|
240
|
-
|
241
|
-
# Context
|
242
|
-
@instance_context = nil
|
243
|
-
@params = {'sid' => sid || @properties['sid'], }
|
244
|
-
end
|
245
|
-
|
246
|
-
##
|
247
|
-
# Generate an instance context for the instance, the context is capable of
|
248
|
-
# performing various actions. All instance actions are proxied to the context
|
249
|
-
# @return [FlowContext] FlowContext for this FlowInstance
|
250
|
-
def context
|
251
|
-
unless @instance_context
|
252
|
-
@instance_context = FlowContext.new(@version, @params['sid'], )
|
253
|
-
end
|
254
|
-
@instance_context
|
255
|
-
end
|
256
|
-
|
257
|
-
##
|
258
|
-
# @return [String] A string that uniquely identifies this Flow.
|
259
|
-
def sid
|
260
|
-
@properties['sid']
|
261
|
-
end
|
262
|
-
|
263
|
-
##
|
264
|
-
# @return [String] Account Sid.
|
265
|
-
def account_sid
|
266
|
-
@properties['account_sid']
|
267
|
-
end
|
268
|
-
|
269
|
-
##
|
270
|
-
# @return [String] A human readable description of this resource.
|
271
|
-
def friendly_name
|
272
|
-
@properties['friendly_name']
|
273
|
-
end
|
274
|
-
|
275
|
-
##
|
276
|
-
# @return [flow.Status] The Status of this Flow
|
277
|
-
def status
|
278
|
-
@properties['status']
|
279
|
-
end
|
280
|
-
|
281
|
-
##
|
282
|
-
# @return [Boolean] Toggle extra logging.
|
283
|
-
def debug
|
284
|
-
@properties['debug']
|
285
|
-
end
|
286
|
-
|
287
|
-
##
|
288
|
-
# @return [String] The latest version number of this Flow's definition.
|
289
|
-
def version
|
290
|
-
@properties['version']
|
291
|
-
end
|
292
|
-
|
293
|
-
##
|
294
|
-
# @return [Time] The date this Flow was created
|
295
|
-
def date_created
|
296
|
-
@properties['date_created']
|
297
|
-
end
|
298
|
-
|
299
|
-
##
|
300
|
-
# @return [Time] The date this Flow was updated
|
301
|
-
def date_updated
|
302
|
-
@properties['date_updated']
|
303
|
-
end
|
304
|
-
|
305
|
-
##
|
306
|
-
# @return [String] The URL of this resource.
|
307
|
-
def url
|
308
|
-
@properties['url']
|
309
|
-
end
|
310
|
-
|
311
|
-
##
|
312
|
-
# @return [String] Nested resource URLs.
|
313
|
-
def links
|
314
|
-
@properties['links']
|
315
|
-
end
|
316
|
-
|
317
|
-
##
|
318
|
-
# Fetch a FlowInstance
|
319
|
-
# @return [FlowInstance] Fetched FlowInstance
|
320
|
-
def fetch
|
321
|
-
context.fetch
|
322
|
-
end
|
323
|
-
|
324
|
-
##
|
325
|
-
# Deletes the FlowInstance
|
326
|
-
# @return [Boolean] true if delete succeeds, true otherwise
|
327
|
-
def delete
|
328
|
-
context.delete
|
329
|
-
end
|
330
|
-
|
331
|
-
##
|
332
|
-
# Access the engagements
|
333
|
-
# @return [engagements] engagements
|
334
|
-
def engagements
|
335
|
-
context.engagements
|
336
|
-
end
|
337
|
-
|
338
|
-
##
|
339
|
-
# Provide a user friendly representation
|
340
|
-
def to_s
|
341
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
342
|
-
"<Twilio.Preview.Studio.FlowInstance #{values}>"
|
343
|
-
end
|
344
|
-
|
345
|
-
##
|
346
|
-
# Provide a detailed, user friendly representation
|
347
|
-
def inspect
|
348
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
349
|
-
"<Twilio.Preview.Studio.FlowInstance #{values}>"
|
350
|
-
end
|
351
|
-
end
|
352
|
-
end
|
353
|
-
end
|
354
|
-
end
|
355
|
-
end
|
@@ -1,372 +0,0 @@
|
|
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 Preview < Domain
|
12
|
-
class Studio < Version
|
13
|
-
class FlowContext < 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 EngagementList < ListResource
|
17
|
-
##
|
18
|
-
# Initialize the EngagementList
|
19
|
-
# @param [Version] version Version that contains the resource
|
20
|
-
# @param [String] flow_sid The unique SID identifier of the Flow.
|
21
|
-
# @return [EngagementList] EngagementList
|
22
|
-
def initialize(version, flow_sid: nil)
|
23
|
-
super(version)
|
24
|
-
|
25
|
-
# Path Solution
|
26
|
-
@solution = {flow_sid: flow_sid}
|
27
|
-
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements"
|
28
|
-
end
|
29
|
-
|
30
|
-
##
|
31
|
-
# Lists EngagementInstance records from the API as a list.
|
32
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
|
-
# memory before returning.
|
34
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
35
|
-
# guarantees to never return more than limit. Default is no limit
|
36
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
37
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
38
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
39
|
-
# efficient page size, i.e. min(limit, 1000)
|
40
|
-
# @return [Array] Array of up to limit results
|
41
|
-
def list(limit: nil, page_size: nil)
|
42
|
-
self.stream(limit: limit, page_size: page_size).entries
|
43
|
-
end
|
44
|
-
|
45
|
-
##
|
46
|
-
# Streams EngagementInstance records from the API as an Enumerable.
|
47
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
48
|
-
# is reached.
|
49
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
50
|
-
# guarantees to never return more than limit. Default is no limit.
|
51
|
-
# @param [Integer] page_size Number of records to fetch per request, when
|
52
|
-
# not set will use the default value of 50 records. If no page_size is defined
|
53
|
-
# but a limit is defined, stream() will attempt to read the limit with the most
|
54
|
-
# efficient page size, i.e. min(limit, 1000)
|
55
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
56
|
-
def stream(limit: nil, page_size: nil)
|
57
|
-
limits = @version.read_limits(limit, page_size)
|
58
|
-
|
59
|
-
page = self.page(page_size: limits[:page_size], )
|
60
|
-
|
61
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
62
|
-
end
|
63
|
-
|
64
|
-
##
|
65
|
-
# When passed a block, yields EngagementInstance records from the API.
|
66
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
67
|
-
# is reached.
|
68
|
-
def each
|
69
|
-
limits = @version.read_limits
|
70
|
-
|
71
|
-
page = self.page(page_size: limits[:page_size], )
|
72
|
-
|
73
|
-
@version.stream(page,
|
74
|
-
limit: limits[:limit],
|
75
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
76
|
-
end
|
77
|
-
|
78
|
-
##
|
79
|
-
# Retrieve a single page of EngagementInstance records from the API.
|
80
|
-
# Request is executed immediately.
|
81
|
-
# @param [String] page_token PageToken provided by the API
|
82
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
83
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
84
|
-
# @return [Page] Page of EngagementInstance
|
85
|
-
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
86
|
-
params = Twilio::Values.of({
|
87
|
-
'PageToken' => page_token,
|
88
|
-
'Page' => page_number,
|
89
|
-
'PageSize' => page_size,
|
90
|
-
})
|
91
|
-
response = @version.page(
|
92
|
-
'GET',
|
93
|
-
@uri,
|
94
|
-
params
|
95
|
-
)
|
96
|
-
EngagementPage.new(@version, response, @solution)
|
97
|
-
end
|
98
|
-
|
99
|
-
##
|
100
|
-
# Retrieve a single page of EngagementInstance records from the API.
|
101
|
-
# Request is executed immediately.
|
102
|
-
# @param [String] target_url API-generated URL for the requested results page
|
103
|
-
# @return [Page] Page of EngagementInstance
|
104
|
-
def get_page(target_url)
|
105
|
-
response = @version.domain.request(
|
106
|
-
'GET',
|
107
|
-
target_url
|
108
|
-
)
|
109
|
-
EngagementPage.new(@version, response, @solution)
|
110
|
-
end
|
111
|
-
|
112
|
-
##
|
113
|
-
# Retrieve a single page of EngagementInstance records from the API.
|
114
|
-
# Request is executed immediately.
|
115
|
-
# @param [String] to The to
|
116
|
-
# @param [String] from The from
|
117
|
-
# @param [String] parameters The parameters
|
118
|
-
# @return [EngagementInstance] Newly created EngagementInstance
|
119
|
-
def create(to: nil, from: nil, parameters: :unset)
|
120
|
-
data = Twilio::Values.of({'To' => to, 'From' => from, 'Parameters' => parameters, })
|
121
|
-
|
122
|
-
payload = @version.create(
|
123
|
-
'POST',
|
124
|
-
@uri,
|
125
|
-
data: data
|
126
|
-
)
|
127
|
-
|
128
|
-
EngagementInstance.new(@version, payload, flow_sid: @solution[:flow_sid], )
|
129
|
-
end
|
130
|
-
|
131
|
-
##
|
132
|
-
# Provide a user friendly representation
|
133
|
-
def to_s
|
134
|
-
'#<Twilio.Preview.Studio.EngagementList>'
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
##
|
139
|
-
# 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.
|
140
|
-
class EngagementPage < Page
|
141
|
-
##
|
142
|
-
# Initialize the EngagementPage
|
143
|
-
# @param [Version] version Version that contains the resource
|
144
|
-
# @param [Response] response Response from the API
|
145
|
-
# @param [Hash] solution Path solution for the resource
|
146
|
-
# @return [EngagementPage] EngagementPage
|
147
|
-
def initialize(version, response, solution)
|
148
|
-
super(version, response)
|
149
|
-
|
150
|
-
# Path Solution
|
151
|
-
@solution = solution
|
152
|
-
end
|
153
|
-
|
154
|
-
##
|
155
|
-
# Build an instance of EngagementInstance
|
156
|
-
# @param [Hash] payload Payload response from the API
|
157
|
-
# @return [EngagementInstance] EngagementInstance
|
158
|
-
def get_instance(payload)
|
159
|
-
EngagementInstance.new(@version, payload, flow_sid: @solution[:flow_sid], )
|
160
|
-
end
|
161
|
-
|
162
|
-
##
|
163
|
-
# Provide a user friendly representation
|
164
|
-
def to_s
|
165
|
-
'<Twilio.Preview.Studio.EngagementPage>'
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
##
|
170
|
-
# 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.
|
171
|
-
class EngagementContext < InstanceContext
|
172
|
-
##
|
173
|
-
# Initialize the EngagementContext
|
174
|
-
# @param [Version] version Version that contains the resource
|
175
|
-
# @param [String] flow_sid The flow_sid
|
176
|
-
# @param [String] sid The sid
|
177
|
-
# @return [EngagementContext] EngagementContext
|
178
|
-
def initialize(version, flow_sid, sid)
|
179
|
-
super(version)
|
180
|
-
|
181
|
-
# Path Solution
|
182
|
-
@solution = {flow_sid: flow_sid, sid: sid, }
|
183
|
-
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:sid]}"
|
184
|
-
|
185
|
-
# Dependents
|
186
|
-
@steps = nil
|
187
|
-
end
|
188
|
-
|
189
|
-
##
|
190
|
-
# Fetch a EngagementInstance
|
191
|
-
# @return [EngagementInstance] Fetched EngagementInstance
|
192
|
-
def fetch
|
193
|
-
params = Twilio::Values.of({})
|
194
|
-
|
195
|
-
payload = @version.fetch(
|
196
|
-
'GET',
|
197
|
-
@uri,
|
198
|
-
params,
|
199
|
-
)
|
200
|
-
|
201
|
-
EngagementInstance.new(@version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], )
|
202
|
-
end
|
203
|
-
|
204
|
-
##
|
205
|
-
# Access the steps
|
206
|
-
# @return [StepList]
|
207
|
-
# @return [StepContext] if sid was passed.
|
208
|
-
def steps(sid=:unset)
|
209
|
-
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
210
|
-
|
211
|
-
if sid != :unset
|
212
|
-
return StepContext.new(@version, @solution[:flow_sid], @solution[:sid], sid, )
|
213
|
-
end
|
214
|
-
|
215
|
-
unless @steps
|
216
|
-
@steps = StepList.new(@version, flow_sid: @solution[:flow_sid], engagement_sid: @solution[:sid], )
|
217
|
-
end
|
218
|
-
|
219
|
-
@steps
|
220
|
-
end
|
221
|
-
|
222
|
-
##
|
223
|
-
# Provide a user friendly representation
|
224
|
-
def to_s
|
225
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
226
|
-
"#<Twilio.Preview.Studio.EngagementContext #{context}>"
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
##
|
231
|
-
# 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.
|
232
|
-
class EngagementInstance < InstanceResource
|
233
|
-
##
|
234
|
-
# Initialize the EngagementInstance
|
235
|
-
# @param [Version] version Version that contains the resource
|
236
|
-
# @param [Hash] payload payload that contains response from Twilio
|
237
|
-
# @param [String] flow_sid The unique SID identifier of the Flow.
|
238
|
-
# @param [String] sid The sid
|
239
|
-
# @return [EngagementInstance] EngagementInstance
|
240
|
-
def initialize(version, payload, flow_sid: nil, sid: nil)
|
241
|
-
super(version)
|
242
|
-
|
243
|
-
# Marshaled Properties
|
244
|
-
@properties = {
|
245
|
-
'sid' => payload['sid'],
|
246
|
-
'account_sid' => payload['account_sid'],
|
247
|
-
'flow_sid' => payload['flow_sid'],
|
248
|
-
'contact_sid' => payload['contact_sid'],
|
249
|
-
'contact_channel_address' => payload['contact_channel_address'],
|
250
|
-
'status' => payload['status'],
|
251
|
-
'context' => payload['context'],
|
252
|
-
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
253
|
-
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
254
|
-
'url' => payload['url'],
|
255
|
-
'links' => payload['links'],
|
256
|
-
}
|
257
|
-
|
258
|
-
# Context
|
259
|
-
@instance_context = nil
|
260
|
-
@params = {'flow_sid' => flow_sid, 'sid' => sid || @properties['sid'], }
|
261
|
-
end
|
262
|
-
|
263
|
-
##
|
264
|
-
# Generate an instance context for the instance, the context is capable of
|
265
|
-
# performing various actions. All instance actions are proxied to the context
|
266
|
-
# @return [EngagementContext] EngagementContext for this EngagementInstance
|
267
|
-
def context
|
268
|
-
unless @instance_context
|
269
|
-
@instance_context = EngagementContext.new(@version, @params['flow_sid'], @params['sid'], )
|
270
|
-
end
|
271
|
-
@instance_context
|
272
|
-
end
|
273
|
-
|
274
|
-
##
|
275
|
-
# @return [String] A string that uniquely identifies this Engagement.
|
276
|
-
def sid
|
277
|
-
@properties['sid']
|
278
|
-
end
|
279
|
-
|
280
|
-
##
|
281
|
-
# @return [String] Account Sid.
|
282
|
-
def account_sid
|
283
|
-
@properties['account_sid']
|
284
|
-
end
|
285
|
-
|
286
|
-
##
|
287
|
-
# @return [String] Flow Sid.
|
288
|
-
def flow_sid
|
289
|
-
@properties['flow_sid']
|
290
|
-
end
|
291
|
-
|
292
|
-
##
|
293
|
-
# @return [String] Contact Sid.
|
294
|
-
def contact_sid
|
295
|
-
@properties['contact_sid']
|
296
|
-
end
|
297
|
-
|
298
|
-
##
|
299
|
-
# @return [String] The phone number, SIP address or Client identifier that triggered this Engagement.
|
300
|
-
def contact_channel_address
|
301
|
-
@properties['contact_channel_address']
|
302
|
-
end
|
303
|
-
|
304
|
-
##
|
305
|
-
# @return [engagement.Status] The Status of this Engagement
|
306
|
-
def status
|
307
|
-
@properties['status']
|
308
|
-
end
|
309
|
-
|
310
|
-
##
|
311
|
-
# @return [Hash] Nested resource URLs.
|
312
|
-
def context
|
313
|
-
@properties['context']
|
314
|
-
end
|
315
|
-
|
316
|
-
##
|
317
|
-
# @return [Time] The date this Engagement was created
|
318
|
-
def date_created
|
319
|
-
@properties['date_created']
|
320
|
-
end
|
321
|
-
|
322
|
-
##
|
323
|
-
# @return [Time] The date this Engagement was updated
|
324
|
-
def date_updated
|
325
|
-
@properties['date_updated']
|
326
|
-
end
|
327
|
-
|
328
|
-
##
|
329
|
-
# @return [String] The URL of this resource.
|
330
|
-
def url
|
331
|
-
@properties['url']
|
332
|
-
end
|
333
|
-
|
334
|
-
##
|
335
|
-
# @return [String] Nested resource URLs.
|
336
|
-
def links
|
337
|
-
@properties['links']
|
338
|
-
end
|
339
|
-
|
340
|
-
##
|
341
|
-
# Fetch a EngagementInstance
|
342
|
-
# @return [EngagementInstance] Fetched EngagementInstance
|
343
|
-
def fetch
|
344
|
-
context.fetch
|
345
|
-
end
|
346
|
-
|
347
|
-
##
|
348
|
-
# Access the steps
|
349
|
-
# @return [steps] steps
|
350
|
-
def steps
|
351
|
-
context.steps
|
352
|
-
end
|
353
|
-
|
354
|
-
##
|
355
|
-
# Provide a user friendly representation
|
356
|
-
def to_s
|
357
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
358
|
-
"<Twilio.Preview.Studio.EngagementInstance #{values}>"
|
359
|
-
end
|
360
|
-
|
361
|
-
##
|
362
|
-
# Provide a detailed, user friendly representation
|
363
|
-
def inspect
|
364
|
-
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
365
|
-
"<Twilio.Preview.Studio.EngagementInstance #{values}>"
|
366
|
-
end
|
367
|
-
end
|
368
|
-
end
|
369
|
-
end
|
370
|
-
end
|
371
|
-
end
|
372
|
-
end
|