twilio-ruby 5.31.5 → 5.31.6

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/CHANGES.md +31 -0
  4. data/Gemfile +0 -9
  5. data/Makefile +5 -14
  6. data/README.md +2 -2
  7. data/Rakefile +0 -54
  8. data/githooks/pre-commit +0 -0
  9. data/lib/twilio-ruby/rest/authy/v1/service.rb +12 -2
  10. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +0 -7
  11. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +0 -7
  12. data/lib/twilio-ruby/rest/client.rb +7 -0
  13. data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +1 -1
  14. data/lib/twilio-ruby/rest/preview.rb +0 -6
  15. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +8 -2
  16. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +113 -8
  17. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -7
  18. data/lib/twilio-ruby/rest/serverless/v1/service.rb +23 -4
  19. data/lib/twilio-ruby/rest/supersim.rb +70 -0
  20. data/lib/twilio-ruby/rest/supersim/v1.rb +80 -0
  21. data/lib/twilio-ruby/rest/supersim/v1/command.rb +381 -0
  22. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +390 -0
  23. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +380 -0
  24. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +274 -0
  25. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +4 -3
  26. data/lib/twilio-ruby/version.rb +1 -1
  27. data/spec/integration/api/v2010/account/call/payment_spec.rb +3 -3
  28. data/spec/integration/api/v2010/account/message_spec.rb +1 -1
  29. data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +0 -5
  30. data/spec/integration/authy/v1/service/entity/factor_spec.rb +0 -4
  31. data/spec/integration/authy/v1/service_spec.rb +4 -0
  32. data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +9 -3
  33. data/spec/integration/preview/bulk_exports/export/day_spec.rb +67 -8
  34. data/spec/integration/serverless/v1/service_spec.rb +3 -0
  35. data/spec/integration/supersim/v1/command_spec.rb +186 -0
  36. data/spec/integration/supersim/v1/fleet_spec.rb +208 -0
  37. data/spec/integration/supersim/v1/sim_spec.rb +231 -0
  38. data/spec/integration/supersim/v1/usage_record_spec.rb +203 -0
  39. data/spec/integration/verify/v2/service/verification_spec.rb +42 -30
  40. data/spec/integration/video/v1/room/room_participant/room_participant_subscribe_rule_spec.rb +1 -1
  41. data/spec/integration/voice/v1/dialing_permissions/settings_spec.rb +1 -1
  42. data/twilio-ruby.gemspec +5 -0
  43. metadata +86 -5
  44. data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +0 -146
  45. data/spec/integration/preview/trusted_comms/device_spec.rb +0 -45
@@ -0,0 +1,390 @@
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
+ ##
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 FleetList < ListResource
16
+ ##
17
+ # Initialize the FleetList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [FleetList] FleetList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/Fleets"
26
+ end
27
+
28
+ ##
29
+ # Retrieve a single page of FleetInstance records from the API.
30
+ # Request is executed immediately.
31
+ # @param [String] unique_name An application-defined string that uniquely
32
+ # identifies the resource. It can be used in place of the resource's `sid` in the
33
+ # URL to address the resource.
34
+ # @param [Boolean] data_enabled Defines whether SIMs in the Fleet are capable of
35
+ # using 2G/3G/4G/LTE/CAT-M/NB-IoT data connectivity
36
+ # @param [Boolean] commands_enabled Defines whether SIMs in the Fleet are capable
37
+ # of sending and receiving Commands via SMS.
38
+ # @param [String] commands_url The URL that will receive a webhook when a SIM in
39
+ # the Fleet originates a machine-to-machine Command. Your server should respond
40
+ # with an HTTP status code in the 200 range; any response body will be ignored.
41
+ # @param [String] commands_method A string representing the HTTP method to use
42
+ # when making a request to `commands_url`. Can be one of POST or GET. Defaults to
43
+ # POST.
44
+ # @return [FleetInstance] Newly created FleetInstance
45
+ def create(unique_name: :unset, data_enabled: :unset, commands_enabled: :unset, commands_url: :unset, commands_method: :unset)
46
+ data = Twilio::Values.of({
47
+ 'UniqueName' => unique_name,
48
+ 'DataEnabled' => data_enabled,
49
+ 'CommandsEnabled' => commands_enabled,
50
+ 'CommandsUrl' => commands_url,
51
+ 'CommandsMethod' => commands_method,
52
+ })
53
+
54
+ payload = @version.create(
55
+ 'POST',
56
+ @uri,
57
+ data: data
58
+ )
59
+
60
+ FleetInstance.new(@version, payload, )
61
+ end
62
+
63
+ ##
64
+ # Lists FleetInstance records from the API as a list.
65
+ # Unlike stream(), this operation is eager and will load `limit` records into
66
+ # memory before returning.
67
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
68
+ # guarantees to never return more than limit. Default is no limit
69
+ # @param [Integer] page_size Number of records to fetch per request, when
70
+ # not set will use the default value of 50 records. If no page_size is defined
71
+ # but a limit is defined, stream() will attempt to read the limit with the most
72
+ # efficient page size, i.e. min(limit, 1000)
73
+ # @return [Array] Array of up to limit results
74
+ def list(limit: nil, page_size: nil)
75
+ self.stream(limit: limit, page_size: page_size).entries
76
+ end
77
+
78
+ ##
79
+ # Streams FleetInstance records from the API as an Enumerable.
80
+ # This operation lazily loads records as efficiently as possible until the limit
81
+ # is reached.
82
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
83
+ # guarantees to never return more than limit. Default is no limit.
84
+ # @param [Integer] page_size Number of records to fetch per request, when
85
+ # not set will use the default value of 50 records. If no page_size is defined
86
+ # but a limit is defined, stream() will attempt to read the limit with the most
87
+ # efficient page size, i.e. min(limit, 1000)
88
+ # @return [Enumerable] Enumerable that will yield up to limit results
89
+ def stream(limit: nil, page_size: nil)
90
+ limits = @version.read_limits(limit, page_size)
91
+
92
+ page = self.page(page_size: limits[:page_size], )
93
+
94
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
95
+ end
96
+
97
+ ##
98
+ # When passed a block, yields FleetInstance records from the API.
99
+ # This operation lazily loads records as efficiently as possible until the limit
100
+ # is reached.
101
+ def each
102
+ limits = @version.read_limits
103
+
104
+ page = self.page(page_size: limits[:page_size], )
105
+
106
+ @version.stream(page,
107
+ limit: limits[:limit],
108
+ page_limit: limits[:page_limit]).each {|x| yield x}
109
+ end
110
+
111
+ ##
112
+ # Retrieve a single page of FleetInstance records from the API.
113
+ # Request is executed immediately.
114
+ # @param [String] page_token PageToken provided by the API
115
+ # @param [Integer] page_number Page Number, this value is simply for client state
116
+ # @param [Integer] page_size Number of records to return, defaults to 50
117
+ # @return [Page] Page of FleetInstance
118
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
119
+ params = Twilio::Values.of({
120
+ 'PageToken' => page_token,
121
+ 'Page' => page_number,
122
+ 'PageSize' => page_size,
123
+ })
124
+ response = @version.page(
125
+ 'GET',
126
+ @uri,
127
+ params
128
+ )
129
+ FleetPage.new(@version, response, @solution)
130
+ end
131
+
132
+ ##
133
+ # Retrieve a single page of FleetInstance records from the API.
134
+ # Request is executed immediately.
135
+ # @param [String] target_url API-generated URL for the requested results page
136
+ # @return [Page] Page of FleetInstance
137
+ def get_page(target_url)
138
+ response = @version.domain.request(
139
+ 'GET',
140
+ target_url
141
+ )
142
+ FleetPage.new(@version, response, @solution)
143
+ end
144
+
145
+ ##
146
+ # Provide a user friendly representation
147
+ def to_s
148
+ '#<Twilio.Supersim.V1.FleetList>'
149
+ end
150
+ end
151
+
152
+ ##
153
+ # 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.
154
+ class FleetPage < Page
155
+ ##
156
+ # Initialize the FleetPage
157
+ # @param [Version] version Version that contains the resource
158
+ # @param [Response] response Response from the API
159
+ # @param [Hash] solution Path solution for the resource
160
+ # @return [FleetPage] FleetPage
161
+ def initialize(version, response, solution)
162
+ super(version, response)
163
+
164
+ # Path Solution
165
+ @solution = solution
166
+ end
167
+
168
+ ##
169
+ # Build an instance of FleetInstance
170
+ # @param [Hash] payload Payload response from the API
171
+ # @return [FleetInstance] FleetInstance
172
+ def get_instance(payload)
173
+ FleetInstance.new(@version, payload, )
174
+ end
175
+
176
+ ##
177
+ # Provide a user friendly representation
178
+ def to_s
179
+ '<Twilio.Supersim.V1.FleetPage>'
180
+ end
181
+ end
182
+
183
+ ##
184
+ # 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.
185
+ class FleetContext < InstanceContext
186
+ ##
187
+ # Initialize the FleetContext
188
+ # @param [Version] version Version that contains the resource
189
+ # @param [String] sid The SID of the Fleet resource to fetch.
190
+ # @return [FleetContext] FleetContext
191
+ def initialize(version, sid)
192
+ super(version)
193
+
194
+ # Path Solution
195
+ @solution = {sid: sid, }
196
+ @uri = "/Fleets/#{@solution[:sid]}"
197
+ end
198
+
199
+ ##
200
+ # Fetch a FleetInstance
201
+ # @return [FleetInstance] Fetched FleetInstance
202
+ def fetch
203
+ params = Twilio::Values.of({})
204
+
205
+ payload = @version.fetch(
206
+ 'GET',
207
+ @uri,
208
+ params,
209
+ )
210
+
211
+ FleetInstance.new(@version, payload, sid: @solution[:sid], )
212
+ end
213
+
214
+ ##
215
+ # Update the FleetInstance
216
+ # @param [String] unique_name An application-defined string that uniquely
217
+ # identifies the resource. It can be used in place of the resource's `sid` in the
218
+ # URL to address the resource.
219
+ # @return [FleetInstance] Updated FleetInstance
220
+ def update(unique_name: :unset)
221
+ data = Twilio::Values.of({'UniqueName' => unique_name, })
222
+
223
+ payload = @version.update(
224
+ 'POST',
225
+ @uri,
226
+ data: data,
227
+ )
228
+
229
+ FleetInstance.new(@version, payload, sid: @solution[:sid], )
230
+ end
231
+
232
+ ##
233
+ # Provide a user friendly representation
234
+ def to_s
235
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
236
+ "#<Twilio.Supersim.V1.FleetContext #{context}>"
237
+ end
238
+
239
+ ##
240
+ # Provide a detailed, user friendly representation
241
+ def inspect
242
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
243
+ "#<Twilio.Supersim.V1.FleetContext #{context}>"
244
+ end
245
+ end
246
+
247
+ ##
248
+ # 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.
249
+ class FleetInstance < InstanceResource
250
+ ##
251
+ # Initialize the FleetInstance
252
+ # @param [Version] version Version that contains the resource
253
+ # @param [Hash] payload payload that contains response from Twilio
254
+ # @param [String] sid The SID of the Fleet resource to fetch.
255
+ # @return [FleetInstance] FleetInstance
256
+ def initialize(version, payload, sid: nil)
257
+ super(version)
258
+
259
+ # Marshaled Properties
260
+ @properties = {
261
+ 'account_sid' => payload['account_sid'],
262
+ 'sid' => payload['sid'],
263
+ 'unique_name' => payload['unique_name'],
264
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
265
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
266
+ 'url' => payload['url'],
267
+ 'data_enabled' => payload['data_enabled'],
268
+ 'data_metering' => payload['data_metering'],
269
+ 'commands_enabled' => payload['commands_enabled'],
270
+ 'commands_url' => payload['commands_url'],
271
+ 'commands_method' => payload['commands_method'],
272
+ }
273
+
274
+ # Context
275
+ @instance_context = nil
276
+ @params = {'sid' => sid || @properties['sid'], }
277
+ end
278
+
279
+ ##
280
+ # Generate an instance context for the instance, the context is capable of
281
+ # performing various actions. All instance actions are proxied to the context
282
+ # @return [FleetContext] FleetContext for this FleetInstance
283
+ def context
284
+ unless @instance_context
285
+ @instance_context = FleetContext.new(@version, @params['sid'], )
286
+ end
287
+ @instance_context
288
+ end
289
+
290
+ ##
291
+ # @return [String] The SID of the Account that created the resource
292
+ def account_sid
293
+ @properties['account_sid']
294
+ end
295
+
296
+ ##
297
+ # @return [String] The unique string that identifies the resource
298
+ def sid
299
+ @properties['sid']
300
+ end
301
+
302
+ ##
303
+ # @return [String] An application-defined string that uniquely identifies the resource
304
+ def unique_name
305
+ @properties['unique_name']
306
+ end
307
+
308
+ ##
309
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
310
+ def date_created
311
+ @properties['date_created']
312
+ end
313
+
314
+ ##
315
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
316
+ def date_updated
317
+ @properties['date_updated']
318
+ end
319
+
320
+ ##
321
+ # @return [String] The absolute URL of the Fleet resource
322
+ def url
323
+ @properties['url']
324
+ end
325
+
326
+ ##
327
+ # @return [Boolean] Defines whether SIMs in the Fleet are capable of using data connectivity
328
+ def data_enabled
329
+ @properties['data_enabled']
330
+ end
331
+
332
+ ##
333
+ # @return [fleet.DataMetering] The model by which a SIM is metered and billed
334
+ def data_metering
335
+ @properties['data_metering']
336
+ end
337
+
338
+ ##
339
+ # @return [Boolean] Defines whether SIMs in the Fleet are capable of sending and receiving Commands via SMS
340
+ def commands_enabled
341
+ @properties['commands_enabled']
342
+ end
343
+
344
+ ##
345
+ # @return [String] The URL that will receive a webhook when a SIM in the Fleet originates a machine-to-machine Command
346
+ def commands_url
347
+ @properties['commands_url']
348
+ end
349
+
350
+ ##
351
+ # @return [String] A string representing the HTTP method to use when making a request to `commands_url`
352
+ def commands_method
353
+ @properties['commands_method']
354
+ end
355
+
356
+ ##
357
+ # Fetch a FleetInstance
358
+ # @return [FleetInstance] Fetched FleetInstance
359
+ def fetch
360
+ context.fetch
361
+ end
362
+
363
+ ##
364
+ # Update the FleetInstance
365
+ # @param [String] unique_name An application-defined string that uniquely
366
+ # identifies the resource. It can be used in place of the resource's `sid` in the
367
+ # URL to address the resource.
368
+ # @return [FleetInstance] Updated FleetInstance
369
+ def update(unique_name: :unset)
370
+ context.update(unique_name: unique_name, )
371
+ end
372
+
373
+ ##
374
+ # Provide a user friendly representation
375
+ def to_s
376
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
377
+ "<Twilio.Supersim.V1.FleetInstance #{values}>"
378
+ end
379
+
380
+ ##
381
+ # Provide a detailed, user friendly representation
382
+ def inspect
383
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
384
+ "<Twilio.Supersim.V1.FleetInstance #{values}>"
385
+ end
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
@@ -0,0 +1,380 @@
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
+ ##
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 SimList < ListResource
16
+ ##
17
+ # Initialize the SimList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [SimList] SimList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/Sims"
26
+ end
27
+
28
+ ##
29
+ # Lists SimInstance 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 [sim.Status] status The status of the Sim resources to read. Can be
33
+ # `new`, `active`, `deactivated`, `inactive`, or `scheduled`.
34
+ # @param [String] fleet The SID or unique name of the Fleet to which a list of
35
+ # Sims are assigned.
36
+ # @param [String] iccid The
37
+ # [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID)
38
+ # associated with a Super SIM to filter the list by. Passing this parameter will
39
+ # always return a list containing zero or one SIMs.
40
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
41
+ # guarantees to never return more than limit. Default is no limit
42
+ # @param [Integer] page_size Number of records to fetch per request, when
43
+ # not set will use the default value of 50 records. If no page_size is defined
44
+ # but a limit is defined, stream() will attempt to read the limit with the most
45
+ # efficient page size, i.e. min(limit, 1000)
46
+ # @return [Array] Array of up to limit results
47
+ def list(status: :unset, fleet: :unset, iccid: :unset, limit: nil, page_size: nil)
48
+ self.stream(status: status, fleet: fleet, iccid: iccid, limit: limit, page_size: page_size).entries
49
+ end
50
+
51
+ ##
52
+ # Streams SimInstance records from the API as an Enumerable.
53
+ # This operation lazily loads records as efficiently as possible until the limit
54
+ # is reached.
55
+ # @param [sim.Status] status The status of the Sim resources to read. Can be
56
+ # `new`, `active`, `deactivated`, `inactive`, or `scheduled`.
57
+ # @param [String] fleet The SID or unique name of the Fleet to which a list of
58
+ # Sims are assigned.
59
+ # @param [String] iccid The
60
+ # [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID)
61
+ # associated with a Super SIM to filter the list by. Passing this parameter will
62
+ # always return a list containing zero or one SIMs.
63
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
64
+ # guarantees to never return more than limit. Default is no limit.
65
+ # @param [Integer] page_size Number of records to fetch per request, when
66
+ # not set will use the default value of 50 records. If no page_size is defined
67
+ # but a limit is defined, stream() will attempt to read the limit with the most
68
+ # efficient page size, i.e. min(limit, 1000)
69
+ # @return [Enumerable] Enumerable that will yield up to limit results
70
+ def stream(status: :unset, fleet: :unset, iccid: :unset, limit: nil, page_size: nil)
71
+ limits = @version.read_limits(limit, page_size)
72
+
73
+ page = self.page(status: status, fleet: fleet, iccid: iccid, page_size: limits[:page_size], )
74
+
75
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
76
+ end
77
+
78
+ ##
79
+ # When passed a block, yields SimInstance records from the API.
80
+ # This operation lazily loads records as efficiently as possible until the limit
81
+ # is reached.
82
+ def each
83
+ limits = @version.read_limits
84
+
85
+ page = self.page(page_size: limits[:page_size], )
86
+
87
+ @version.stream(page,
88
+ limit: limits[:limit],
89
+ page_limit: limits[:page_limit]).each {|x| yield x}
90
+ end
91
+
92
+ ##
93
+ # Retrieve a single page of SimInstance records from the API.
94
+ # Request is executed immediately.
95
+ # @param [sim.Status] status The status of the Sim resources to read. Can be
96
+ # `new`, `active`, `deactivated`, `inactive`, or `scheduled`.
97
+ # @param [String] fleet The SID or unique name of the Fleet to which a list of
98
+ # Sims are assigned.
99
+ # @param [String] iccid The
100
+ # [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID)
101
+ # associated with a Super SIM to filter the list by. Passing this parameter will
102
+ # always return a list containing zero or one SIMs.
103
+ # @param [String] page_token PageToken provided by the API
104
+ # @param [Integer] page_number Page Number, this value is simply for client state
105
+ # @param [Integer] page_size Number of records to return, defaults to 50
106
+ # @return [Page] Page of SimInstance
107
+ def page(status: :unset, fleet: :unset, iccid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
108
+ params = Twilio::Values.of({
109
+ 'Status' => status,
110
+ 'Fleet' => fleet,
111
+ 'Iccid' => iccid,
112
+ 'PageToken' => page_token,
113
+ 'Page' => page_number,
114
+ 'PageSize' => page_size,
115
+ })
116
+ response = @version.page(
117
+ 'GET',
118
+ @uri,
119
+ params
120
+ )
121
+ SimPage.new(@version, response, @solution)
122
+ end
123
+
124
+ ##
125
+ # Retrieve a single page of SimInstance records from the API.
126
+ # Request is executed immediately.
127
+ # @param [String] target_url API-generated URL for the requested results page
128
+ # @return [Page] Page of SimInstance
129
+ def get_page(target_url)
130
+ response = @version.domain.request(
131
+ 'GET',
132
+ target_url
133
+ )
134
+ SimPage.new(@version, response, @solution)
135
+ end
136
+
137
+ ##
138
+ # Provide a user friendly representation
139
+ def to_s
140
+ '#<Twilio.Supersim.V1.SimList>'
141
+ end
142
+ end
143
+
144
+ ##
145
+ # 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.
146
+ class SimPage < Page
147
+ ##
148
+ # Initialize the SimPage
149
+ # @param [Version] version Version that contains the resource
150
+ # @param [Response] response Response from the API
151
+ # @param [Hash] solution Path solution for the resource
152
+ # @return [SimPage] SimPage
153
+ def initialize(version, response, solution)
154
+ super(version, response)
155
+
156
+ # Path Solution
157
+ @solution = solution
158
+ end
159
+
160
+ ##
161
+ # Build an instance of SimInstance
162
+ # @param [Hash] payload Payload response from the API
163
+ # @return [SimInstance] SimInstance
164
+ def get_instance(payload)
165
+ SimInstance.new(@version, payload, )
166
+ end
167
+
168
+ ##
169
+ # Provide a user friendly representation
170
+ def to_s
171
+ '<Twilio.Supersim.V1.SimPage>'
172
+ end
173
+ end
174
+
175
+ ##
176
+ # 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.
177
+ class SimContext < InstanceContext
178
+ ##
179
+ # Initialize the SimContext
180
+ # @param [Version] version Version that contains the resource
181
+ # @param [String] sid The SID of the Sim resource to fetch.
182
+ # @return [SimContext] SimContext
183
+ def initialize(version, sid)
184
+ super(version)
185
+
186
+ # Path Solution
187
+ @solution = {sid: sid, }
188
+ @uri = "/Sims/#{@solution[:sid]}"
189
+ end
190
+
191
+ ##
192
+ # Fetch a SimInstance
193
+ # @return [SimInstance] Fetched SimInstance
194
+ def fetch
195
+ params = Twilio::Values.of({})
196
+
197
+ payload = @version.fetch(
198
+ 'GET',
199
+ @uri,
200
+ params,
201
+ )
202
+
203
+ SimInstance.new(@version, payload, sid: @solution[:sid], )
204
+ end
205
+
206
+ ##
207
+ # Update the SimInstance
208
+ # @param [String] unique_name An application-defined string that uniquely
209
+ # identifies the resource. It can be used in place of the resource's `sid` in the
210
+ # URL to address the resource.
211
+ # @param [sim.StatusUpdate] status The new status of the resource. Can be:
212
+ # `active`, `deactivated`, or `inactive`. See the [Super SIM Status
213
+ # Values](https://www.twilio.com/docs/iot/supersim/api/sim-resource#status-values)
214
+ # for more info.
215
+ # @param [String] fleet The SID or unique name of the Fleet to which the SIM
216
+ # resource should be assigned.
217
+ # @return [SimInstance] Updated SimInstance
218
+ def update(unique_name: :unset, status: :unset, fleet: :unset)
219
+ data = Twilio::Values.of({'UniqueName' => unique_name, 'Status' => status, 'Fleet' => fleet, })
220
+
221
+ payload = @version.update(
222
+ 'POST',
223
+ @uri,
224
+ data: data,
225
+ )
226
+
227
+ SimInstance.new(@version, payload, sid: @solution[:sid], )
228
+ end
229
+
230
+ ##
231
+ # Provide a user friendly representation
232
+ def to_s
233
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
234
+ "#<Twilio.Supersim.V1.SimContext #{context}>"
235
+ end
236
+
237
+ ##
238
+ # Provide a detailed, user friendly representation
239
+ def inspect
240
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
241
+ "#<Twilio.Supersim.V1.SimContext #{context}>"
242
+ end
243
+ end
244
+
245
+ ##
246
+ # 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.
247
+ class SimInstance < InstanceResource
248
+ ##
249
+ # Initialize the SimInstance
250
+ # @param [Version] version Version that contains the resource
251
+ # @param [Hash] payload payload that contains response from Twilio
252
+ # @param [String] sid The SID of the Sim resource to fetch.
253
+ # @return [SimInstance] SimInstance
254
+ def initialize(version, payload, sid: nil)
255
+ super(version)
256
+
257
+ # Marshaled Properties
258
+ @properties = {
259
+ 'sid' => payload['sid'],
260
+ 'unique_name' => payload['unique_name'],
261
+ 'account_sid' => payload['account_sid'],
262
+ 'iccid' => payload['iccid'],
263
+ 'status' => payload['status'],
264
+ 'fleet_sid' => payload['fleet_sid'],
265
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
266
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
267
+ 'url' => payload['url'],
268
+ }
269
+
270
+ # Context
271
+ @instance_context = nil
272
+ @params = {'sid' => sid || @properties['sid'], }
273
+ end
274
+
275
+ ##
276
+ # Generate an instance context for the instance, the context is capable of
277
+ # performing various actions. All instance actions are proxied to the context
278
+ # @return [SimContext] SimContext for this SimInstance
279
+ def context
280
+ unless @instance_context
281
+ @instance_context = SimContext.new(@version, @params['sid'], )
282
+ end
283
+ @instance_context
284
+ end
285
+
286
+ ##
287
+ # @return [String] The unique string that identifies the resource
288
+ def sid
289
+ @properties['sid']
290
+ end
291
+
292
+ ##
293
+ # @return [String] An application-defined string that uniquely identifies the resource
294
+ def unique_name
295
+ @properties['unique_name']
296
+ end
297
+
298
+ ##
299
+ # @return [String] The SID of the Account that the Super SIM belongs to
300
+ def account_sid
301
+ @properties['account_sid']
302
+ end
303
+
304
+ ##
305
+ # @return [String] The ICCID associated with the SIM
306
+ def iccid
307
+ @properties['iccid']
308
+ end
309
+
310
+ ##
311
+ # @return [sim.Status] The status of the Super SIM
312
+ def status
313
+ @properties['status']
314
+ end
315
+
316
+ ##
317
+ # @return [String] The unique ID of the Fleet configured for this SIM
318
+ def fleet_sid
319
+ @properties['fleet_sid']
320
+ end
321
+
322
+ ##
323
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
324
+ def date_created
325
+ @properties['date_created']
326
+ end
327
+
328
+ ##
329
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
330
+ def date_updated
331
+ @properties['date_updated']
332
+ end
333
+
334
+ ##
335
+ # @return [String] The absolute URL of the Sim Resource
336
+ def url
337
+ @properties['url']
338
+ end
339
+
340
+ ##
341
+ # Fetch a SimInstance
342
+ # @return [SimInstance] Fetched SimInstance
343
+ def fetch
344
+ context.fetch
345
+ end
346
+
347
+ ##
348
+ # Update the SimInstance
349
+ # @param [String] unique_name An application-defined string that uniquely
350
+ # identifies the resource. It can be used in place of the resource's `sid` in the
351
+ # URL to address the resource.
352
+ # @param [sim.StatusUpdate] status The new status of the resource. Can be:
353
+ # `active`, `deactivated`, or `inactive`. See the [Super SIM Status
354
+ # Values](https://www.twilio.com/docs/iot/supersim/api/sim-resource#status-values)
355
+ # for more info.
356
+ # @param [String] fleet The SID or unique name of the Fleet to which the SIM
357
+ # resource should be assigned.
358
+ # @return [SimInstance] Updated SimInstance
359
+ def update(unique_name: :unset, status: :unset, fleet: :unset)
360
+ context.update(unique_name: unique_name, status: status, fleet: fleet, )
361
+ end
362
+
363
+ ##
364
+ # Provide a user friendly representation
365
+ def to_s
366
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
367
+ "<Twilio.Supersim.V1.SimInstance #{values}>"
368
+ end
369
+
370
+ ##
371
+ # Provide a detailed, user friendly representation
372
+ def inspect
373
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
374
+ "<Twilio.Supersim.V1.SimInstance #{values}>"
375
+ end
376
+ end
377
+ end
378
+ end
379
+ end
380
+ end