twilio-ruby 5.67.2 → 5.69.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.
@@ -0,0 +1,261 @@
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 Lookups < Domain
12
+ class V2 < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class PhoneNumberList < ListResource
16
+ ##
17
+ # Initialize the PhoneNumberList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [PhoneNumberList] PhoneNumberList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '#<Twilio.Lookups.V2.PhoneNumberList>'
31
+ end
32
+ end
33
+
34
+ ##
35
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
36
+ class PhoneNumberPage < Page
37
+ ##
38
+ # Initialize the PhoneNumberPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [PhoneNumberPage] PhoneNumberPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of PhoneNumberInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [PhoneNumberInstance] PhoneNumberInstance
54
+ def get_instance(payload)
55
+ PhoneNumberInstance.new(@version, payload, )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.Lookups.V2.PhoneNumberPage>'
62
+ end
63
+ end
64
+
65
+ ##
66
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
67
+ class PhoneNumberContext < InstanceContext
68
+ ##
69
+ # Initialize the PhoneNumberContext
70
+ # @param [Version] version Version that contains the resource
71
+ # @param [String] phone_number The phone number to lookup in E.164 or national
72
+ # format. Default country code is +1 (North America).
73
+ # @return [PhoneNumberContext] PhoneNumberContext
74
+ def initialize(version, phone_number)
75
+ super(version)
76
+
77
+ # Path Solution
78
+ @solution = {phone_number: phone_number, }
79
+ @uri = "/PhoneNumbers/#{@solution[:phone_number]}"
80
+ end
81
+
82
+ ##
83
+ # Fetch the PhoneNumberInstance
84
+ # @param [String] fields A comma-separated list of fields to return. Possible
85
+ # values are caller_name, sim_swap, call_forwarding, live_activity,
86
+ # line_type_intelligence.
87
+ # @param [String] country_code The {country
88
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] used if the phone number
89
+ # provided is in national format.
90
+ # @return [PhoneNumberInstance] Fetched PhoneNumberInstance
91
+ def fetch(fields: :unset, country_code: :unset)
92
+ params = Twilio::Values.of({'Fields' => fields, 'CountryCode' => country_code, })
93
+
94
+ payload = @version.fetch('GET', @uri, params: params)
95
+
96
+ PhoneNumberInstance.new(@version, payload, phone_number: @solution[:phone_number], )
97
+ end
98
+
99
+ ##
100
+ # Provide a user friendly representation
101
+ def to_s
102
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
103
+ "#<Twilio.Lookups.V2.PhoneNumberContext #{context}>"
104
+ end
105
+
106
+ ##
107
+ # Provide a detailed, user friendly representation
108
+ def inspect
109
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
110
+ "#<Twilio.Lookups.V2.PhoneNumberContext #{context}>"
111
+ end
112
+ end
113
+
114
+ ##
115
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
116
+ class PhoneNumberInstance < InstanceResource
117
+ ##
118
+ # Initialize the PhoneNumberInstance
119
+ # @param [Version] version Version that contains the resource
120
+ # @param [Hash] payload payload that contains response from Twilio
121
+ # @param [String] phone_number The phone number to lookup in E.164 or national
122
+ # format. Default country code is +1 (North America).
123
+ # @return [PhoneNumberInstance] PhoneNumberInstance
124
+ def initialize(version, payload, phone_number: nil)
125
+ super(version)
126
+
127
+ # Marshaled Properties
128
+ @properties = {
129
+ 'calling_country_code' => payload['calling_country_code'],
130
+ 'country_code' => payload['country_code'],
131
+ 'phone_number' => payload['phone_number'],
132
+ 'national_format' => payload['national_format'],
133
+ 'valid' => payload['valid'],
134
+ 'validation_errors' => payload['validation_errors'],
135
+ 'caller_name' => payload['caller_name'],
136
+ 'sim_swap' => payload['sim_swap'],
137
+ 'call_forwarding' => payload['call_forwarding'],
138
+ 'live_activity' => payload['live_activity'],
139
+ 'line_type_intelligence' => payload['line_type_intelligence'],
140
+ 'url' => payload['url'],
141
+ }
142
+
143
+ # Context
144
+ @instance_context = nil
145
+ @params = {'phone_number' => phone_number || @properties['phone_number'], }
146
+ end
147
+
148
+ ##
149
+ # Generate an instance context for the instance, the context is capable of
150
+ # performing various actions. All instance actions are proxied to the context
151
+ # @return [PhoneNumberContext] PhoneNumberContext for this PhoneNumberInstance
152
+ def context
153
+ unless @instance_context
154
+ @instance_context = PhoneNumberContext.new(@version, @params['phone_number'], )
155
+ end
156
+ @instance_context
157
+ end
158
+
159
+ ##
160
+ # @return [String] International dialing prefix
161
+ def calling_country_code
162
+ @properties['calling_country_code']
163
+ end
164
+
165
+ ##
166
+ # @return [String] Phone number's ISO country code
167
+ def country_code
168
+ @properties['country_code']
169
+ end
170
+
171
+ ##
172
+ # @return [String] Phone number in E.164 format
173
+ def phone_number
174
+ @properties['phone_number']
175
+ end
176
+
177
+ ##
178
+ # @return [String] Phone number in national format
179
+ def national_format
180
+ @properties['national_format']
181
+ end
182
+
183
+ ##
184
+ # @return [Boolean] Boolean which indicates if the phone number is valid
185
+ def valid
186
+ @properties['valid']
187
+ end
188
+
189
+ ##
190
+ # @return [Array[phone_number.ValidationError]] Contains reasons why a phone number is invalid
191
+ def validation_errors
192
+ @properties['validation_errors']
193
+ end
194
+
195
+ ##
196
+ # @return [Hash] An object that contains caller name information
197
+ def caller_name
198
+ @properties['caller_name']
199
+ end
200
+
201
+ ##
202
+ # @return [Hash] An object that contains SIM swap information
203
+ def sim_swap
204
+ @properties['sim_swap']
205
+ end
206
+
207
+ ##
208
+ # @return [Hash] An object that contains call forwarding status information
209
+ def call_forwarding
210
+ @properties['call_forwarding']
211
+ end
212
+
213
+ ##
214
+ # @return [Hash] An object that contains live activity information
215
+ def live_activity
216
+ @properties['live_activity']
217
+ end
218
+
219
+ ##
220
+ # @return [Hash] An object that contains line type information
221
+ def line_type_intelligence
222
+ @properties['line_type_intelligence']
223
+ end
224
+
225
+ ##
226
+ # @return [String] The absolute URL of the resource
227
+ def url
228
+ @properties['url']
229
+ end
230
+
231
+ ##
232
+ # Fetch the PhoneNumberInstance
233
+ # @param [String] fields A comma-separated list of fields to return. Possible
234
+ # values are caller_name, sim_swap, call_forwarding, live_activity,
235
+ # line_type_intelligence.
236
+ # @param [String] country_code The {country
237
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] used if the phone number
238
+ # provided is in national format.
239
+ # @return [PhoneNumberInstance] Fetched PhoneNumberInstance
240
+ def fetch(fields: :unset, country_code: :unset)
241
+ context.fetch(fields: fields, country_code: country_code, )
242
+ end
243
+
244
+ ##
245
+ # Provide a user friendly representation
246
+ def to_s
247
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
248
+ "<Twilio.Lookups.V2.PhoneNumberInstance #{values}>"
249
+ end
250
+
251
+ ##
252
+ # Provide a detailed, user friendly representation
253
+ def inspect
254
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
255
+ "<Twilio.Lookups.V2.PhoneNumberInstance #{values}>"
256
+ end
257
+ end
258
+ end
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,45 @@
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 Lookups
12
+ class V2 < Version
13
+ ##
14
+ # Initialize the V2 version of Lookups
15
+ def initialize(domain)
16
+ super
17
+ @version = 'v2'
18
+ @phone_numbers = nil
19
+ end
20
+
21
+ ##
22
+ # @param [String] phone_number The phone number to lookup in E.164 or national
23
+ # format. Default country code is +1 (North America).
24
+ # @return [Twilio::REST::Lookups::V2::PhoneNumberContext] if phone_number was passed.
25
+ # @return [Twilio::REST::Lookups::V2::PhoneNumberList]
26
+ def phone_numbers(phone_number=:unset)
27
+ if phone_number.nil?
28
+ raise ArgumentError, 'phone_number cannot be nil'
29
+ end
30
+ if phone_number == :unset
31
+ @phone_numbers ||= PhoneNumberList.new self
32
+ else
33
+ PhoneNumberContext.new(self, phone_number)
34
+ end
35
+ end
36
+
37
+ ##
38
+ # Provide a user friendly representation
39
+ def to_s
40
+ '<Twilio::REST::Lookups::V2>'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -20,6 +20,7 @@ module Twilio
20
20
 
21
21
  # Versions
22
22
  @v1 = nil
23
+ @v2 = nil
23
24
  end
24
25
 
25
26
  ##
@@ -28,6 +29,12 @@ module Twilio
28
29
  @v1 ||= V1.new self
29
30
  end
30
31
 
32
+ ##
33
+ # Version v2 of lookups
34
+ def v2
35
+ @v2 ||= V2.new self
36
+ end
37
+
31
38
  ##
32
39
  # @param [String] phone_number The phone number in
33
40
  # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, which consists
@@ -27,7 +27,7 @@ module Twilio
27
27
  # Create the MediaProcessorInstance
28
28
  # @param [String] extension The {Media
29
29
  # Extension}[/docs/live/api/media-extensions-overview] name or URL. Ex:
30
- # `video-composer-v1`
30
+ # `video-composer-v2`
31
31
  # @param [String] extension_context The context of the Media Extension,
32
32
  # represented as a JSON dictionary. See the documentation for the specific {Media
33
33
  # Extension}[/docs/live/api/media-extensions-overview] you are using for more
@@ -243,7 +243,6 @@ module Twilio
243
243
  # Marshaled Properties
244
244
  @properties = {
245
245
  'account_sid' => payload['account_sid'],
246
- 'bitrate' => payload['bitrate'].to_i,
247
246
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
248
247
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
249
248
  'duration' => payload['duration'].to_i,
@@ -253,7 +252,7 @@ module Twilio
253
252
  'resolution' => payload['resolution'],
254
253
  'source_sid' => payload['source_sid'],
255
254
  'sid' => payload['sid'],
256
- 'size' => payload['size'].to_i,
255
+ 'media_size' => payload['media_size'].to_i,
257
256
  'status' => payload['status'],
258
257
  'status_callback' => payload['status_callback'],
259
258
  'status_callback_method' => payload['status_callback_method'],
@@ -282,12 +281,6 @@ module Twilio
282
281
  @properties['account_sid']
283
282
  end
284
283
 
285
- ##
286
- # @return [String] The bitrate of the media
287
- def bitrate
288
- @properties['bitrate']
289
- end
290
-
291
284
  ##
292
285
  # @return [Time] The ISO 8601 date and time in GMT when the resource was created
293
286
  def date_created
@@ -343,9 +336,9 @@ module Twilio
343
336
  end
344
337
 
345
338
  ##
346
- # @return [String] The size of the recording
347
- def size
348
- @properties['size']
339
+ # @return [String] The size of the recording media
340
+ def media_size
341
+ @properties['media_size']
349
342
  end
350
343
 
351
344
  ##
@@ -0,0 +1,195 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Supersim < Domain
12
+ class V1 < Version
13
+ class SimContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class SimIpAddressList < ListResource
17
+ ##
18
+ # Initialize the SimIpAddressList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] sim_sid The unique string that identifies the Sim resource.
21
+ # @return [SimIpAddressList] SimIpAddressList
22
+ def initialize(version, sim_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {sim_sid: sim_sid}
27
+ @uri = "/Sims/#{@solution[:sim_sid]}/IpAddresses"
28
+ end
29
+
30
+ ##
31
+ # Lists SimIpAddressInstance 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 SimIpAddressInstance 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 SimIpAddressInstance 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 SimIpAddressInstance 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 SimIpAddressInstance
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
+
92
+ response = @version.page('GET', @uri, params: params)
93
+
94
+ SimIpAddressPage.new(@version, response, @solution)
95
+ end
96
+
97
+ ##
98
+ # Retrieve a single page of SimIpAddressInstance records from the API.
99
+ # Request is executed immediately.
100
+ # @param [String] target_url API-generated URL for the requested results page
101
+ # @return [Page] Page of SimIpAddressInstance
102
+ def get_page(target_url)
103
+ response = @version.domain.request(
104
+ 'GET',
105
+ target_url
106
+ )
107
+ SimIpAddressPage.new(@version, response, @solution)
108
+ end
109
+
110
+ ##
111
+ # Provide a user friendly representation
112
+ def to_s
113
+ '#<Twilio.Supersim.V1.SimIpAddressList>'
114
+ end
115
+ end
116
+
117
+ ##
118
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
119
+ class SimIpAddressPage < Page
120
+ ##
121
+ # Initialize the SimIpAddressPage
122
+ # @param [Version] version Version that contains the resource
123
+ # @param [Response] response Response from the API
124
+ # @param [Hash] solution Path solution for the resource
125
+ # @return [SimIpAddressPage] SimIpAddressPage
126
+ def initialize(version, response, solution)
127
+ super(version, response)
128
+
129
+ # Path Solution
130
+ @solution = solution
131
+ end
132
+
133
+ ##
134
+ # Build an instance of SimIpAddressInstance
135
+ # @param [Hash] payload Payload response from the API
136
+ # @return [SimIpAddressInstance] SimIpAddressInstance
137
+ def get_instance(payload)
138
+ SimIpAddressInstance.new(@version, payload, sim_sid: @solution[:sim_sid], )
139
+ end
140
+
141
+ ##
142
+ # Provide a user friendly representation
143
+ def to_s
144
+ '<Twilio.Supersim.V1.SimIpAddressPage>'
145
+ end
146
+ end
147
+
148
+ ##
149
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
150
+ class SimIpAddressInstance < InstanceResource
151
+ ##
152
+ # Initialize the SimIpAddressInstance
153
+ # @param [Version] version Version that contains the resource
154
+ # @param [Hash] payload payload that contains response from Twilio
155
+ # @param [String] sim_sid The unique string that identifies the Sim resource.
156
+ # @return [SimIpAddressInstance] SimIpAddressInstance
157
+ def initialize(version, payload, sim_sid: nil)
158
+ super(version)
159
+
160
+ # Marshaled Properties
161
+ @properties = {
162
+ 'ip_address' => payload['ip_address'],
163
+ 'ip_address_version' => payload['ip_address_version'],
164
+ }
165
+ end
166
+
167
+ ##
168
+ # @return [String] IP address assigned to the given Super SIM
169
+ def ip_address
170
+ @properties['ip_address']
171
+ end
172
+
173
+ ##
174
+ # @return [sim_ip_address.IpAddressVersion] IP address version
175
+ def ip_address_version
176
+ @properties['ip_address_version']
177
+ end
178
+
179
+ ##
180
+ # Provide a user friendly representation
181
+ def to_s
182
+ "<Twilio.Supersim.V1.SimIpAddressInstance>"
183
+ end
184
+
185
+ ##
186
+ # Provide a detailed, user friendly representation
187
+ def inspect
188
+ "<Twilio.Supersim.V1.SimIpAddressInstance>"
189
+ end
190
+ end
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
@@ -203,6 +203,7 @@ module Twilio
203
203
 
204
204
  # Dependents
205
205
  @billing_periods = nil
206
+ @sim_ip_addresses = nil
206
207
  end
207
208
 
208
209
  ##
@@ -261,6 +262,18 @@ module Twilio
261
262
  @billing_periods
262
263
  end
263
264
 
265
+ ##
266
+ # Access the sim_ip_addresses
267
+ # @return [SimIpAddressList]
268
+ # @return [SimIpAddressContext]
269
+ def sim_ip_addresses
270
+ unless @sim_ip_addresses
271
+ @sim_ip_addresses = SimIpAddressList.new(@version, sim_sid: @solution[:sid], )
272
+ end
273
+
274
+ @sim_ip_addresses
275
+ end
276
+
264
277
  ##
265
278
  # Provide a user friendly representation
266
279
  def to_s
@@ -423,6 +436,13 @@ module Twilio
423
436
  context.billing_periods
424
437
  end
425
438
 
439
+ ##
440
+ # Access the sim_ip_addresses
441
+ # @return [sim_ip_addresses] sim_ip_addresses
442
+ def sim_ip_addresses
443
+ context.sim_ip_addresses
444
+ end
445
+
426
446
  ##
427
447
  # Provide a user friendly representation
428
448
  def to_s
@@ -29,7 +29,6 @@ module Twilio
29
29
 
30
30
  ##
31
31
  # Create the VerificationCheckInstance
32
- # @param [String] code The 4-10 character string being verified.
33
32
  # @param [String] to The phone number or
34
33
  # {email}[https://www.twilio.com/docs/verify/email] to verify. Either this
35
34
  # parameter or the `verification_sid` must be specified. Phone numbers must be in
@@ -41,14 +40,15 @@ module Twilio
41
40
  # Requires the PSD2 Service flag enabled.
42
41
  # @param [String] payee The payee of the associated PSD2 compliant transaction.
43
42
  # Requires the PSD2 Service flag enabled.
43
+ # @param [String] code The 4-10 character string being verified.
44
44
  # @return [VerificationCheckInstance] Created VerificationCheckInstance
45
- def create(code: nil, to: :unset, verification_sid: :unset, amount: :unset, payee: :unset)
45
+ def create(to: :unset, verification_sid: :unset, amount: :unset, payee: :unset, code: :unset)
46
46
  data = Twilio::Values.of({
47
- 'Code' => code,
48
47
  'To' => to,
49
48
  'VerificationSid' => verification_sid,
50
49
  'Amount' => amount,
51
50
  'Payee' => payee,
51
+ 'Code' => code,
52
52
  })
53
53
 
54
54
  payload = @version.create('POST', @uri, data: data)