twilio-ruby 5.35.0 → 5.36.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 +28 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +87 -87
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +71 -71
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +29 -29
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +27 -4
- data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +2 -1
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +6 -3
- data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +26 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand.rb +239 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +266 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +197 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
- data/lib/twilio-ruby/rest/supersim.rb +11 -1
- data/lib/twilio-ruby/rest/supersim/v1.rb +16 -1
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +10 -1
- data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +53 -12
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +352 -0
- data/lib/twilio-ruby/rest/verify.rb +9 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +16 -0
- data/lib/twilio-ruby/rest/verify/v2/form.rb +197 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +26 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +379 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +500 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor/challenge.rb +494 -0
- data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -4
- data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call_spec.rb +5 -5
- data/spec/integration/api/v2010/account/conference_spec.rb +42 -14
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
- data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
- data/spec/integration/preview/trusted_comms/business/brand/branded_channel/channel_spec.rb +54 -0
- data/spec/integration/preview/trusted_comms/business/brand/branded_channel_spec.rb +52 -0
- data/spec/integration/preview/trusted_comms/business/brand_spec.rb +49 -0
- data/spec/integration/preview/trusted_comms/business_spec.rb +1 -0
- data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
- data/spec/integration/supersim/v1/fleet_spec.rb +4 -0
- data/spec/integration/supersim/v1/network_access_profile/network_access_profile_network_spec.rb +179 -0
- data/spec/integration/supersim/v1/network_access_profile_spec.rb +20 -5
- data/spec/integration/supersim/v1/network_spec.rb +139 -0
- data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +13 -13
- data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +23 -23
- data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +28 -28
- data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +17 -17
- data/spec/integration/trunking/v1/trunk_spec.rb +33 -33
- data/spec/integration/verify/v2/form_spec.rb +48 -0
- data/spec/integration/verify/v2/service/entity/factor/challenge_spec.rb +353 -0
- data/spec/integration/verify/v2/service/entity/factor_spec.rb +298 -0
- data/spec/integration/verify/v2/service/entity_spec.rb +201 -0
- data/spec/integration/verify/v2/service_spec.rb +24 -4
- metadata +29 -2
data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb
ADDED
@@ -0,0 +1,352 @@
|
|
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 Supersim < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class NetworkAccessProfileContext < 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 NetworkAccessProfileNetworkList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the NetworkAccessProfileNetworkList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] network_access_profile_sid The unique string that identifies the
|
21
|
+
# Network resource's Network Access Profile resource.
|
22
|
+
# @return [NetworkAccessProfileNetworkList] NetworkAccessProfileNetworkList
|
23
|
+
def initialize(version, network_access_profile_sid: nil)
|
24
|
+
super(version)
|
25
|
+
|
26
|
+
# Path Solution
|
27
|
+
@solution = {network_access_profile_sid: network_access_profile_sid}
|
28
|
+
@uri = "/NetworkAccessProfiles/#{@solution[:network_access_profile_sid]}/Networks"
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Lists NetworkAccessProfileNetworkInstance records from the API as a list.
|
33
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
34
|
+
# memory before returning.
|
35
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
36
|
+
# guarantees to never return more than limit. Default is no limit
|
37
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
38
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
39
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
40
|
+
# efficient page size, i.e. min(limit, 1000)
|
41
|
+
# @return [Array] Array of up to limit results
|
42
|
+
def list(limit: nil, page_size: nil)
|
43
|
+
self.stream(limit: limit, page_size: page_size).entries
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Streams NetworkAccessProfileNetworkInstance records from the API as an Enumerable.
|
48
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
49
|
+
# is reached.
|
50
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
51
|
+
# guarantees to never return more than limit. Default is no limit.
|
52
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
53
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
54
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
55
|
+
# efficient page size, i.e. min(limit, 1000)
|
56
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
57
|
+
def stream(limit: nil, page_size: nil)
|
58
|
+
limits = @version.read_limits(limit, page_size)
|
59
|
+
|
60
|
+
page = self.page(page_size: limits[:page_size], )
|
61
|
+
|
62
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# When passed a block, yields NetworkAccessProfileNetworkInstance records from the API.
|
67
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
68
|
+
# is reached.
|
69
|
+
def each
|
70
|
+
limits = @version.read_limits
|
71
|
+
|
72
|
+
page = self.page(page_size: limits[:page_size], )
|
73
|
+
|
74
|
+
@version.stream(page,
|
75
|
+
limit: limits[:limit],
|
76
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Retrieve a single page of NetworkAccessProfileNetworkInstance records from the API.
|
81
|
+
# Request is executed immediately.
|
82
|
+
# @param [String] page_token PageToken provided by the API
|
83
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
84
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
85
|
+
# @return [Page] Page of NetworkAccessProfileNetworkInstance
|
86
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
87
|
+
params = Twilio::Values.of({
|
88
|
+
'PageToken' => page_token,
|
89
|
+
'Page' => page_number,
|
90
|
+
'PageSize' => page_size,
|
91
|
+
})
|
92
|
+
response = @version.page(
|
93
|
+
'GET',
|
94
|
+
@uri,
|
95
|
+
params
|
96
|
+
)
|
97
|
+
NetworkAccessProfileNetworkPage.new(@version, response, @solution)
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Retrieve a single page of NetworkAccessProfileNetworkInstance records from the API.
|
102
|
+
# Request is executed immediately.
|
103
|
+
# @param [String] target_url API-generated URL for the requested results page
|
104
|
+
# @return [Page] Page of NetworkAccessProfileNetworkInstance
|
105
|
+
def get_page(target_url)
|
106
|
+
response = @version.domain.request(
|
107
|
+
'GET',
|
108
|
+
target_url
|
109
|
+
)
|
110
|
+
NetworkAccessProfileNetworkPage.new(@version, response, @solution)
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Retrieve a single page of NetworkAccessProfileNetworkInstance records from the API.
|
115
|
+
# Request is executed immediately.
|
116
|
+
# @param [String] network The SID of the Network resource to be added to the
|
117
|
+
# Network Access Profile resource.
|
118
|
+
# @return [NetworkAccessProfileNetworkInstance] Newly created NetworkAccessProfileNetworkInstance
|
119
|
+
def create(network: nil)
|
120
|
+
data = Twilio::Values.of({'Network' => network, })
|
121
|
+
|
122
|
+
payload = @version.create(
|
123
|
+
'POST',
|
124
|
+
@uri,
|
125
|
+
data: data
|
126
|
+
)
|
127
|
+
|
128
|
+
NetworkAccessProfileNetworkInstance.new(
|
129
|
+
@version,
|
130
|
+
payload,
|
131
|
+
network_access_profile_sid: @solution[:network_access_profile_sid],
|
132
|
+
)
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Provide a user friendly representation
|
137
|
+
def to_s
|
138
|
+
'#<Twilio.Supersim.V1.NetworkAccessProfileNetworkList>'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# 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.
|
144
|
+
class NetworkAccessProfileNetworkPage < Page
|
145
|
+
##
|
146
|
+
# Initialize the NetworkAccessProfileNetworkPage
|
147
|
+
# @param [Version] version Version that contains the resource
|
148
|
+
# @param [Response] response Response from the API
|
149
|
+
# @param [Hash] solution Path solution for the resource
|
150
|
+
# @return [NetworkAccessProfileNetworkPage] NetworkAccessProfileNetworkPage
|
151
|
+
def initialize(version, response, solution)
|
152
|
+
super(version, response)
|
153
|
+
|
154
|
+
# Path Solution
|
155
|
+
@solution = solution
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Build an instance of NetworkAccessProfileNetworkInstance
|
160
|
+
# @param [Hash] payload Payload response from the API
|
161
|
+
# @return [NetworkAccessProfileNetworkInstance] NetworkAccessProfileNetworkInstance
|
162
|
+
def get_instance(payload)
|
163
|
+
NetworkAccessProfileNetworkInstance.new(
|
164
|
+
@version,
|
165
|
+
payload,
|
166
|
+
network_access_profile_sid: @solution[:network_access_profile_sid],
|
167
|
+
)
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# Provide a user friendly representation
|
172
|
+
def to_s
|
173
|
+
'<Twilio.Supersim.V1.NetworkAccessProfileNetworkPage>'
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# 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.
|
179
|
+
class NetworkAccessProfileNetworkContext < InstanceContext
|
180
|
+
##
|
181
|
+
# Initialize the NetworkAccessProfileNetworkContext
|
182
|
+
# @param [Version] version Version that contains the resource
|
183
|
+
# @param [String] network_access_profile_sid The unique string that identifies the
|
184
|
+
# Network Access Profile resource.
|
185
|
+
# @param [String] sid The SID of the Network resource to fetch.
|
186
|
+
# @return [NetworkAccessProfileNetworkContext] NetworkAccessProfileNetworkContext
|
187
|
+
def initialize(version, network_access_profile_sid, sid)
|
188
|
+
super(version)
|
189
|
+
|
190
|
+
# Path Solution
|
191
|
+
@solution = {network_access_profile_sid: network_access_profile_sid, sid: sid, }
|
192
|
+
@uri = "/NetworkAccessProfiles/#{@solution[:network_access_profile_sid]}/Networks/#{@solution[:sid]}"
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# Deletes the NetworkAccessProfileNetworkInstance
|
197
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
198
|
+
def delete
|
199
|
+
@version.delete('delete', @uri)
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# Fetch a NetworkAccessProfileNetworkInstance
|
204
|
+
# @return [NetworkAccessProfileNetworkInstance] Fetched NetworkAccessProfileNetworkInstance
|
205
|
+
def fetch
|
206
|
+
params = Twilio::Values.of({})
|
207
|
+
|
208
|
+
payload = @version.fetch(
|
209
|
+
'GET',
|
210
|
+
@uri,
|
211
|
+
params,
|
212
|
+
)
|
213
|
+
|
214
|
+
NetworkAccessProfileNetworkInstance.new(
|
215
|
+
@version,
|
216
|
+
payload,
|
217
|
+
network_access_profile_sid: @solution[:network_access_profile_sid],
|
218
|
+
sid: @solution[:sid],
|
219
|
+
)
|
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.Supersim.V1.NetworkAccessProfileNetworkContext #{context}>"
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# Provide a detailed, user friendly representation
|
231
|
+
def inspect
|
232
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
233
|
+
"#<Twilio.Supersim.V1.NetworkAccessProfileNetworkContext #{context}>"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# 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.
|
239
|
+
class NetworkAccessProfileNetworkInstance < InstanceResource
|
240
|
+
##
|
241
|
+
# Initialize the NetworkAccessProfileNetworkInstance
|
242
|
+
# @param [Version] version Version that contains the resource
|
243
|
+
# @param [Hash] payload payload that contains response from Twilio
|
244
|
+
# @param [String] network_access_profile_sid The unique string that identifies the
|
245
|
+
# Network resource's Network Access Profile resource.
|
246
|
+
# @param [String] sid The SID of the Network resource to fetch.
|
247
|
+
# @return [NetworkAccessProfileNetworkInstance] NetworkAccessProfileNetworkInstance
|
248
|
+
def initialize(version, payload, network_access_profile_sid: nil, sid: nil)
|
249
|
+
super(version)
|
250
|
+
|
251
|
+
# Marshaled Properties
|
252
|
+
@properties = {
|
253
|
+
'sid' => payload['sid'],
|
254
|
+
'network_access_profile_sid' => payload['network_access_profile_sid'],
|
255
|
+
'friendly_name' => payload['friendly_name'],
|
256
|
+
'iso_country' => payload['iso_country'],
|
257
|
+
'identifiers' => payload['identifiers'],
|
258
|
+
'url' => payload['url'],
|
259
|
+
}
|
260
|
+
|
261
|
+
# Context
|
262
|
+
@instance_context = nil
|
263
|
+
@params = {
|
264
|
+
'network_access_profile_sid' => network_access_profile_sid,
|
265
|
+
'sid' => sid || @properties['sid'],
|
266
|
+
}
|
267
|
+
end
|
268
|
+
|
269
|
+
##
|
270
|
+
# Generate an instance context for the instance, the context is capable of
|
271
|
+
# performing various actions. All instance actions are proxied to the context
|
272
|
+
# @return [NetworkAccessProfileNetworkContext] NetworkAccessProfileNetworkContext for this NetworkAccessProfileNetworkInstance
|
273
|
+
def context
|
274
|
+
unless @instance_context
|
275
|
+
@instance_context = NetworkAccessProfileNetworkContext.new(
|
276
|
+
@version,
|
277
|
+
@params['network_access_profile_sid'],
|
278
|
+
@params['sid'],
|
279
|
+
)
|
280
|
+
end
|
281
|
+
@instance_context
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# @return [String] The unique string that identifies the resource
|
286
|
+
def sid
|
287
|
+
@properties['sid']
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @return [String] The unique string that identifies the Network Access Profile resource
|
292
|
+
def network_access_profile_sid
|
293
|
+
@properties['network_access_profile_sid']
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [String] A human readable identifier of this resource
|
298
|
+
def friendly_name
|
299
|
+
@properties['friendly_name']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [String] The ISO country code of the Network resource
|
304
|
+
def iso_country
|
305
|
+
@properties['iso_country']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [Hash] The MCC/MNCs included in the resource
|
310
|
+
def identifiers
|
311
|
+
@properties['identifiers']
|
312
|
+
end
|
313
|
+
|
314
|
+
##
|
315
|
+
# @return [String] The absolute URL of the resource
|
316
|
+
def url
|
317
|
+
@properties['url']
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# Deletes the NetworkAccessProfileNetworkInstance
|
322
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
323
|
+
def delete
|
324
|
+
context.delete
|
325
|
+
end
|
326
|
+
|
327
|
+
##
|
328
|
+
# Fetch a NetworkAccessProfileNetworkInstance
|
329
|
+
# @return [NetworkAccessProfileNetworkInstance] Fetched NetworkAccessProfileNetworkInstance
|
330
|
+
def fetch
|
331
|
+
context.fetch
|
332
|
+
end
|
333
|
+
|
334
|
+
##
|
335
|
+
# Provide a user friendly representation
|
336
|
+
def to_s
|
337
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
338
|
+
"<Twilio.Supersim.V1.NetworkAccessProfileNetworkInstance #{values}>"
|
339
|
+
end
|
340
|
+
|
341
|
+
##
|
342
|
+
# Provide a detailed, user friendly representation
|
343
|
+
def inspect
|
344
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
345
|
+
"<Twilio.Supersim.V1.NetworkAccessProfileNetworkInstance #{values}>"
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
@@ -28,6 +28,15 @@ module Twilio
|
|
28
28
|
@v2 ||= V2.new self
|
29
29
|
end
|
30
30
|
|
31
|
+
##
|
32
|
+
# @param [form.FormTypes] form_type The Type of this Form. One of `form-app-push`,
|
33
|
+
# `form-sms` or `form-totp`.
|
34
|
+
# @return [Twilio::REST::Verify::V2::FormInstance] if form_type was passed.
|
35
|
+
# @return [Twilio::REST::Verify::V2::FormList]
|
36
|
+
def forms(form_type=:unset)
|
37
|
+
self.v2.forms(form_type)
|
38
|
+
end
|
39
|
+
|
31
40
|
##
|
32
41
|
# @param [String] sid The unique string that we created to identify the Service
|
33
42
|
# resource.
|
@@ -15,9 +15,25 @@ module Twilio
|
|
15
15
|
def initialize(domain)
|
16
16
|
super
|
17
17
|
@version = 'v2'
|
18
|
+
@forms = nil
|
18
19
|
@services = nil
|
19
20
|
end
|
20
21
|
|
22
|
+
##
|
23
|
+
# @param [form.FormTypes] form_type The Type of this Form. One of `form-app-push`,
|
24
|
+
# `form-sms` or `form-totp`.
|
25
|
+
# @return [Twilio::REST::Verify::V2::FormContext] if form_type was passed.
|
26
|
+
# @return [Twilio::REST::Verify::V2::FormList]
|
27
|
+
def forms(form_type=:unset)
|
28
|
+
if form_type.nil?
|
29
|
+
raise ArgumentError, 'form_type cannot be nil'
|
30
|
+
elsif form_type == :unset
|
31
|
+
@forms ||= FormList.new self
|
32
|
+
else
|
33
|
+
FormContext.new(self, form_type)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
21
37
|
##
|
22
38
|
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
23
39
|
# Verification Service resource to fetch.
|
@@ -0,0 +1,197 @@
|
|
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 Verify < Domain
|
12
|
+
class V2 < 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 FormList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the FormList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [FormList] FormList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'#<Twilio.Verify.V2.FormList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# 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.
|
36
|
+
class FormPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the FormPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [FormPage] FormPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of FormInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [FormInstance] FormInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
FormInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.Verify.V2.FormPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# 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.
|
67
|
+
class FormContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the FormContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @param [form.FormTypes] form_type The Type of this Form. One of `form-app-push`,
|
72
|
+
# `form-sms` or `form-totp`.
|
73
|
+
# @return [FormContext] FormContext
|
74
|
+
def initialize(version, form_type)
|
75
|
+
super(version)
|
76
|
+
|
77
|
+
# Path Solution
|
78
|
+
@solution = {form_type: form_type, }
|
79
|
+
@uri = "/Forms/#{@solution[:form_type]}"
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Fetch a FormInstance
|
84
|
+
# @return [FormInstance] Fetched FormInstance
|
85
|
+
def fetch
|
86
|
+
params = Twilio::Values.of({})
|
87
|
+
|
88
|
+
payload = @version.fetch(
|
89
|
+
'GET',
|
90
|
+
@uri,
|
91
|
+
params,
|
92
|
+
)
|
93
|
+
|
94
|
+
FormInstance.new(@version, payload, form_type: @solution[:form_type], )
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Provide a user friendly representation
|
99
|
+
def to_s
|
100
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
101
|
+
"#<Twilio.Verify.V2.FormContext #{context}>"
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# Provide a detailed, user friendly representation
|
106
|
+
def inspect
|
107
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
108
|
+
"#<Twilio.Verify.V2.FormContext #{context}>"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# 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.
|
114
|
+
class FormInstance < InstanceResource
|
115
|
+
##
|
116
|
+
# Initialize the FormInstance
|
117
|
+
# @param [Version] version Version that contains the resource
|
118
|
+
# @param [Hash] payload payload that contains response from Twilio
|
119
|
+
# @param [form.FormTypes] form_type The Type of this Form. One of `form-app-push`,
|
120
|
+
# `form-sms` or `form-totp`.
|
121
|
+
# @return [FormInstance] FormInstance
|
122
|
+
def initialize(version, payload, form_type: nil)
|
123
|
+
super(version)
|
124
|
+
|
125
|
+
# Marshaled Properties
|
126
|
+
@properties = {
|
127
|
+
'form_type' => payload['form_type'],
|
128
|
+
'forms' => payload['forms'],
|
129
|
+
'form_meta' => payload['form_meta'],
|
130
|
+
'url' => payload['url'],
|
131
|
+
}
|
132
|
+
|
133
|
+
# Context
|
134
|
+
@instance_context = nil
|
135
|
+
@params = {'form_type' => form_type || @properties['form_type'], }
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# Generate an instance context for the instance, the context is capable of
|
140
|
+
# performing various actions. All instance actions are proxied to the context
|
141
|
+
# @return [FormContext] FormContext for this FormInstance
|
142
|
+
def context
|
143
|
+
unless @instance_context
|
144
|
+
@instance_context = FormContext.new(@version, @params['form_type'], )
|
145
|
+
end
|
146
|
+
@instance_context
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# @return [form.FormTypes] The Type of this Form
|
151
|
+
def form_type
|
152
|
+
@properties['form_type']
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# @return [Hash] Object that contains the available forms for this type.
|
157
|
+
def forms
|
158
|
+
@properties['forms']
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# @return [Hash] Additional information for the available forms for this type.
|
163
|
+
def form_meta
|
164
|
+
@properties['form_meta']
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# @return [String] The URL to access the forms for this type.
|
169
|
+
def url
|
170
|
+
@properties['url']
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# Fetch a FormInstance
|
175
|
+
# @return [FormInstance] Fetched FormInstance
|
176
|
+
def fetch
|
177
|
+
context.fetch
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Provide a user friendly representation
|
182
|
+
def to_s
|
183
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
184
|
+
"<Twilio.Verify.V2.FormInstance #{values}>"
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# Provide a detailed, user friendly representation
|
189
|
+
def inspect
|
190
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
191
|
+
"<Twilio.Verify.V2.FormInstance #{values}>"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|