twilio-ruby 5.22.0 → 5.22.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 +15 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
- data/lib/twilio-ruby/rest/messaging/v1/session.rb +1 -7
- data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +34 -32
- data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +37 -35
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +45 -38
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +38 -34
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +67 -52
- data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +32 -23
- data/lib/twilio-ruby/rest/proxy/v1/service.rb +123 -79
- data/lib/twilio-ruby/rest/proxy/v1.rb +2 -1
- data/lib/twilio-ruby/rest/proxy.rb +2 -1
- data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +366 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +384 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +348 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +358 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +398 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +417 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +366 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +384 -0
- data/lib/twilio-ruby/rest/{verify → serverless}/v1/service.rb +139 -175
- data/lib/twilio-ruby/rest/{verify → serverless}/v1.rb +6 -6
- data/lib/twilio-ruby/rest/serverless.rb +46 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk/terminating_sip_domain.rb +419 -0
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +26 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +46 -38
- data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +24 -20
- data/lib/twilio-ruby/rest/verify/v2/service.rb +59 -57
- data/lib/twilio-ruby/rest/verify/v2.rb +2 -1
- data/lib/twilio-ruby/rest/verify.rb +2 -8
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/flex_api/v1/configuration_spec.rb +15 -0
- data/spec/integration/messaging/v1/session/participant_spec.rb +10 -10
- data/spec/integration/serverless/v1/service/asset/asset_version_spec.rb +144 -0
- data/spec/integration/serverless/v1/service/asset_spec.rb +177 -0
- data/spec/integration/serverless/v1/service/build_spec.rb +184 -0
- data/spec/integration/serverless/v1/service/environment/deployment_spec.rb +137 -0
- data/spec/integration/serverless/v1/service/environment/variable_spec.rb +181 -0
- data/spec/integration/serverless/v1/service/environment_spec.rb +143 -0
- data/spec/integration/serverless/v1/service/function/function_version_spec.rb +144 -0
- data/spec/integration/serverless/v1/service/function_spec.rb +177 -0
- data/spec/integration/serverless/v1/service_spec.rb +180 -0
- data/spec/integration/trunking/v1/trunk/terminating_sip_domain_spec.rb +231 -0
- data/spec/integration/trunking/v1/trunk_spec.rb +12 -6
- metadata +34 -12
- data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +0 -340
- data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +0 -209
- data/spec/integration/verify/v1/service/verification_check_spec.rb +0 -54
- data/spec/integration/verify/v1/service/verification_spec.rb +0 -169
- data/spec/integration/verify/v1/service_spec.rb +0 -231
@@ -0,0 +1,348 @@
|
|
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 Serverless < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class ServiceContext < 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 BuildList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the BuildList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] service_sid The service_sid
|
21
|
+
# @return [BuildList] BuildList
|
22
|
+
def initialize(version, service_sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {service_sid: service_sid}
|
27
|
+
@uri = "/Services/#{@solution[:service_sid]}/Builds"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Lists BuildInstance 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 BuildInstance 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 BuildInstance 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 BuildInstance 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 BuildInstance
|
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
|
+
BuildPage.new(@version, response, @solution)
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Retrieve a single page of BuildInstance 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 BuildInstance
|
104
|
+
def get_page(target_url)
|
105
|
+
response = @version.domain.request(
|
106
|
+
'GET',
|
107
|
+
target_url
|
108
|
+
)
|
109
|
+
BuildPage.new(@version, response, @solution)
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Retrieve a single page of BuildInstance records from the API.
|
114
|
+
# Request is executed immediately.
|
115
|
+
# @param [String] asset_versions The asset_versions
|
116
|
+
# @param [String] function_versions The function_versions
|
117
|
+
# @param [String] dependencies The dependencies
|
118
|
+
# @return [BuildInstance] Newly created BuildInstance
|
119
|
+
def create(asset_versions: :unset, function_versions: :unset, dependencies: :unset)
|
120
|
+
data = Twilio::Values.of({
|
121
|
+
'AssetVersions' => Twilio.serialize_list(asset_versions) { |e| e },
|
122
|
+
'FunctionVersions' => Twilio.serialize_list(function_versions) { |e| e },
|
123
|
+
'Dependencies' => dependencies,
|
124
|
+
})
|
125
|
+
|
126
|
+
payload = @version.create(
|
127
|
+
'POST',
|
128
|
+
@uri,
|
129
|
+
data: data
|
130
|
+
)
|
131
|
+
|
132
|
+
BuildInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Provide a user friendly representation
|
137
|
+
def to_s
|
138
|
+
'#<Twilio.Serverless.V1.BuildList>'
|
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 BuildPage < Page
|
145
|
+
##
|
146
|
+
# Initialize the BuildPage
|
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 [BuildPage] BuildPage
|
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 BuildInstance
|
160
|
+
# @param [Hash] payload Payload response from the API
|
161
|
+
# @return [BuildInstance] BuildInstance
|
162
|
+
def get_instance(payload)
|
163
|
+
BuildInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Provide a user friendly representation
|
168
|
+
def to_s
|
169
|
+
'<Twilio.Serverless.V1.BuildPage>'
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# 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.
|
175
|
+
class BuildContext < InstanceContext
|
176
|
+
##
|
177
|
+
# Initialize the BuildContext
|
178
|
+
# @param [Version] version Version that contains the resource
|
179
|
+
# @param [String] service_sid The service_sid
|
180
|
+
# @param [String] sid The sid
|
181
|
+
# @return [BuildContext] BuildContext
|
182
|
+
def initialize(version, service_sid, sid)
|
183
|
+
super(version)
|
184
|
+
|
185
|
+
# Path Solution
|
186
|
+
@solution = {service_sid: service_sid, sid: sid, }
|
187
|
+
@uri = "/Services/#{@solution[:service_sid]}/Builds/#{@solution[:sid]}"
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# Fetch a BuildInstance
|
192
|
+
# @return [BuildInstance] Fetched BuildInstance
|
193
|
+
def fetch
|
194
|
+
params = Twilio::Values.of({})
|
195
|
+
|
196
|
+
payload = @version.fetch(
|
197
|
+
'GET',
|
198
|
+
@uri,
|
199
|
+
params,
|
200
|
+
)
|
201
|
+
|
202
|
+
BuildInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
|
203
|
+
end
|
204
|
+
|
205
|
+
##
|
206
|
+
# Provide a user friendly representation
|
207
|
+
def to_s
|
208
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
209
|
+
"#<Twilio.Serverless.V1.BuildContext #{context}>"
|
210
|
+
end
|
211
|
+
|
212
|
+
##
|
213
|
+
# Provide a detailed, user friendly representation
|
214
|
+
def inspect
|
215
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
216
|
+
"#<Twilio.Serverless.V1.BuildContext #{context}>"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# 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.
|
222
|
+
class BuildInstance < InstanceResource
|
223
|
+
##
|
224
|
+
# Initialize the BuildInstance
|
225
|
+
# @param [Version] version Version that contains the resource
|
226
|
+
# @param [Hash] payload payload that contains response from Twilio
|
227
|
+
# @param [String] service_sid The service_sid
|
228
|
+
# @param [String] sid The sid
|
229
|
+
# @return [BuildInstance] BuildInstance
|
230
|
+
def initialize(version, payload, service_sid: nil, sid: nil)
|
231
|
+
super(version)
|
232
|
+
|
233
|
+
# Marshaled Properties
|
234
|
+
@properties = {
|
235
|
+
'sid' => payload['sid'],
|
236
|
+
'account_sid' => payload['account_sid'],
|
237
|
+
'service_sid' => payload['service_sid'],
|
238
|
+
'status' => payload['status'],
|
239
|
+
'asset_versions' => payload['asset_versions'],
|
240
|
+
'function_versions' => payload['function_versions'],
|
241
|
+
'dependencies' => payload['dependencies'],
|
242
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
243
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
244
|
+
'url' => payload['url'],
|
245
|
+
}
|
246
|
+
|
247
|
+
# Context
|
248
|
+
@instance_context = nil
|
249
|
+
@params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Generate an instance context for the instance, the context is capable of
|
254
|
+
# performing various actions. All instance actions are proxied to the context
|
255
|
+
# @return [BuildContext] BuildContext for this BuildInstance
|
256
|
+
def context
|
257
|
+
unless @instance_context
|
258
|
+
@instance_context = BuildContext.new(@version, @params['service_sid'], @params['sid'], )
|
259
|
+
end
|
260
|
+
@instance_context
|
261
|
+
end
|
262
|
+
|
263
|
+
##
|
264
|
+
# @return [String] The sid
|
265
|
+
def sid
|
266
|
+
@properties['sid']
|
267
|
+
end
|
268
|
+
|
269
|
+
##
|
270
|
+
# @return [String] The account_sid
|
271
|
+
def account_sid
|
272
|
+
@properties['account_sid']
|
273
|
+
end
|
274
|
+
|
275
|
+
##
|
276
|
+
# @return [String] The service_sid
|
277
|
+
def service_sid
|
278
|
+
@properties['service_sid']
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# @return [build.Status] The status
|
283
|
+
def status
|
284
|
+
@properties['status']
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# @return [Hash] The asset_versions
|
289
|
+
def asset_versions
|
290
|
+
@properties['asset_versions']
|
291
|
+
end
|
292
|
+
|
293
|
+
##
|
294
|
+
# @return [Hash] The function_versions
|
295
|
+
def function_versions
|
296
|
+
@properties['function_versions']
|
297
|
+
end
|
298
|
+
|
299
|
+
##
|
300
|
+
# @return [Hash] The dependencies
|
301
|
+
def dependencies
|
302
|
+
@properties['dependencies']
|
303
|
+
end
|
304
|
+
|
305
|
+
##
|
306
|
+
# @return [Time] The date_created
|
307
|
+
def date_created
|
308
|
+
@properties['date_created']
|
309
|
+
end
|
310
|
+
|
311
|
+
##
|
312
|
+
# @return [Time] The date_updated
|
313
|
+
def date_updated
|
314
|
+
@properties['date_updated']
|
315
|
+
end
|
316
|
+
|
317
|
+
##
|
318
|
+
# @return [String] The url
|
319
|
+
def url
|
320
|
+
@properties['url']
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# Fetch a BuildInstance
|
325
|
+
# @return [BuildInstance] Fetched BuildInstance
|
326
|
+
def fetch
|
327
|
+
context.fetch
|
328
|
+
end
|
329
|
+
|
330
|
+
##
|
331
|
+
# Provide a user friendly representation
|
332
|
+
def to_s
|
333
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
334
|
+
"<Twilio.Serverless.V1.BuildInstance #{values}>"
|
335
|
+
end
|
336
|
+
|
337
|
+
##
|
338
|
+
# Provide a detailed, user friendly representation
|
339
|
+
def inspect
|
340
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
341
|
+
"<Twilio.Serverless.V1.BuildInstance #{values}>"
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
@@ -0,0 +1,358 @@
|
|
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 Serverless < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class ServiceContext < InstanceContext
|
14
|
+
class EnvironmentContext < InstanceContext
|
15
|
+
##
|
16
|
+
# 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.
|
17
|
+
class DeploymentList < ListResource
|
18
|
+
##
|
19
|
+
# Initialize the DeploymentList
|
20
|
+
# @param [Version] version Version that contains the resource
|
21
|
+
# @param [String] service_sid The service_sid
|
22
|
+
# @param [String] environment_sid The environment_sid
|
23
|
+
# @return [DeploymentList] DeploymentList
|
24
|
+
def initialize(version, service_sid: nil, environment_sid: nil)
|
25
|
+
super(version)
|
26
|
+
|
27
|
+
# Path Solution
|
28
|
+
@solution = {service_sid: service_sid, environment_sid: environment_sid}
|
29
|
+
@uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Deployments"
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Lists DeploymentInstance 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 DeploymentInstance 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 DeploymentInstance 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 DeploymentInstance 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 DeploymentInstance
|
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
|
+
DeploymentPage.new(@version, response, @solution)
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Retrieve a single page of DeploymentInstance 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 DeploymentInstance
|
106
|
+
def get_page(target_url)
|
107
|
+
response = @version.domain.request(
|
108
|
+
'GET',
|
109
|
+
target_url
|
110
|
+
)
|
111
|
+
DeploymentPage.new(@version, response, @solution)
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Retrieve a single page of DeploymentInstance records from the API.
|
116
|
+
# Request is executed immediately.
|
117
|
+
# @param [String] build_sid The build_sid
|
118
|
+
# @return [DeploymentInstance] Newly created DeploymentInstance
|
119
|
+
def create(build_sid: nil)
|
120
|
+
data = Twilio::Values.of({'BuildSid' => build_sid, })
|
121
|
+
|
122
|
+
payload = @version.create(
|
123
|
+
'POST',
|
124
|
+
@uri,
|
125
|
+
data: data
|
126
|
+
)
|
127
|
+
|
128
|
+
DeploymentInstance.new(
|
129
|
+
@version,
|
130
|
+
payload,
|
131
|
+
service_sid: @solution[:service_sid],
|
132
|
+
environment_sid: @solution[:environment_sid],
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# Provide a user friendly representation
|
138
|
+
def to_s
|
139
|
+
'#<Twilio.Serverless.V1.DeploymentList>'
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# 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.
|
145
|
+
class DeploymentPage < Page
|
146
|
+
##
|
147
|
+
# Initialize the DeploymentPage
|
148
|
+
# @param [Version] version Version that contains the resource
|
149
|
+
# @param [Response] response Response from the API
|
150
|
+
# @param [Hash] solution Path solution for the resource
|
151
|
+
# @return [DeploymentPage] DeploymentPage
|
152
|
+
def initialize(version, response, solution)
|
153
|
+
super(version, response)
|
154
|
+
|
155
|
+
# Path Solution
|
156
|
+
@solution = solution
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
# Build an instance of DeploymentInstance
|
161
|
+
# @param [Hash] payload Payload response from the API
|
162
|
+
# @return [DeploymentInstance] DeploymentInstance
|
163
|
+
def get_instance(payload)
|
164
|
+
DeploymentInstance.new(
|
165
|
+
@version,
|
166
|
+
payload,
|
167
|
+
service_sid: @solution[:service_sid],
|
168
|
+
environment_sid: @solution[:environment_sid],
|
169
|
+
)
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# Provide a user friendly representation
|
174
|
+
def to_s
|
175
|
+
'<Twilio.Serverless.V1.DeploymentPage>'
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# 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.
|
181
|
+
class DeploymentContext < InstanceContext
|
182
|
+
##
|
183
|
+
# Initialize the DeploymentContext
|
184
|
+
# @param [Version] version Version that contains the resource
|
185
|
+
# @param [String] service_sid The service_sid
|
186
|
+
# @param [String] environment_sid The environment_sid
|
187
|
+
# @param [String] sid The sid
|
188
|
+
# @return [DeploymentContext] DeploymentContext
|
189
|
+
def initialize(version, service_sid, environment_sid, sid)
|
190
|
+
super(version)
|
191
|
+
|
192
|
+
# Path Solution
|
193
|
+
@solution = {service_sid: service_sid, environment_sid: environment_sid, sid: sid, }
|
194
|
+
@uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Deployments/#{@solution[:sid]}"
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Fetch a DeploymentInstance
|
199
|
+
# @return [DeploymentInstance] Fetched DeploymentInstance
|
200
|
+
def fetch
|
201
|
+
params = Twilio::Values.of({})
|
202
|
+
|
203
|
+
payload = @version.fetch(
|
204
|
+
'GET',
|
205
|
+
@uri,
|
206
|
+
params,
|
207
|
+
)
|
208
|
+
|
209
|
+
DeploymentInstance.new(
|
210
|
+
@version,
|
211
|
+
payload,
|
212
|
+
service_sid: @solution[:service_sid],
|
213
|
+
environment_sid: @solution[:environment_sid],
|
214
|
+
sid: @solution[:sid],
|
215
|
+
)
|
216
|
+
end
|
217
|
+
|
218
|
+
##
|
219
|
+
# Provide a user friendly representation
|
220
|
+
def to_s
|
221
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
222
|
+
"#<Twilio.Serverless.V1.DeploymentContext #{context}>"
|
223
|
+
end
|
224
|
+
|
225
|
+
##
|
226
|
+
# Provide a detailed, user friendly representation
|
227
|
+
def inspect
|
228
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
229
|
+
"#<Twilio.Serverless.V1.DeploymentContext #{context}>"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# 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.
|
235
|
+
class DeploymentInstance < InstanceResource
|
236
|
+
##
|
237
|
+
# Initialize the DeploymentInstance
|
238
|
+
# @param [Version] version Version that contains the resource
|
239
|
+
# @param [Hash] payload payload that contains response from Twilio
|
240
|
+
# @param [String] service_sid The service_sid
|
241
|
+
# @param [String] environment_sid The environment_sid
|
242
|
+
# @param [String] sid The sid
|
243
|
+
# @return [DeploymentInstance] DeploymentInstance
|
244
|
+
def initialize(version, payload, service_sid: nil, environment_sid: nil, sid: nil)
|
245
|
+
super(version)
|
246
|
+
|
247
|
+
# Marshaled Properties
|
248
|
+
@properties = {
|
249
|
+
'sid' => payload['sid'],
|
250
|
+
'account_sid' => payload['account_sid'],
|
251
|
+
'service_sid' => payload['service_sid'],
|
252
|
+
'environment_sid' => payload['environment_sid'],
|
253
|
+
'build_sid' => payload['build_sid'],
|
254
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
255
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
256
|
+
'url' => payload['url'],
|
257
|
+
}
|
258
|
+
|
259
|
+
# Context
|
260
|
+
@instance_context = nil
|
261
|
+
@params = {
|
262
|
+
'service_sid' => service_sid,
|
263
|
+
'environment_sid' => environment_sid,
|
264
|
+
'sid' => sid || @properties['sid'],
|
265
|
+
}
|
266
|
+
end
|
267
|
+
|
268
|
+
##
|
269
|
+
# Generate an instance context for the instance, the context is capable of
|
270
|
+
# performing various actions. All instance actions are proxied to the context
|
271
|
+
# @return [DeploymentContext] DeploymentContext for this DeploymentInstance
|
272
|
+
def context
|
273
|
+
unless @instance_context
|
274
|
+
@instance_context = DeploymentContext.new(
|
275
|
+
@version,
|
276
|
+
@params['service_sid'],
|
277
|
+
@params['environment_sid'],
|
278
|
+
@params['sid'],
|
279
|
+
)
|
280
|
+
end
|
281
|
+
@instance_context
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# @return [String] The sid
|
286
|
+
def sid
|
287
|
+
@properties['sid']
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @return [String] The account_sid
|
292
|
+
def account_sid
|
293
|
+
@properties['account_sid']
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [String] The service_sid
|
298
|
+
def service_sid
|
299
|
+
@properties['service_sid']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [String] The environment_sid
|
304
|
+
def environment_sid
|
305
|
+
@properties['environment_sid']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [String] The build_sid
|
310
|
+
def build_sid
|
311
|
+
@properties['build_sid']
|
312
|
+
end
|
313
|
+
|
314
|
+
##
|
315
|
+
# @return [Time] The date_created
|
316
|
+
def date_created
|
317
|
+
@properties['date_created']
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# @return [Time] The date_updated
|
322
|
+
def date_updated
|
323
|
+
@properties['date_updated']
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# @return [String] The url
|
328
|
+
def url
|
329
|
+
@properties['url']
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# Fetch a DeploymentInstance
|
334
|
+
# @return [DeploymentInstance] Fetched DeploymentInstance
|
335
|
+
def fetch
|
336
|
+
context.fetch
|
337
|
+
end
|
338
|
+
|
339
|
+
##
|
340
|
+
# Provide a user friendly representation
|
341
|
+
def to_s
|
342
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
343
|
+
"<Twilio.Serverless.V1.DeploymentInstance #{values}>"
|
344
|
+
end
|
345
|
+
|
346
|
+
##
|
347
|
+
# Provide a detailed, user friendly representation
|
348
|
+
def inspect
|
349
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
350
|
+
"<Twilio.Serverless.V1.DeploymentInstance #{values}>"
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|