twilio-ruby 5.6.4 → 5.7.0
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/.rubocop.yml +3 -0
- data/CHANGES.md +9 -0
- data/Gemfile +1 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/jwt/client_capability.rb +1 -1
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement.rb +16 -7
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb +215 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb +25 -7
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb +230 -0
- data/lib/twilio-ruby/twiml/twiml.rb +7 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/studio/v1/flow/engagement/engagement_context_spec.rb +49 -0
- data/spec/integration/studio/v1/flow/engagement/step/step_context_spec.rb +52 -0
- data/spec/integration/studio/v1/flow/engagement/step_spec.rb +4 -2
- data/spec/integration/studio/v1/flow/engagement_spec.rb +4 -8
- data/spec/spec_helper.rb +6 -0
- data/spec/twiml/messaging_response_spec.rb +137 -46
- data/spec/twiml/voice_response_spec.rb +554 -257
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df9978edce096bf5092e3d6ac5a54c02d063795f
|
|
4
|
+
data.tar.gz: beb0f63c4bb36035ea5e78dcb32c258d388fb49e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b31f0cedb31d01c8bea49036beff344fb865f90479ac21300a36415d1e691b7c3130dbf428d2914664560ff02432993a16567989f84c936ed7f8c513b755a4e
|
|
7
|
+
data.tar.gz: e6ae47e713762e25cf73505817d6a81e0177242df3fe5e3b365639871deb03e03bf978729b2dcd9970d92e2e194e60edf064827c1eed4a39eec47b5c21293a1b
|
data/.rubocop.yml
CHANGED
data/CHANGES.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
twilio-ruby changelog
|
|
2
2
|
=====================
|
|
3
3
|
|
|
4
|
+
[2018-03-02] Version 5.7.0
|
|
5
|
+
---------------------------
|
|
6
|
+
**TwiML**
|
|
7
|
+
- Allow newlines in TwiML content. Better XML configuration in general.
|
|
8
|
+
|
|
9
|
+
**Studio**
|
|
10
|
+
- Add new /Context endpoint for step and engagement resources. Removes the context property from existing step and engagement resources. *(breaking change)*
|
|
11
|
+
|
|
12
|
+
|
|
4
13
|
[2018-02-23] Version 5.6.4
|
|
5
14
|
---------------------------
|
|
6
15
|
**Library**
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -27,13 +27,13 @@ in-line code documentation here in the library.
|
|
|
27
27
|
To install using [Bundler][bundler] grab the latest stable version:
|
|
28
28
|
|
|
29
29
|
```ruby
|
|
30
|
-
gem 'twilio-ruby', '~> 5.
|
|
30
|
+
gem 'twilio-ruby', '~> 5.7.0'
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
gem install twilio-ruby -v 5.
|
|
36
|
+
gem install twilio-ruby -v 5.7.0
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
To build and install the development branch yourself from the latest source:
|
|
@@ -68,7 +68,7 @@ module Twilio
|
|
|
68
68
|
client_name = "clientName=#{CGI.escape(@client_name)}"
|
|
69
69
|
end
|
|
70
70
|
unless @params.empty?
|
|
71
|
-
params = 'appParams=' + @params.map { |k, v| CGI.escape("#{k}=#{v}") }.join('
|
|
71
|
+
params = 'appParams=' + @params.map { |k, v| CGI.escape("#{k}=#{v}") }.join(CGI.escape('&'))
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
suffix = [application_sid, client_name, params].compact.join('&')
|
|
@@ -182,6 +182,7 @@ module Twilio
|
|
|
182
182
|
|
|
183
183
|
# Dependents
|
|
184
184
|
@steps = nil
|
|
185
|
+
@engagement_context = nil
|
|
185
186
|
end
|
|
186
187
|
|
|
187
188
|
##
|
|
@@ -217,6 +218,14 @@ module Twilio
|
|
|
217
218
|
@steps
|
|
218
219
|
end
|
|
219
220
|
|
|
221
|
+
##
|
|
222
|
+
# Access the engagement_context
|
|
223
|
+
# @return [EngagementContextList]
|
|
224
|
+
# @return [EngagementContextContext]
|
|
225
|
+
def engagement_context
|
|
226
|
+
EngagementContextContext.new(@version, @solution[:flow_sid], @solution[:sid], )
|
|
227
|
+
end
|
|
228
|
+
|
|
220
229
|
##
|
|
221
230
|
# Provide a user friendly representation
|
|
222
231
|
def to_s
|
|
@@ -246,7 +255,6 @@ module Twilio
|
|
|
246
255
|
'contact_sid' => payload['contact_sid'],
|
|
247
256
|
'contact_channel_address' => payload['contact_channel_address'],
|
|
248
257
|
'status' => payload['status'],
|
|
249
|
-
'context' => payload['context'],
|
|
250
258
|
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
251
259
|
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
252
260
|
'url' => payload['url'],
|
|
@@ -305,12 +313,6 @@ module Twilio
|
|
|
305
313
|
@properties['status']
|
|
306
314
|
end
|
|
307
315
|
|
|
308
|
-
##
|
|
309
|
-
# @return [Hash] The context
|
|
310
|
-
def context
|
|
311
|
-
@properties['context']
|
|
312
|
-
end
|
|
313
|
-
|
|
314
316
|
##
|
|
315
317
|
# @return [Time] The date_created
|
|
316
318
|
def date_created
|
|
@@ -349,6 +351,13 @@ module Twilio
|
|
|
349
351
|
context.steps
|
|
350
352
|
end
|
|
351
353
|
|
|
354
|
+
##
|
|
355
|
+
# Access the engagement_context
|
|
356
|
+
# @return [engagement_context] engagement_context
|
|
357
|
+
def engagement_context
|
|
358
|
+
context.engagement_context
|
|
359
|
+
end
|
|
360
|
+
|
|
352
361
|
##
|
|
353
362
|
# Provide a user friendly representation
|
|
354
363
|
def to_s
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Studio < Domain
|
|
10
|
+
class V1 < Version
|
|
11
|
+
class FlowContext < InstanceContext
|
|
12
|
+
class EngagementContext < InstanceContext
|
|
13
|
+
##
|
|
14
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
15
|
+
class EngagementContextList < ListResource
|
|
16
|
+
##
|
|
17
|
+
# Initialize the EngagementContextList
|
|
18
|
+
# @param [Version] version Version that contains the resource
|
|
19
|
+
# @param [String] flow_sid The flow_sid
|
|
20
|
+
# @param [String] engagement_sid The engagement_sid
|
|
21
|
+
# @return [EngagementContextList] EngagementContextList
|
|
22
|
+
def initialize(version, flow_sid: nil, engagement_sid: nil)
|
|
23
|
+
super(version)
|
|
24
|
+
|
|
25
|
+
# Path Solution
|
|
26
|
+
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Provide a user friendly representation
|
|
31
|
+
def to_s
|
|
32
|
+
'#<Twilio.Studio.V1.EngagementContextList>'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
38
|
+
class EngagementContextPage < Page
|
|
39
|
+
##
|
|
40
|
+
# Initialize the EngagementContextPage
|
|
41
|
+
# @param [Version] version Version that contains the resource
|
|
42
|
+
# @param [Response] response Response from the API
|
|
43
|
+
# @param [Hash] solution Path solution for the resource
|
|
44
|
+
# @return [EngagementContextPage] EngagementContextPage
|
|
45
|
+
def initialize(version, response, solution)
|
|
46
|
+
super(version, response)
|
|
47
|
+
|
|
48
|
+
# Path Solution
|
|
49
|
+
@solution = solution
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Build an instance of EngagementContextInstance
|
|
54
|
+
# @param [Hash] payload Payload response from the API
|
|
55
|
+
# @return [EngagementContextInstance] EngagementContextInstance
|
|
56
|
+
def get_instance(payload)
|
|
57
|
+
EngagementContextInstance.new(
|
|
58
|
+
@version,
|
|
59
|
+
payload,
|
|
60
|
+
flow_sid: @solution[:flow_sid],
|
|
61
|
+
engagement_sid: @solution[:engagement_sid],
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Provide a user friendly representation
|
|
67
|
+
def to_s
|
|
68
|
+
'<Twilio.Studio.V1.EngagementContextPage>'
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
##
|
|
73
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
74
|
+
class EngagementContextContext < InstanceContext
|
|
75
|
+
##
|
|
76
|
+
# Initialize the EngagementContextContext
|
|
77
|
+
# @param [Version] version Version that contains the resource
|
|
78
|
+
# @param [String] flow_sid The flow_sid
|
|
79
|
+
# @param [String] engagement_sid The engagement_sid
|
|
80
|
+
# @return [EngagementContextContext] EngagementContextContext
|
|
81
|
+
def initialize(version, flow_sid, engagement_sid)
|
|
82
|
+
super(version)
|
|
83
|
+
|
|
84
|
+
# Path Solution
|
|
85
|
+
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid, }
|
|
86
|
+
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:engagement_sid]}/Context"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
##
|
|
90
|
+
# Fetch a EngagementContextInstance
|
|
91
|
+
# @return [EngagementContextInstance] Fetched EngagementContextInstance
|
|
92
|
+
def fetch
|
|
93
|
+
params = Twilio::Values.of({})
|
|
94
|
+
|
|
95
|
+
payload = @version.fetch(
|
|
96
|
+
'GET',
|
|
97
|
+
@uri,
|
|
98
|
+
params,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
EngagementContextInstance.new(
|
|
102
|
+
@version,
|
|
103
|
+
payload,
|
|
104
|
+
flow_sid: @solution[:flow_sid],
|
|
105
|
+
engagement_sid: @solution[:engagement_sid],
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
##
|
|
110
|
+
# Provide a user friendly representation
|
|
111
|
+
def to_s
|
|
112
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
113
|
+
"#<Twilio.Studio.V1.EngagementContextContext #{context}>"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
##
|
|
118
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
119
|
+
class EngagementContextInstance < InstanceResource
|
|
120
|
+
##
|
|
121
|
+
# Initialize the EngagementContextInstance
|
|
122
|
+
# @param [Version] version Version that contains the resource
|
|
123
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
124
|
+
# @param [String] flow_sid The flow_sid
|
|
125
|
+
# @param [String] engagement_sid The engagement_sid
|
|
126
|
+
# @return [EngagementContextInstance] EngagementContextInstance
|
|
127
|
+
def initialize(version, payload, flow_sid: nil, engagement_sid: nil)
|
|
128
|
+
super(version)
|
|
129
|
+
|
|
130
|
+
# Marshaled Properties
|
|
131
|
+
@properties = {
|
|
132
|
+
'account_sid' => payload['account_sid'],
|
|
133
|
+
'context' => payload['context'],
|
|
134
|
+
'engagement_sid' => payload['engagement_sid'],
|
|
135
|
+
'flow_sid' => payload['flow_sid'],
|
|
136
|
+
'url' => payload['url'],
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Context
|
|
140
|
+
@instance_context = nil
|
|
141
|
+
@params = {'flow_sid' => flow_sid, 'engagement_sid' => engagement_sid, }
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
##
|
|
145
|
+
# Generate an instance context for the instance, the context is capable of
|
|
146
|
+
# performing various actions. All instance actions are proxied to the context
|
|
147
|
+
# @return [EngagementContextContext] EngagementContextContext for this EngagementContextInstance
|
|
148
|
+
def context
|
|
149
|
+
unless @instance_context
|
|
150
|
+
@instance_context = EngagementContextContext.new(
|
|
151
|
+
@version,
|
|
152
|
+
@params['flow_sid'],
|
|
153
|
+
@params['engagement_sid'],
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
@instance_context
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
##
|
|
160
|
+
# @return [String] The account_sid
|
|
161
|
+
def account_sid
|
|
162
|
+
@properties['account_sid']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
##
|
|
166
|
+
# @return [Hash] The context
|
|
167
|
+
def context
|
|
168
|
+
@properties['context']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
##
|
|
172
|
+
# @return [String] The engagement_sid
|
|
173
|
+
def engagement_sid
|
|
174
|
+
@properties['engagement_sid']
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
# @return [String] The flow_sid
|
|
179
|
+
def flow_sid
|
|
180
|
+
@properties['flow_sid']
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
##
|
|
184
|
+
# @return [String] The url
|
|
185
|
+
def url
|
|
186
|
+
@properties['url']
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
##
|
|
190
|
+
# Fetch a EngagementContextInstance
|
|
191
|
+
# @return [EngagementContextInstance] Fetched EngagementContextInstance
|
|
192
|
+
def fetch
|
|
193
|
+
context.fetch
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
##
|
|
197
|
+
# Provide a user friendly representation
|
|
198
|
+
def to_s
|
|
199
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
200
|
+
"<Twilio.Studio.V1.EngagementContextInstance #{values}>"
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
##
|
|
204
|
+
# Provide a detailed, user friendly representation
|
|
205
|
+
def inspect
|
|
206
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
207
|
+
"<Twilio.Studio.V1.EngagementContextInstance #{values}>"
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
@@ -168,6 +168,9 @@ module Twilio
|
|
|
168
168
|
# Path Solution
|
|
169
169
|
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid, sid: sid, }
|
|
170
170
|
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:engagement_sid]}/Steps/#{@solution[:sid]}"
|
|
171
|
+
|
|
172
|
+
# Dependents
|
|
173
|
+
@step_context = nil
|
|
171
174
|
end
|
|
172
175
|
|
|
173
176
|
##
|
|
@@ -191,6 +194,14 @@ module Twilio
|
|
|
191
194
|
)
|
|
192
195
|
end
|
|
193
196
|
|
|
197
|
+
##
|
|
198
|
+
# Access the step_context
|
|
199
|
+
# @return [StepContextList]
|
|
200
|
+
# @return [StepContextContext]
|
|
201
|
+
def step_context
|
|
202
|
+
StepContextContext.new(@version, @solution[:flow_sid], @solution[:engagement_sid], @solution[:sid], )
|
|
203
|
+
end
|
|
204
|
+
|
|
194
205
|
##
|
|
195
206
|
# Provide a user friendly representation
|
|
196
207
|
def to_s
|
|
@@ -220,12 +231,12 @@ module Twilio
|
|
|
220
231
|
'flow_sid' => payload['flow_sid'],
|
|
221
232
|
'engagement_sid' => payload['engagement_sid'],
|
|
222
233
|
'name' => payload['name'],
|
|
223
|
-
'context' => payload['context'],
|
|
224
234
|
'transitioned_from' => payload['transitioned_from'],
|
|
225
235
|
'transitioned_to' => payload['transitioned_to'],
|
|
226
236
|
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
227
237
|
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
228
238
|
'url' => payload['url'],
|
|
239
|
+
'links' => payload['links'],
|
|
229
240
|
}
|
|
230
241
|
|
|
231
242
|
# Context
|
|
@@ -283,12 +294,6 @@ module Twilio
|
|
|
283
294
|
@properties['name']
|
|
284
295
|
end
|
|
285
296
|
|
|
286
|
-
##
|
|
287
|
-
# @return [Hash] The context
|
|
288
|
-
def context
|
|
289
|
-
@properties['context']
|
|
290
|
-
end
|
|
291
|
-
|
|
292
297
|
##
|
|
293
298
|
# @return [String] The transitioned_from
|
|
294
299
|
def transitioned_from
|
|
@@ -319,6 +324,12 @@ module Twilio
|
|
|
319
324
|
@properties['url']
|
|
320
325
|
end
|
|
321
326
|
|
|
327
|
+
##
|
|
328
|
+
# @return [String] The links
|
|
329
|
+
def links
|
|
330
|
+
@properties['links']
|
|
331
|
+
end
|
|
332
|
+
|
|
322
333
|
##
|
|
323
334
|
# Fetch a StepInstance
|
|
324
335
|
# @return [StepInstance] Fetched StepInstance
|
|
@@ -326,6 +337,13 @@ module Twilio
|
|
|
326
337
|
context.fetch
|
|
327
338
|
end
|
|
328
339
|
|
|
340
|
+
##
|
|
341
|
+
# Access the step_context
|
|
342
|
+
# @return [step_context] step_context
|
|
343
|
+
def step_context
|
|
344
|
+
context.step_context
|
|
345
|
+
end
|
|
346
|
+
|
|
329
347
|
##
|
|
330
348
|
# Provide a user friendly representation
|
|
331
349
|
def to_s
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Studio < Domain
|
|
10
|
+
class V1 < Version
|
|
11
|
+
class FlowContext < InstanceContext
|
|
12
|
+
class EngagementContext < InstanceContext
|
|
13
|
+
class StepContext < InstanceContext
|
|
14
|
+
##
|
|
15
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
16
|
+
class StepContextList < ListResource
|
|
17
|
+
##
|
|
18
|
+
# Initialize the StepContextList
|
|
19
|
+
# @param [Version] version Version that contains the resource
|
|
20
|
+
# @param [String] flow_sid The flow_sid
|
|
21
|
+
# @param [String] engagement_sid The engagement_sid
|
|
22
|
+
# @param [String] step_sid The step_sid
|
|
23
|
+
# @return [StepContextList] StepContextList
|
|
24
|
+
def initialize(version, flow_sid: nil, engagement_sid: nil, step_sid: nil)
|
|
25
|
+
super(version)
|
|
26
|
+
|
|
27
|
+
# Path Solution
|
|
28
|
+
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid, step_sid: step_sid}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Provide a user friendly representation
|
|
33
|
+
def to_s
|
|
34
|
+
'#<Twilio.Studio.V1.StepContextList>'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
40
|
+
class StepContextPage < Page
|
|
41
|
+
##
|
|
42
|
+
# Initialize the StepContextPage
|
|
43
|
+
# @param [Version] version Version that contains the resource
|
|
44
|
+
# @param [Response] response Response from the API
|
|
45
|
+
# @param [Hash] solution Path solution for the resource
|
|
46
|
+
# @return [StepContextPage] StepContextPage
|
|
47
|
+
def initialize(version, response, solution)
|
|
48
|
+
super(version, response)
|
|
49
|
+
|
|
50
|
+
# Path Solution
|
|
51
|
+
@solution = solution
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
# Build an instance of StepContextInstance
|
|
56
|
+
# @param [Hash] payload Payload response from the API
|
|
57
|
+
# @return [StepContextInstance] StepContextInstance
|
|
58
|
+
def get_instance(payload)
|
|
59
|
+
StepContextInstance.new(
|
|
60
|
+
@version,
|
|
61
|
+
payload,
|
|
62
|
+
flow_sid: @solution[:flow_sid],
|
|
63
|
+
engagement_sid: @solution[:engagement_sid],
|
|
64
|
+
step_sid: @solution[:step_sid],
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
##
|
|
69
|
+
# Provide a user friendly representation
|
|
70
|
+
def to_s
|
|
71
|
+
'<Twilio.Studio.V1.StepContextPage>'
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
##
|
|
76
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
77
|
+
class StepContextContext < InstanceContext
|
|
78
|
+
##
|
|
79
|
+
# Initialize the StepContextContext
|
|
80
|
+
# @param [Version] version Version that contains the resource
|
|
81
|
+
# @param [String] flow_sid The flow_sid
|
|
82
|
+
# @param [String] engagement_sid The engagement_sid
|
|
83
|
+
# @param [String] step_sid The step_sid
|
|
84
|
+
# @return [StepContextContext] StepContextContext
|
|
85
|
+
def initialize(version, flow_sid, engagement_sid, step_sid)
|
|
86
|
+
super(version)
|
|
87
|
+
|
|
88
|
+
# Path Solution
|
|
89
|
+
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid, step_sid: step_sid, }
|
|
90
|
+
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:engagement_sid]}/Steps/#{@solution[:step_sid]}/Context"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
##
|
|
94
|
+
# Fetch a StepContextInstance
|
|
95
|
+
# @return [StepContextInstance] Fetched StepContextInstance
|
|
96
|
+
def fetch
|
|
97
|
+
params = Twilio::Values.of({})
|
|
98
|
+
|
|
99
|
+
payload = @version.fetch(
|
|
100
|
+
'GET',
|
|
101
|
+
@uri,
|
|
102
|
+
params,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
StepContextInstance.new(
|
|
106
|
+
@version,
|
|
107
|
+
payload,
|
|
108
|
+
flow_sid: @solution[:flow_sid],
|
|
109
|
+
engagement_sid: @solution[:engagement_sid],
|
|
110
|
+
step_sid: @solution[:step_sid],
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
##
|
|
115
|
+
# Provide a user friendly representation
|
|
116
|
+
def to_s
|
|
117
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
118
|
+
"#<Twilio.Studio.V1.StepContextContext #{context}>"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
##
|
|
123
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
|
124
|
+
class StepContextInstance < InstanceResource
|
|
125
|
+
##
|
|
126
|
+
# Initialize the StepContextInstance
|
|
127
|
+
# @param [Version] version Version that contains the resource
|
|
128
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
129
|
+
# @param [String] flow_sid The flow_sid
|
|
130
|
+
# @param [String] engagement_sid The engagement_sid
|
|
131
|
+
# @param [String] step_sid The step_sid
|
|
132
|
+
# @return [StepContextInstance] StepContextInstance
|
|
133
|
+
def initialize(version, payload, flow_sid: nil, engagement_sid: nil, step_sid: nil)
|
|
134
|
+
super(version)
|
|
135
|
+
|
|
136
|
+
# Marshaled Properties
|
|
137
|
+
@properties = {
|
|
138
|
+
'account_sid' => payload['account_sid'],
|
|
139
|
+
'context' => payload['context'],
|
|
140
|
+
'engagement_sid' => payload['engagement_sid'],
|
|
141
|
+
'flow_sid' => payload['flow_sid'],
|
|
142
|
+
'step_sid' => payload['step_sid'],
|
|
143
|
+
'url' => payload['url'],
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# Context
|
|
147
|
+
@instance_context = nil
|
|
148
|
+
@params = {'flow_sid' => flow_sid, 'engagement_sid' => engagement_sid, 'step_sid' => step_sid, }
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
##
|
|
152
|
+
# Generate an instance context for the instance, the context is capable of
|
|
153
|
+
# performing various actions. All instance actions are proxied to the context
|
|
154
|
+
# @return [StepContextContext] StepContextContext for this StepContextInstance
|
|
155
|
+
def context
|
|
156
|
+
unless @instance_context
|
|
157
|
+
@instance_context = StepContextContext.new(
|
|
158
|
+
@version,
|
|
159
|
+
@params['flow_sid'],
|
|
160
|
+
@params['engagement_sid'],
|
|
161
|
+
@params['step_sid'],
|
|
162
|
+
)
|
|
163
|
+
end
|
|
164
|
+
@instance_context
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
##
|
|
168
|
+
# @return [String] The account_sid
|
|
169
|
+
def account_sid
|
|
170
|
+
@properties['account_sid']
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
##
|
|
174
|
+
# @return [Hash] The context
|
|
175
|
+
def context
|
|
176
|
+
@properties['context']
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
##
|
|
180
|
+
# @return [String] The engagement_sid
|
|
181
|
+
def engagement_sid
|
|
182
|
+
@properties['engagement_sid']
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
##
|
|
186
|
+
# @return [String] The flow_sid
|
|
187
|
+
def flow_sid
|
|
188
|
+
@properties['flow_sid']
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
##
|
|
192
|
+
# @return [String] The step_sid
|
|
193
|
+
def step_sid
|
|
194
|
+
@properties['step_sid']
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
##
|
|
198
|
+
# @return [String] The url
|
|
199
|
+
def url
|
|
200
|
+
@properties['url']
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
##
|
|
204
|
+
# Fetch a StepContextInstance
|
|
205
|
+
# @return [StepContextInstance] Fetched StepContextInstance
|
|
206
|
+
def fetch
|
|
207
|
+
context.fetch
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
##
|
|
211
|
+
# Provide a user friendly representation
|
|
212
|
+
def to_s
|
|
213
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
214
|
+
"<Twilio.Studio.V1.StepContextInstance #{values}>"
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
##
|
|
218
|
+
# Provide a detailed, user friendly representation
|
|
219
|
+
def inspect
|
|
220
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
221
|
+
"<Twilio.Studio.V1.StepContextInstance #{values}>"
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|