twilio-ruby 5.61.1 → 5.63.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test-and-deploy.yml +124 -0
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +84 -21
  5. data/CHANGES.md +96 -0
  6. data/Makefile +3 -6
  7. data/README.md +4 -4
  8. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +19 -5
  10. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  11. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  12. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  13. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +33 -18
  14. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +483 -0
  15. data/lib/twilio-ruby/rest/insights/v1/conference.rb +484 -0
  16. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  17. data/lib/twilio-ruby/rest/insights/v1.rb +23 -0
  18. data/lib/twilio-ruby/rest/insights.rb +14 -0
  19. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +14 -1
  20. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +23 -0
  21. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +80 -0
  22. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  23. data/lib/twilio-ruby/rest/supersim/v1/ip_command.rb +416 -0
  24. data/lib/twilio-ruby/rest/supersim/v1.rb +32 -0
  25. data/lib/twilio-ruby/rest/supersim.rb +18 -0
  26. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +138 -10
  27. data/lib/twilio-ruby/rest/verify/v2/service.rb +8 -2
  28. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -0
  29. data/lib/twilio-ruby/rest/video/v1/recording.rb +7 -0
  30. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  31. data/lib/twilio-ruby/rest/video/v1/room.rb +34 -1
  32. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  33. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  34. data/lib/twilio-ruby/rest/voice.rb +8 -0
  35. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +4 -4
  36. data/lib/twilio-ruby/version.rb +1 -1
  37. data/sonar-project.properties +1 -1
  38. data/twilio-ruby.gemspec +0 -1
  39. metadata +10 -18
  40. data/.github/workflows/deploy.yml +0 -65
  41. data/.github/workflows/test.yml +0 -51
@@ -0,0 +1,416 @@
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 beta products that are subject to change. Use them with caution.
15
+ class IpCommandList < ListResource
16
+ ##
17
+ # Initialize the IpCommandList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [IpCommandList] IpCommandList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/IpCommands"
26
+ end
27
+
28
+ ##
29
+ # Create the IpCommandInstance
30
+ # @param [String] sim The `sid` or `unique_name` of the {Super
31
+ # SIM}[https://www.twilio.com/docs/iot/supersim/api/sim-resource] to send the IP
32
+ # Command to.
33
+ # @param [String] payload The payload to be delivered to the device.
34
+ # @param [String] device_port The device port to which the IP Command will be
35
+ # sent.
36
+ # @param [ip_command.PayloadType] payload_type Indicates how the payload is
37
+ # encoded. Either `text` or `binary`. Defaults to `text`.
38
+ # @param [String] callback_url The URL we should call using the `callback_method`
39
+ # after we have sent the IP Command.
40
+ # @param [String] callback_method The HTTP method we should use to call
41
+ # `callback_url`. Can be `GET` or `POST`, and the default is `POST`.
42
+ # @return [IpCommandInstance] Created IpCommandInstance
43
+ def create(sim: nil, payload: nil, device_port: nil, payload_type: :unset, callback_url: :unset, callback_method: :unset)
44
+ data = Twilio::Values.of({
45
+ 'Sim' => sim,
46
+ 'Payload' => payload,
47
+ 'DevicePort' => device_port,
48
+ 'PayloadType' => payload_type,
49
+ 'CallbackUrl' => callback_url,
50
+ 'CallbackMethod' => callback_method,
51
+ })
52
+
53
+ payload = @version.create('POST', @uri, data: data)
54
+
55
+ IpCommandInstance.new(@version, payload, )
56
+ end
57
+
58
+ ##
59
+ # Lists IpCommandInstance records from the API as a list.
60
+ # Unlike stream(), this operation is eager and will load `limit` records into
61
+ # memory before returning.
62
+ # @param [String] sim The SID or unique name of the Sim resource that IP Command
63
+ # was sent to or from.
64
+ # @param [String] sim_iccid The ICCID of the Sim resource that IP Command was sent
65
+ # to or from.
66
+ # @param [ip_command.Status] status The status of the IP Command. Can be:
67
+ # `queued`, `sent`, `received` or `failed`. See the {IP Command Status
68
+ # Values}[https://www.twilio.com/docs/wireless/api/ipcommand-resource#status-values]
69
+ # for a description of each.
70
+ # @param [ip_command.Direction] direction The direction of the IP Command. Can be
71
+ # `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
72
+ # `mobile terminated`, and `from_sim` is synonymous with the term `mobile
73
+ # originated`.
74
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
75
+ # guarantees to never return more than limit. Default is no limit
76
+ # @param [Integer] page_size Number of records to fetch per request, when
77
+ # not set will use the default value of 50 records. If no page_size is defined
78
+ # but a limit is defined, stream() will attempt to read the limit with the most
79
+ # efficient page size, i.e. min(limit, 1000)
80
+ # @return [Array] Array of up to limit results
81
+ def list(sim: :unset, sim_iccid: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil)
82
+ self.stream(
83
+ sim: sim,
84
+ sim_iccid: sim_iccid,
85
+ status: status,
86
+ direction: direction,
87
+ limit: limit,
88
+ page_size: page_size
89
+ ).entries
90
+ end
91
+
92
+ ##
93
+ # Streams IpCommandInstance records from the API as an Enumerable.
94
+ # This operation lazily loads records as efficiently as possible until the limit
95
+ # is reached.
96
+ # @param [String] sim The SID or unique name of the Sim resource that IP Command
97
+ # was sent to or from.
98
+ # @param [String] sim_iccid The ICCID of the Sim resource that IP Command was sent
99
+ # to or from.
100
+ # @param [ip_command.Status] status The status of the IP Command. Can be:
101
+ # `queued`, `sent`, `received` or `failed`. See the {IP Command Status
102
+ # Values}[https://www.twilio.com/docs/wireless/api/ipcommand-resource#status-values]
103
+ # for a description of each.
104
+ # @param [ip_command.Direction] direction The direction of the IP Command. Can be
105
+ # `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
106
+ # `mobile terminated`, and `from_sim` is synonymous with the term `mobile
107
+ # originated`.
108
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
109
+ # guarantees to never return more than limit. Default is no limit.
110
+ # @param [Integer] page_size Number of records to fetch per request, when
111
+ # not set will use the default value of 50 records. If no page_size is defined
112
+ # but a limit is defined, stream() will attempt to read the limit with the most
113
+ # efficient page size, i.e. min(limit, 1000)
114
+ # @return [Enumerable] Enumerable that will yield up to limit results
115
+ def stream(sim: :unset, sim_iccid: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil)
116
+ limits = @version.read_limits(limit, page_size)
117
+
118
+ page = self.page(
119
+ sim: sim,
120
+ sim_iccid: sim_iccid,
121
+ status: status,
122
+ direction: direction,
123
+ page_size: limits[:page_size],
124
+ )
125
+
126
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
127
+ end
128
+
129
+ ##
130
+ # When passed a block, yields IpCommandInstance records from the API.
131
+ # This operation lazily loads records as efficiently as possible until the limit
132
+ # is reached.
133
+ def each
134
+ limits = @version.read_limits
135
+
136
+ page = self.page(page_size: limits[:page_size], )
137
+
138
+ @version.stream(page,
139
+ limit: limits[:limit],
140
+ page_limit: limits[:page_limit]).each {|x| yield x}
141
+ end
142
+
143
+ ##
144
+ # Retrieve a single page of IpCommandInstance records from the API.
145
+ # Request is executed immediately.
146
+ # @param [String] sim The SID or unique name of the Sim resource that IP Command
147
+ # was sent to or from.
148
+ # @param [String] sim_iccid The ICCID of the Sim resource that IP Command was sent
149
+ # to or from.
150
+ # @param [ip_command.Status] status The status of the IP Command. Can be:
151
+ # `queued`, `sent`, `received` or `failed`. See the {IP Command Status
152
+ # Values}[https://www.twilio.com/docs/wireless/api/ipcommand-resource#status-values]
153
+ # for a description of each.
154
+ # @param [ip_command.Direction] direction The direction of the IP Command. Can be
155
+ # `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
156
+ # `mobile terminated`, and `from_sim` is synonymous with the term `mobile
157
+ # originated`.
158
+ # @param [String] page_token PageToken provided by the API
159
+ # @param [Integer] page_number Page Number, this value is simply for client state
160
+ # @param [Integer] page_size Number of records to return, defaults to 50
161
+ # @return [Page] Page of IpCommandInstance
162
+ def page(sim: :unset, sim_iccid: :unset, status: :unset, direction: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
163
+ params = Twilio::Values.of({
164
+ 'Sim' => sim,
165
+ 'SimIccid' => sim_iccid,
166
+ 'Status' => status,
167
+ 'Direction' => direction,
168
+ 'PageToken' => page_token,
169
+ 'Page' => page_number,
170
+ 'PageSize' => page_size,
171
+ })
172
+
173
+ response = @version.page('GET', @uri, params: params)
174
+
175
+ IpCommandPage.new(@version, response, @solution)
176
+ end
177
+
178
+ ##
179
+ # Retrieve a single page of IpCommandInstance records from the API.
180
+ # Request is executed immediately.
181
+ # @param [String] target_url API-generated URL for the requested results page
182
+ # @return [Page] Page of IpCommandInstance
183
+ def get_page(target_url)
184
+ response = @version.domain.request(
185
+ 'GET',
186
+ target_url
187
+ )
188
+ IpCommandPage.new(@version, response, @solution)
189
+ end
190
+
191
+ ##
192
+ # Provide a user friendly representation
193
+ def to_s
194
+ '#<Twilio.Supersim.V1.IpCommandList>'
195
+ end
196
+ end
197
+
198
+ ##
199
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
200
+ class IpCommandPage < Page
201
+ ##
202
+ # Initialize the IpCommandPage
203
+ # @param [Version] version Version that contains the resource
204
+ # @param [Response] response Response from the API
205
+ # @param [Hash] solution Path solution for the resource
206
+ # @return [IpCommandPage] IpCommandPage
207
+ def initialize(version, response, solution)
208
+ super(version, response)
209
+
210
+ # Path Solution
211
+ @solution = solution
212
+ end
213
+
214
+ ##
215
+ # Build an instance of IpCommandInstance
216
+ # @param [Hash] payload Payload response from the API
217
+ # @return [IpCommandInstance] IpCommandInstance
218
+ def get_instance(payload)
219
+ IpCommandInstance.new(@version, payload, )
220
+ end
221
+
222
+ ##
223
+ # Provide a user friendly representation
224
+ def to_s
225
+ '<Twilio.Supersim.V1.IpCommandPage>'
226
+ end
227
+ end
228
+
229
+ ##
230
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
231
+ class IpCommandContext < InstanceContext
232
+ ##
233
+ # Initialize the IpCommandContext
234
+ # @param [Version] version Version that contains the resource
235
+ # @param [String] sid The SID of the IP Command resource to fetch.
236
+ # @return [IpCommandContext] IpCommandContext
237
+ def initialize(version, sid)
238
+ super(version)
239
+
240
+ # Path Solution
241
+ @solution = {sid: sid, }
242
+ @uri = "/IpCommands/#{@solution[:sid]}"
243
+ end
244
+
245
+ ##
246
+ # Fetch the IpCommandInstance
247
+ # @return [IpCommandInstance] Fetched IpCommandInstance
248
+ def fetch
249
+ payload = @version.fetch('GET', @uri)
250
+
251
+ IpCommandInstance.new(@version, payload, sid: @solution[:sid], )
252
+ end
253
+
254
+ ##
255
+ # Provide a user friendly representation
256
+ def to_s
257
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
258
+ "#<Twilio.Supersim.V1.IpCommandContext #{context}>"
259
+ end
260
+
261
+ ##
262
+ # Provide a detailed, user friendly representation
263
+ def inspect
264
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
265
+ "#<Twilio.Supersim.V1.IpCommandContext #{context}>"
266
+ end
267
+ end
268
+
269
+ ##
270
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
271
+ class IpCommandInstance < InstanceResource
272
+ ##
273
+ # Initialize the IpCommandInstance
274
+ # @param [Version] version Version that contains the resource
275
+ # @param [Hash] payload payload that contains response from Twilio
276
+ # @param [String] sid The SID of the IP Command resource to fetch.
277
+ # @return [IpCommandInstance] IpCommandInstance
278
+ def initialize(version, payload, sid: nil)
279
+ super(version)
280
+
281
+ # Marshaled Properties
282
+ @properties = {
283
+ 'sid' => payload['sid'],
284
+ 'account_sid' => payload['account_sid'],
285
+ 'sim_sid' => payload['sim_sid'],
286
+ 'sim_iccid' => payload['sim_iccid'],
287
+ 'status' => payload['status'],
288
+ 'direction' => payload['direction'],
289
+ 'device_ip' => payload['device_ip'],
290
+ 'device_port' => payload['device_port'].to_i,
291
+ 'payload_type' => payload['payload_type'],
292
+ 'payload' => payload['payload'],
293
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
294
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
295
+ 'url' => payload['url'],
296
+ }
297
+
298
+ # Context
299
+ @instance_context = nil
300
+ @params = {'sid' => sid || @properties['sid'], }
301
+ end
302
+
303
+ ##
304
+ # Generate an instance context for the instance, the context is capable of
305
+ # performing various actions. All instance actions are proxied to the context
306
+ # @return [IpCommandContext] IpCommandContext for this IpCommandInstance
307
+ def context
308
+ unless @instance_context
309
+ @instance_context = IpCommandContext.new(@version, @params['sid'], )
310
+ end
311
+ @instance_context
312
+ end
313
+
314
+ ##
315
+ # @return [String] The unique string that identifies the resource
316
+ def sid
317
+ @properties['sid']
318
+ end
319
+
320
+ ##
321
+ # @return [String] The SID of the Account that created the resource
322
+ def account_sid
323
+ @properties['account_sid']
324
+ end
325
+
326
+ ##
327
+ # @return [String] The SID of the Super SIM that this IP Command was sent to or from
328
+ def sim_sid
329
+ @properties['sim_sid']
330
+ end
331
+
332
+ ##
333
+ # @return [String] The ICCID of the Super SIM that this IP Command was sent to or from
334
+ def sim_iccid
335
+ @properties['sim_iccid']
336
+ end
337
+
338
+ ##
339
+ # @return [ip_command.Status] The status of the IP Command
340
+ def status
341
+ @properties['status']
342
+ end
343
+
344
+ ##
345
+ # @return [ip_command.Direction] The direction of the IP Command
346
+ def direction
347
+ @properties['direction']
348
+ end
349
+
350
+ ##
351
+ # @return [String] The IP address of the device that the IP Command was sent to or received from
352
+ def device_ip
353
+ @properties['device_ip']
354
+ end
355
+
356
+ ##
357
+ # @return [String] The port that the IP Command either originated from or was sent to
358
+ def device_port
359
+ @properties['device_port']
360
+ end
361
+
362
+ ##
363
+ # @return [ip_command.PayloadType] The payload type of the IP Command
364
+ def payload_type
365
+ @properties['payload_type']
366
+ end
367
+
368
+ ##
369
+ # @return [String] The payload of the IP Command sent to or from the Super SIM
370
+ def payload
371
+ @properties['payload']
372
+ end
373
+
374
+ ##
375
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
376
+ def date_created
377
+ @properties['date_created']
378
+ end
379
+
380
+ ##
381
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
382
+ def date_updated
383
+ @properties['date_updated']
384
+ end
385
+
386
+ ##
387
+ # @return [String] The absolute URL of the IP Command resource
388
+ def url
389
+ @properties['url']
390
+ end
391
+
392
+ ##
393
+ # Fetch the IpCommandInstance
394
+ # @return [IpCommandInstance] Fetched IpCommandInstance
395
+ def fetch
396
+ context.fetch
397
+ end
398
+
399
+ ##
400
+ # Provide a user friendly representation
401
+ def to_s
402
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
403
+ "<Twilio.Supersim.V1.IpCommandInstance #{values}>"
404
+ end
405
+
406
+ ##
407
+ # Provide a detailed, user friendly representation
408
+ def inspect
409
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
410
+ "<Twilio.Supersim.V1.IpCommandInstance #{values}>"
411
+ end
412
+ end
413
+ end
414
+ end
415
+ end
416
+ end
@@ -16,7 +16,9 @@ module Twilio
16
16
  super
17
17
  @version = 'v1'
18
18
  @commands = nil
19
+ @esim_profiles = nil
19
20
  @fleets = nil
21
+ @ip_commands = nil
20
22
  @networks = nil
21
23
  @network_access_profiles = nil
22
24
  @sims = nil
@@ -39,6 +41,21 @@ module Twilio
39
41
  end
40
42
  end
41
43
 
44
+ ##
45
+ # @param [String] sid The SID of the eSIM Profile resource to fetch.
46
+ # @return [Twilio::REST::Supersim::V1::EsimProfileContext] if sid was passed.
47
+ # @return [Twilio::REST::Supersim::V1::EsimProfileList]
48
+ def esim_profiles(sid=:unset)
49
+ if sid.nil?
50
+ raise ArgumentError, 'sid cannot be nil'
51
+ end
52
+ if sid == :unset
53
+ @esim_profiles ||= EsimProfileList.new self
54
+ else
55
+ EsimProfileContext.new(self, sid)
56
+ end
57
+ end
58
+
42
59
  ##
43
60
  # @param [String] sid The SID of the Fleet resource to fetch.
44
61
  # @return [Twilio::REST::Supersim::V1::FleetContext] if sid was passed.
@@ -54,6 +71,21 @@ module Twilio
54
71
  end
55
72
  end
56
73
 
74
+ ##
75
+ # @param [String] sid The SID of the IP Command resource to fetch.
76
+ # @return [Twilio::REST::Supersim::V1::IpCommandContext] if sid was passed.
77
+ # @return [Twilio::REST::Supersim::V1::IpCommandList]
78
+ def ip_commands(sid=:unset)
79
+ if sid.nil?
80
+ raise ArgumentError, 'sid cannot be nil'
81
+ end
82
+ if sid == :unset
83
+ @ip_commands ||= IpCommandList.new self
84
+ else
85
+ IpCommandContext.new(self, sid)
86
+ end
87
+ end
88
+
57
89
  ##
58
90
  # @param [String] sid The SID of the Network resource to fetch.
59
91
  # @return [Twilio::REST::Supersim::V1::NetworkContext] if sid was passed.
@@ -37,6 +37,15 @@ module Twilio
37
37
  self.v1.commands(sid)
38
38
  end
39
39
 
40
+ ##
41
+ # @param [String] sid The unique string that we created to identify the eSIM
42
+ # Profile resource.
43
+ # @return [Twilio::REST::Supersim::V1::EsimProfileInstance] if sid was passed.
44
+ # @return [Twilio::REST::Supersim::V1::EsimProfileList]
45
+ def esim_profiles(sid=:unset)
46
+ self.v1.esim_profiles(sid)
47
+ end
48
+
40
49
  ##
41
50
  # @param [String] sid The unique string that we created to identify the Fleet
42
51
  # resource.
@@ -46,6 +55,15 @@ module Twilio
46
55
  self.v1.fleets(sid)
47
56
  end
48
57
 
58
+ ##
59
+ # @param [String] sid The unique string that we created to identify the IP Command
60
+ # resource.
61
+ # @return [Twilio::REST::Supersim::V1::IpCommandInstance] if sid was passed.
62
+ # @return [Twilio::REST::Supersim::V1::IpCommandList]
63
+ def ip_commands(sid=:unset)
64
+ self.v1.ip_commands(sid)
65
+ end
66
+
49
67
  ##
50
68
  # @param [String] sid The unique string that we created to identify the Network
51
69
  # resource.
@@ -17,8 +17,7 @@ module Twilio
17
17
  ##
18
18
  # Initialize the AccessTokenList
19
19
  # @param [Version] version Version that contains the resource
20
- # @param [String] service_sid The unique string that we created to identify the
21
- # Service resource.
20
+ # @param [String] service_sid The unique SID identifier of the Verify Service.
22
21
  # @return [AccessTokenList] AccessTokenList
23
22
  def initialize(version, service_sid: nil)
24
23
  super(version)
@@ -35,9 +34,15 @@ module Twilio
35
34
  # external system, such as your user's UUID, GUID, or SID.
36
35
  # @param [access_token.FactorTypes] factor_type The Type of this Factor. Eg.
37
36
  # `push`
37
+ # @param [String] factor_friendly_name The friendly name of the factor that is
38
+ # going to be created with this access token
38
39
  # @return [AccessTokenInstance] Created AccessTokenInstance
39
- def create(identity: nil, factor_type: nil)
40
- data = Twilio::Values.of({'Identity' => identity, 'FactorType' => factor_type, })
40
+ def create(identity: nil, factor_type: nil, factor_friendly_name: :unset)
41
+ data = Twilio::Values.of({
42
+ 'Identity' => identity,
43
+ 'FactorType' => factor_type,
44
+ 'FactorFriendlyName' => factor_friendly_name,
45
+ })
41
46
 
42
47
  payload = @version.create('POST', @uri, data: data)
43
48
 
@@ -82,6 +87,53 @@ module Twilio
82
87
  end
83
88
  end
84
89
 
90
+ ##
91
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
92
+ class AccessTokenContext < InstanceContext
93
+ ##
94
+ # Initialize the AccessTokenContext
95
+ # @param [Version] version Version that contains the resource
96
+ # @param [String] service_sid The unique SID identifier of the Service.
97
+ # @param [String] sid A 34 character string that uniquely identifies this Access
98
+ # Token.
99
+ # @return [AccessTokenContext] AccessTokenContext
100
+ def initialize(version, service_sid, sid)
101
+ super(version)
102
+
103
+ # Path Solution
104
+ @solution = {service_sid: service_sid, sid: sid, }
105
+ @uri = "/Services/#{@solution[:service_sid]}/AccessTokens/#{@solution[:sid]}"
106
+ end
107
+
108
+ ##
109
+ # Fetch the AccessTokenInstance
110
+ # @return [AccessTokenInstance] Fetched AccessTokenInstance
111
+ def fetch
112
+ payload = @version.fetch('GET', @uri)
113
+
114
+ AccessTokenInstance.new(
115
+ @version,
116
+ payload,
117
+ service_sid: @solution[:service_sid],
118
+ sid: @solution[:sid],
119
+ )
120
+ end
121
+
122
+ ##
123
+ # Provide a user friendly representation
124
+ def to_s
125
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
126
+ "#<Twilio.Verify.V2.AccessTokenContext #{context}>"
127
+ end
128
+
129
+ ##
130
+ # Provide a detailed, user friendly representation
131
+ def inspect
132
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
133
+ "#<Twilio.Verify.V2.AccessTokenContext #{context}>"
134
+ end
135
+ end
136
+
85
137
  ##
86
138
  # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
87
139
  class AccessTokenInstance < InstanceResource
@@ -89,14 +141,75 @@ module Twilio
89
141
  # Initialize the AccessTokenInstance
90
142
  # @param [Version] version Version that contains the resource
91
143
  # @param [Hash] payload payload that contains response from Twilio
92
- # @param [String] service_sid The unique string that we created to identify the
93
- # Service resource.
144
+ # @param [String] service_sid The unique SID identifier of the Verify Service.
145
+ # @param [String] sid A 34 character string that uniquely identifies this Access
146
+ # Token.
94
147
  # @return [AccessTokenInstance] AccessTokenInstance
95
- def initialize(version, payload, service_sid: nil)
148
+ def initialize(version, payload, service_sid: nil, sid: nil)
96
149
  super(version)
97
150
 
98
151
  # Marshaled Properties
99
- @properties = {'token' => payload['token'], }
152
+ @properties = {
153
+ 'sid' => payload['sid'],
154
+ 'account_sid' => payload['account_sid'],
155
+ 'service_sid' => payload['service_sid'],
156
+ 'entity_identity' => payload['entity_identity'],
157
+ 'factor_type' => payload['factor_type'],
158
+ 'factor_friendly_name' => payload['factor_friendly_name'],
159
+ 'token' => payload['token'],
160
+ 'url' => payload['url'],
161
+ }
162
+
163
+ # Context
164
+ @instance_context = nil
165
+ @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
166
+ end
167
+
168
+ ##
169
+ # Generate an instance context for the instance, the context is capable of
170
+ # performing various actions. All instance actions are proxied to the context
171
+ # @return [AccessTokenContext] AccessTokenContext for this AccessTokenInstance
172
+ def context
173
+ unless @instance_context
174
+ @instance_context = AccessTokenContext.new(@version, @params['service_sid'], @params['sid'], )
175
+ end
176
+ @instance_context
177
+ end
178
+
179
+ ##
180
+ # @return [String] A string that uniquely identifies this Access Token.
181
+ def sid
182
+ @properties['sid']
183
+ end
184
+
185
+ ##
186
+ # @return [String] Account Sid.
187
+ def account_sid
188
+ @properties['account_sid']
189
+ end
190
+
191
+ ##
192
+ # @return [String] Verify Service Sid.
193
+ def service_sid
194
+ @properties['service_sid']
195
+ end
196
+
197
+ ##
198
+ # @return [String] Unique external identifier of the Entity
199
+ def entity_identity
200
+ @properties['entity_identity']
201
+ end
202
+
203
+ ##
204
+ # @return [access_token.FactorTypes] The Type of the Factor
205
+ def factor_type
206
+ @properties['factor_type']
207
+ end
208
+
209
+ ##
210
+ # @return [String] A human readable description of this factor.
211
+ def factor_friendly_name
212
+ @properties['factor_friendly_name']
100
213
  end
101
214
 
102
215
  ##
@@ -105,16 +218,31 @@ module Twilio
105
218
  @properties['token']
106
219
  end
107
220
 
221
+ ##
222
+ # @return [String] The URL of this resource.
223
+ def url
224
+ @properties['url']
225
+ end
226
+
227
+ ##
228
+ # Fetch the AccessTokenInstance
229
+ # @return [AccessTokenInstance] Fetched AccessTokenInstance
230
+ def fetch
231
+ context.fetch
232
+ end
233
+
108
234
  ##
109
235
  # Provide a user friendly representation
110
236
  def to_s
111
- "<Twilio.Verify.V2.AccessTokenInstance>"
237
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
238
+ "<Twilio.Verify.V2.AccessTokenInstance #{values}>"
112
239
  end
113
240
 
114
241
  ##
115
242
  # Provide a detailed, user friendly representation
116
243
  def inspect
117
- "<Twilio.Verify.V2.AccessTokenInstance>"
244
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
245
+ "<Twilio.Verify.V2.AccessTokenInstance #{values}>"
118
246
  end
119
247
  end
120
248
  end