twilio-ruby 5.70.0 → 5.72.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/CHANGES.md +47 -0
- data/Makefile +6 -2
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +3 -3
- data/lib/twilio-ruby/rest/client.rb +14 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +4 -5
- data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +559 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +16 -0
- data/lib/twilio-ruby/rest/messaging.rb +8 -0
- data/lib/twilio-ruby/rest/microvisor/v1/app.rb +305 -0
- data/lib/twilio-ruby/rest/microvisor/v1/device.rb +332 -0
- data/lib/twilio-ruby/rest/microvisor/v1.rb +60 -0
- data/lib/twilio-ruby/rest/microvisor.rb +54 -0
- data/lib/twilio-ruby/rest/preview.rb +0 -25
- data/lib/twilio-ruby/rest/routes/v2/phone_number.rb +235 -0
- data/lib/twilio-ruby/rest/routes/v2/sip_domain.rb +231 -0
- data/lib/twilio-ruby/rest/routes/v2/trunk.rb +235 -0
- data/lib/twilio-ruby/rest/routes/v2.rb +76 -0
- data/lib/twilio-ruby/rest/routes.rb +62 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +16 -6
- data/lib/twilio-ruby/rest/verify/v2/safelist.rb +215 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -8
- data/lib/twilio-ruby/rest/verify/v2.rb +18 -0
- data/lib/twilio-ruby/rest/verify.rb +8 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_anonymize.rb +240 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +16 -0
- data/lib/twilio-ruby/security/request_validator.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +14 -8
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +0 -294
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +0 -275
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb +0 -249
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +0 -251
- data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +0 -234
- data/lib/twilio-ruby/rest/preview/bulk_exports.rb +0 -62
@@ -0,0 +1,305 @@
|
|
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 Microvisor < Domain
|
12
|
+
class V1 < 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 AppList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the AppList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [AppList] AppList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Apps"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists AppInstance 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 AppInstance 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 AppInstance 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 AppInstance 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 AppInstance
|
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
|
+
|
90
|
+
response = @version.page('GET', @uri, params: params)
|
91
|
+
|
92
|
+
AppPage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of AppInstance records from the API.
|
97
|
+
# Request is executed immediately.
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
99
|
+
# @return [Page] Page of AppInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
AppPage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Provide a user friendly representation
|
110
|
+
def to_s
|
111
|
+
'#<Twilio.Microvisor.V1.AppList>'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# 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.
|
117
|
+
class AppPage < Page
|
118
|
+
##
|
119
|
+
# Initialize the AppPage
|
120
|
+
# @param [Version] version Version that contains the resource
|
121
|
+
# @param [Response] response Response from the API
|
122
|
+
# @param [Hash] solution Path solution for the resource
|
123
|
+
# @return [AppPage] AppPage
|
124
|
+
def initialize(version, response, solution)
|
125
|
+
super(version, response)
|
126
|
+
|
127
|
+
# Path Solution
|
128
|
+
@solution = solution
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Build an instance of AppInstance
|
133
|
+
# @param [Hash] payload Payload response from the API
|
134
|
+
# @return [AppInstance] AppInstance
|
135
|
+
def get_instance(payload)
|
136
|
+
AppInstance.new(@version, payload, )
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# Provide a user friendly representation
|
141
|
+
def to_s
|
142
|
+
'<Twilio.Microvisor.V1.AppPage>'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# 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.
|
148
|
+
class AppContext < InstanceContext
|
149
|
+
##
|
150
|
+
# Initialize the AppContext
|
151
|
+
# @param [Version] version Version that contains the resource
|
152
|
+
# @param [String] sid A 34-character string that uniquely identifies this App.
|
153
|
+
# @return [AppContext] AppContext
|
154
|
+
def initialize(version, sid)
|
155
|
+
super(version)
|
156
|
+
|
157
|
+
# Path Solution
|
158
|
+
@solution = {sid: sid, }
|
159
|
+
@uri = "/Apps/#{@solution[:sid]}"
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# Fetch the AppInstance
|
164
|
+
# @return [AppInstance] Fetched AppInstance
|
165
|
+
def fetch
|
166
|
+
payload = @version.fetch('GET', @uri)
|
167
|
+
|
168
|
+
AppInstance.new(@version, payload, sid: @solution[:sid], )
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Delete the AppInstance
|
173
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
174
|
+
def delete
|
175
|
+
@version.delete('DELETE', @uri)
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Provide a user friendly representation
|
180
|
+
def to_s
|
181
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
182
|
+
"#<Twilio.Microvisor.V1.AppContext #{context}>"
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# Provide a detailed, user friendly representation
|
187
|
+
def inspect
|
188
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
189
|
+
"#<Twilio.Microvisor.V1.AppContext #{context}>"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
##
|
194
|
+
# 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.
|
195
|
+
class AppInstance < InstanceResource
|
196
|
+
##
|
197
|
+
# Initialize the AppInstance
|
198
|
+
# @param [Version] version Version that contains the resource
|
199
|
+
# @param [Hash] payload payload that contains response from Twilio
|
200
|
+
# @param [String] sid A 34-character string that uniquely identifies this App.
|
201
|
+
# @return [AppInstance] AppInstance
|
202
|
+
def initialize(version, payload, sid: nil)
|
203
|
+
super(version)
|
204
|
+
|
205
|
+
# Marshaled Properties
|
206
|
+
@properties = {
|
207
|
+
'sid' => payload['sid'],
|
208
|
+
'account_sid' => payload['account_sid'],
|
209
|
+
'hash' => payload['hash'],
|
210
|
+
'unique_name' => payload['unique_name'],
|
211
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
212
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
213
|
+
'url' => payload['url'],
|
214
|
+
}
|
215
|
+
|
216
|
+
# Context
|
217
|
+
@instance_context = nil
|
218
|
+
@params = {'sid' => sid || @properties['sid'], }
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# Generate an instance context for the instance, the context is capable of
|
223
|
+
# performing various actions. All instance actions are proxied to the context
|
224
|
+
# @return [AppContext] AppContext for this AppInstance
|
225
|
+
def context
|
226
|
+
unless @instance_context
|
227
|
+
@instance_context = AppContext.new(@version, @params['sid'], )
|
228
|
+
end
|
229
|
+
@instance_context
|
230
|
+
end
|
231
|
+
|
232
|
+
##
|
233
|
+
# @return [String] A string that uniquely identifies this App.
|
234
|
+
def sid
|
235
|
+
@properties['sid']
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# @return [String] The Account SID.
|
240
|
+
def account_sid
|
241
|
+
@properties['account_sid']
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# @return [String] App manifest hash represented as hash_algorithm:hash_value.
|
246
|
+
def hash
|
247
|
+
@properties['hash']
|
248
|
+
end
|
249
|
+
|
250
|
+
##
|
251
|
+
# @return [String] An developer-defined string that uniquely identifies the App.
|
252
|
+
def unique_name
|
253
|
+
@properties['unique_name']
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# @return [Time] The date that this App was created.
|
258
|
+
def date_created
|
259
|
+
@properties['date_created']
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# @return [Time] The date that this App was last updated.
|
264
|
+
def date_updated
|
265
|
+
@properties['date_updated']
|
266
|
+
end
|
267
|
+
|
268
|
+
##
|
269
|
+
# @return [String] The URL of this resource.
|
270
|
+
def url
|
271
|
+
@properties['url']
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Fetch the AppInstance
|
276
|
+
# @return [AppInstance] Fetched AppInstance
|
277
|
+
def fetch
|
278
|
+
context.fetch
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# Delete the AppInstance
|
283
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
284
|
+
def delete
|
285
|
+
context.delete
|
286
|
+
end
|
287
|
+
|
288
|
+
##
|
289
|
+
# Provide a user friendly representation
|
290
|
+
def to_s
|
291
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
292
|
+
"<Twilio.Microvisor.V1.AppInstance #{values}>"
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# Provide a detailed, user friendly representation
|
297
|
+
def inspect
|
298
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
299
|
+
"<Twilio.Microvisor.V1.AppInstance #{values}>"
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
@@ -0,0 +1,332 @@
|
|
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 Microvisor < Domain
|
12
|
+
class V1 < 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 DeviceList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the DeviceList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [DeviceList] DeviceList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Devices"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists DeviceInstance 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 DeviceInstance 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 DeviceInstance 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 DeviceInstance 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 DeviceInstance
|
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
|
+
|
90
|
+
response = @version.page('GET', @uri, params: params)
|
91
|
+
|
92
|
+
DevicePage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of DeviceInstance records from the API.
|
97
|
+
# Request is executed immediately.
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
99
|
+
# @return [Page] Page of DeviceInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
DevicePage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Provide a user friendly representation
|
110
|
+
def to_s
|
111
|
+
'#<Twilio.Microvisor.V1.DeviceList>'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# 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.
|
117
|
+
class DevicePage < Page
|
118
|
+
##
|
119
|
+
# Initialize the DevicePage
|
120
|
+
# @param [Version] version Version that contains the resource
|
121
|
+
# @param [Response] response Response from the API
|
122
|
+
# @param [Hash] solution Path solution for the resource
|
123
|
+
# @return [DevicePage] DevicePage
|
124
|
+
def initialize(version, response, solution)
|
125
|
+
super(version, response)
|
126
|
+
|
127
|
+
# Path Solution
|
128
|
+
@solution = solution
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Build an instance of DeviceInstance
|
133
|
+
# @param [Hash] payload Payload response from the API
|
134
|
+
# @return [DeviceInstance] DeviceInstance
|
135
|
+
def get_instance(payload)
|
136
|
+
DeviceInstance.new(@version, payload, )
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# Provide a user friendly representation
|
141
|
+
def to_s
|
142
|
+
'<Twilio.Microvisor.V1.DevicePage>'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# 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.
|
148
|
+
class DeviceContext < InstanceContext
|
149
|
+
##
|
150
|
+
# Initialize the DeviceContext
|
151
|
+
# @param [Version] version Version that contains the resource
|
152
|
+
# @param [String] sid A 34-character string that uniquely identifies this Device.
|
153
|
+
# @return [DeviceContext] DeviceContext
|
154
|
+
def initialize(version, sid)
|
155
|
+
super(version)
|
156
|
+
|
157
|
+
# Path Solution
|
158
|
+
@solution = {sid: sid, }
|
159
|
+
@uri = "/Devices/#{@solution[:sid]}"
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# Fetch the DeviceInstance
|
164
|
+
# @return [DeviceInstance] Fetched DeviceInstance
|
165
|
+
def fetch
|
166
|
+
payload = @version.fetch('GET', @uri)
|
167
|
+
|
168
|
+
DeviceInstance.new(@version, payload, sid: @solution[:sid], )
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Update the DeviceInstance
|
173
|
+
# @param [String] unique_name A unique and addressable name to be assigned to this
|
174
|
+
# Device by the developer. It may be used in place of the Device SID.
|
175
|
+
# @param [String] target_app The SID or unique name of the App to be targeted to
|
176
|
+
# the Device.
|
177
|
+
# @param [Boolean] logging_enabled A Boolean flag specifying whether to enable
|
178
|
+
# application logging. Logs will be enabled or extended for 24 hours.
|
179
|
+
# @return [DeviceInstance] Updated DeviceInstance
|
180
|
+
def update(unique_name: :unset, target_app: :unset, logging_enabled: :unset)
|
181
|
+
data = Twilio::Values.of({
|
182
|
+
'UniqueName' => unique_name,
|
183
|
+
'TargetApp' => target_app,
|
184
|
+
'LoggingEnabled' => logging_enabled,
|
185
|
+
})
|
186
|
+
|
187
|
+
payload = @version.update('POST', @uri, data: data)
|
188
|
+
|
189
|
+
DeviceInstance.new(@version, payload, sid: @solution[:sid], )
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# Provide a user friendly representation
|
194
|
+
def to_s
|
195
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
196
|
+
"#<Twilio.Microvisor.V1.DeviceContext #{context}>"
|
197
|
+
end
|
198
|
+
|
199
|
+
##
|
200
|
+
# Provide a detailed, user friendly representation
|
201
|
+
def inspect
|
202
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
203
|
+
"#<Twilio.Microvisor.V1.DeviceContext #{context}>"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# 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.
|
209
|
+
class DeviceInstance < InstanceResource
|
210
|
+
##
|
211
|
+
# Initialize the DeviceInstance
|
212
|
+
# @param [Version] version Version that contains the resource
|
213
|
+
# @param [Hash] payload payload that contains response from Twilio
|
214
|
+
# @param [String] sid A 34-character string that uniquely identifies this Device.
|
215
|
+
# @return [DeviceInstance] DeviceInstance
|
216
|
+
def initialize(version, payload, sid: nil)
|
217
|
+
super(version)
|
218
|
+
|
219
|
+
# Marshaled Properties
|
220
|
+
@properties = {
|
221
|
+
'sid' => payload['sid'],
|
222
|
+
'unique_name' => payload['unique_name'],
|
223
|
+
'account_sid' => payload['account_sid'],
|
224
|
+
'app' => payload['app'],
|
225
|
+
'logging' => payload['logging'],
|
226
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
227
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
228
|
+
'url' => payload['url'],
|
229
|
+
}
|
230
|
+
|
231
|
+
# Context
|
232
|
+
@instance_context = nil
|
233
|
+
@params = {'sid' => sid || @properties['sid'], }
|
234
|
+
end
|
235
|
+
|
236
|
+
##
|
237
|
+
# Generate an instance context for the instance, the context is capable of
|
238
|
+
# performing various actions. All instance actions are proxied to the context
|
239
|
+
# @return [DeviceContext] DeviceContext for this DeviceInstance
|
240
|
+
def context
|
241
|
+
unless @instance_context
|
242
|
+
@instance_context = DeviceContext.new(@version, @params['sid'], )
|
243
|
+
end
|
244
|
+
@instance_context
|
245
|
+
end
|
246
|
+
|
247
|
+
##
|
248
|
+
# @return [String] A string that uniquely identifies this Device.
|
249
|
+
def sid
|
250
|
+
@properties['sid']
|
251
|
+
end
|
252
|
+
|
253
|
+
##
|
254
|
+
# @return [String] A developer-defined string that uniquely identifies the Device.
|
255
|
+
def unique_name
|
256
|
+
@properties['unique_name']
|
257
|
+
end
|
258
|
+
|
259
|
+
##
|
260
|
+
# @return [String] Account SID.
|
261
|
+
def account_sid
|
262
|
+
@properties['account_sid']
|
263
|
+
end
|
264
|
+
|
265
|
+
##
|
266
|
+
# @return [Hash] Information about the target App and the App reported by this Device.
|
267
|
+
def app
|
268
|
+
@properties['app']
|
269
|
+
end
|
270
|
+
|
271
|
+
##
|
272
|
+
# @return [Hash] Object specifying whether application logging is enabled for this Device.
|
273
|
+
def logging
|
274
|
+
@properties['logging']
|
275
|
+
end
|
276
|
+
|
277
|
+
##
|
278
|
+
# @return [Time] The date that this Device was created.
|
279
|
+
def date_created
|
280
|
+
@properties['date_created']
|
281
|
+
end
|
282
|
+
|
283
|
+
##
|
284
|
+
# @return [Time] The date that this Device was last updated.
|
285
|
+
def date_updated
|
286
|
+
@properties['date_updated']
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# @return [String] The URL of this resource.
|
291
|
+
def url
|
292
|
+
@properties['url']
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# Fetch the DeviceInstance
|
297
|
+
# @return [DeviceInstance] Fetched DeviceInstance
|
298
|
+
def fetch
|
299
|
+
context.fetch
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# Update the DeviceInstance
|
304
|
+
# @param [String] unique_name A unique and addressable name to be assigned to this
|
305
|
+
# Device by the developer. It may be used in place of the Device SID.
|
306
|
+
# @param [String] target_app The SID or unique name of the App to be targeted to
|
307
|
+
# the Device.
|
308
|
+
# @param [Boolean] logging_enabled A Boolean flag specifying whether to enable
|
309
|
+
# application logging. Logs will be enabled or extended for 24 hours.
|
310
|
+
# @return [DeviceInstance] Updated DeviceInstance
|
311
|
+
def update(unique_name: :unset, target_app: :unset, logging_enabled: :unset)
|
312
|
+
context.update(unique_name: unique_name, target_app: target_app, logging_enabled: logging_enabled, )
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# Provide a user friendly representation
|
317
|
+
def to_s
|
318
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
319
|
+
"<Twilio.Microvisor.V1.DeviceInstance #{values}>"
|
320
|
+
end
|
321
|
+
|
322
|
+
##
|
323
|
+
# Provide a detailed, user friendly representation
|
324
|
+
def inspect
|
325
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
326
|
+
"<Twilio.Microvisor.V1.DeviceInstance #{values}>"
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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 Microvisor
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of Microvisor
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@apps = nil
|
19
|
+
@devices = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @param [String] sid A 34-character string that uniquely identifies this App.
|
24
|
+
# @return [Twilio::REST::Microvisor::V1::AppContext] if sid was passed.
|
25
|
+
# @return [Twilio::REST::Microvisor::V1::AppList]
|
26
|
+
def apps(sid=:unset)
|
27
|
+
if sid.nil?
|
28
|
+
raise ArgumentError, 'sid cannot be nil'
|
29
|
+
end
|
30
|
+
if sid == :unset
|
31
|
+
@apps ||= AppList.new self
|
32
|
+
else
|
33
|
+
AppContext.new(self, sid)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# @param [String] sid A 34-character string that uniquely identifies this Device.
|
39
|
+
# @return [Twilio::REST::Microvisor::V1::DeviceContext] if sid was passed.
|
40
|
+
# @return [Twilio::REST::Microvisor::V1::DeviceList]
|
41
|
+
def devices(sid=:unset)
|
42
|
+
if sid.nil?
|
43
|
+
raise ArgumentError, 'sid cannot be nil'
|
44
|
+
end
|
45
|
+
if sid == :unset
|
46
|
+
@devices ||= DeviceList.new self
|
47
|
+
else
|
48
|
+
DeviceContext.new(self, sid)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Provide a user friendly representation
|
54
|
+
def to_s
|
55
|
+
'<Twilio::REST::Microvisor::V1>'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|