twilio-ruby 7.8.1 → 7.8.3

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +16 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/http/client_token_manager.rb +5 -2
  5. data/lib/twilio-ruby/http/org_token_manager.rb +5 -2
  6. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
  7. data/lib/twilio-ruby/rest/client.rb +5 -0
  8. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +3 -3
  9. data/lib/twilio-ruby/rest/knowledge/v1/knowledge/chunk.rb +232 -0
  10. data/lib/twilio-ruby/rest/knowledge/v1/knowledge/knowledge_status.rb +213 -0
  11. data/lib/twilio-ruby/rest/knowledge/v1/knowledge.rb +623 -0
  12. data/lib/twilio-ruby/rest/knowledge/v1.rb +49 -0
  13. data/lib/twilio-ruby/rest/knowledge.rb +6 -0
  14. data/lib/twilio-ruby/rest/knowledge_base.rb +38 -0
  15. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +13 -13
  16. data/lib/twilio-ruby/rest/lookups/v2/query.rb +15 -209
  17. data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +91 -0
  18. data/lib/twilio-ruby/rest/messaging/v2/typing_indicator.rb +140 -0
  19. data/lib/twilio-ruby/rest/messaging/v2.rb +6 -0
  20. data/lib/twilio-ruby/rest/numbers/v1/porting_all_port_in.rb +270 -0
  21. data/lib/twilio-ruby/rest/numbers/v1/porting_port_in.rb +100 -5
  22. data/lib/twilio-ruby/rest/numbers/v1.rb +6 -0
  23. data/lib/twilio-ruby/rest/oauth/v2/token.rb +2 -2
  24. data/lib/twilio-ruby/rest/verify/v2/service/approve_challenge.rb +312 -0
  25. data/lib/twilio-ruby/rest/verify/v2/{new_challenge.rb → service/new_challenge.rb} +9 -4
  26. data/lib/twilio-ruby/rest/verify/v2/service/new_verify_factor.rb +267 -0
  27. data/lib/twilio-ruby/rest/verify/v2/service.rb +49 -12
  28. data/lib/twilio-ruby/rest/verify/v2.rb +0 -15
  29. data/lib/twilio-ruby/version.rb +1 -1
  30. metadata +13 -3
@@ -22,6 +22,7 @@ module Twilio
22
22
  super
23
23
  @version = 'v2'
24
24
  @channels_senders = nil
25
+ @typing_indicator = nil
25
26
  end
26
27
 
27
28
  ##
@@ -39,6 +40,11 @@ module Twilio
39
40
  end
40
41
  end
41
42
  ##
43
+ # @return [Twilio::REST::Messaging::V2::TypingIndicatorList]
44
+ def typing_indicator
45
+ @typing_indicator ||= TypingIndicatorList.new self
46
+ end
47
+ ##
42
48
  # Provide a user friendly representation
43
49
  def to_s
44
50
  '<Twilio::REST::Messaging::V2>';
@@ -0,0 +1,270 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Numbers
8
+ # This is the public Twilio REST API.
9
+ #
10
+ # NOTE: This class is auto generated by OpenAPI Generator.
11
+ # https://openapi-generator.tech
12
+ # Do not edit the class manually.
13
+ #
14
+
15
+
16
+ module Twilio
17
+ module REST
18
+ class Numbers < NumbersBase
19
+ class V1 < Version
20
+ class PortingAllPortInList < ListResource
21
+
22
+ ##
23
+ # Initialize the PortingAllPortInList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [PortingAllPortInList] PortingAllPortInList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = "/Porting/PortIn/PortInRequests"
31
+
32
+ end
33
+
34
+ ##
35
+ # Lists PortingAllPortInInstance records from the API as a list.
36
+ # Unlike stream(), this operation is eager and will load `limit` records into
37
+ # memory before returning.
38
+ # @param [String] token Page start token, if null then it will start from the beginning
39
+ # @param [String] size Number of items per page
40
+ # @param [String] port_in_request_sid Filter by Port in request SID, supports multiple values separated by comma
41
+ # @param [String] port_in_request_status Filter by Port In request status
42
+ # @param [Time] created_before Find all created before a certain date
43
+ # @param [Time] created_after Find all created after a certain date
44
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
45
+ # guarantees to never return more than limit. Default is no limit
46
+ # @param [Integer] page_size Number of records to fetch per request, when
47
+ # not set will use the default value of 50 records. If no page_size is defined
48
+ # but a limit is defined, stream() will attempt to read the limit with the most
49
+ # efficient page size, i.e. min(limit, 1000)
50
+ # @return [Array] Array of up to limit results
51
+ def list(token: :unset, size: :unset, port_in_request_sid: :unset, port_in_request_status: :unset, created_before: :unset, created_after: :unset, limit: nil, page_size: nil)
52
+ self.stream(
53
+ token: token,
54
+ size: size,
55
+ port_in_request_sid: port_in_request_sid,
56
+ port_in_request_status: port_in_request_status,
57
+ created_before: created_before,
58
+ created_after: created_after,
59
+ limit: limit,
60
+ page_size: page_size
61
+ ).entries
62
+ end
63
+
64
+ ##
65
+ # Streams Instance records from the API as an Enumerable.
66
+ # This operation lazily loads records as efficiently as possible until the limit
67
+ # is reached.
68
+ # @param [String] token Page start token, if null then it will start from the beginning
69
+ # @param [String] size Number of items per page
70
+ # @param [String] port_in_request_sid Filter by Port in request SID, supports multiple values separated by comma
71
+ # @param [String] port_in_request_status Filter by Port In request status
72
+ # @param [Time] created_before Find all created before a certain date
73
+ # @param [Time] created_after Find all created after a certain date
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 [Enumerable] Enumerable that will yield up to limit results
81
+ def stream(token: :unset, size: :unset, port_in_request_sid: :unset, port_in_request_status: :unset, created_before: :unset, created_after: :unset, limit: nil, page_size: nil)
82
+ limits = @version.read_limits(limit, page_size)
83
+
84
+ page = self.page(
85
+ token: token,
86
+ size: size,
87
+ port_in_request_sid: port_in_request_sid,
88
+ port_in_request_status: port_in_request_status,
89
+ created_before: created_before,
90
+ created_after: created_after,
91
+ page_size: limits[:page_size], )
92
+
93
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
94
+ end
95
+
96
+ ##
97
+ # When passed a block, yields PortingAllPortInInstance records from the API.
98
+ # This operation lazily loads records as efficiently as possible until the limit
99
+ # is reached.
100
+ def each
101
+ limits = @version.read_limits
102
+
103
+ page = self.page(page_size: limits[:page_size], )
104
+
105
+ @version.stream(page,
106
+ limit: limits[:limit],
107
+ page_limit: limits[:page_limit]).each {|x| yield x}
108
+ end
109
+
110
+ ##
111
+ # Retrieve a single page of PortingAllPortInInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [String] token Page start token, if null then it will start from the beginning
114
+ # @param [String] size Number of items per page
115
+ # @param [String] port_in_request_sid Filter by Port in request SID, supports multiple values separated by comma
116
+ # @param [String] port_in_request_status Filter by Port In request status
117
+ # @param [Time] created_before Find all created before a certain date
118
+ # @param [Time] created_after Find all created after a certain date
119
+ # @param [String] page_token PageToken provided by the API
120
+ # @param [Integer] page_number Page Number, this value is simply for client state
121
+ # @param [Integer] page_size Number of records to return, defaults to 50
122
+ # @return [Page] Page of PortingAllPortInInstance
123
+ def page(token: :unset, size: :unset, port_in_request_sid: :unset, port_in_request_status: :unset, created_before: :unset, created_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
124
+ params = Twilio::Values.of({
125
+ 'Token' => token,
126
+ 'Size' => size,
127
+ 'PortInRequestSid' => port_in_request_sid,
128
+ 'PortInRequestStatus' => port_in_request_status,
129
+ 'CreatedBefore' => Twilio.serialize_iso8601_datetime(created_before),
130
+ 'CreatedAfter' => Twilio.serialize_iso8601_datetime(created_after),
131
+ 'PageToken' => page_token,
132
+ 'Page' => page_number,
133
+ 'PageSize' => page_size,
134
+ })
135
+ headers = Twilio::Values.of({})
136
+
137
+
138
+
139
+ response = @version.page('GET', @uri, params: params, headers: headers)
140
+
141
+ PortingAllPortInPage.new(@version, response, @solution)
142
+ end
143
+
144
+ ##
145
+ # Retrieve a single page of PortingAllPortInInstance records from the API.
146
+ # Request is executed immediately.
147
+ # @param [String] target_url API-generated URL for the requested results page
148
+ # @return [Page] Page of PortingAllPortInInstance
149
+ def get_page(target_url)
150
+ response = @version.domain.request(
151
+ 'GET',
152
+ target_url
153
+ )
154
+ PortingAllPortInPage.new(@version, response, @solution)
155
+ end
156
+
157
+
158
+
159
+ # Provide a user friendly representation
160
+ def to_s
161
+ '#<Twilio.Numbers.V1.PortingAllPortInList>'
162
+ end
163
+ end
164
+
165
+ class PortingAllPortInPage < Page
166
+ ##
167
+ # Initialize the PortingAllPortInPage
168
+ # @param [Version] version Version that contains the resource
169
+ # @param [Response] response Response from the API
170
+ # @param [Hash] solution Path solution for the resource
171
+ # @return [PortingAllPortInPage] PortingAllPortInPage
172
+ def initialize(version, response, solution)
173
+ super(version, response)
174
+
175
+ # Path Solution
176
+ @solution = solution
177
+ end
178
+
179
+ ##
180
+ # Build an instance of PortingAllPortInInstance
181
+ # @param [Hash] payload Payload response from the API
182
+ # @return [PortingAllPortInInstance] PortingAllPortInInstance
183
+ def get_instance(payload)
184
+ PortingAllPortInInstance.new(@version, payload)
185
+ end
186
+
187
+ ##
188
+ # Provide a user friendly representation
189
+ def to_s
190
+ '<Twilio.Numbers.V1.PortingAllPortInPage>'
191
+ end
192
+ end
193
+ class PortingAllPortInInstance < InstanceResource
194
+ ##
195
+ # Initialize the PortingAllPortInInstance
196
+ # @param [Version] version Version that contains the resource
197
+ # @param [Hash] payload payload that contains response from Twilio
198
+ # @param [String] account_sid The SID of the
199
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PortingAllPortIn
200
+ # resource.
201
+ # @param [String] sid The SID of the Call resource to fetch.
202
+ # @return [PortingAllPortInInstance] PortingAllPortInInstance
203
+ def initialize(version, payload )
204
+ super(version)
205
+
206
+ # Marshaled Properties
207
+ @properties = {
208
+ 'port_in_request_sid' => payload['port_in_request_sid'],
209
+ 'port_in_request_status' => payload['port_in_request_status'],
210
+ 'status_last_updated_timestamp' => payload['status_last_updated_timestamp'],
211
+ 'phone_numbers_requested' => payload['phone_numbers_requested'] == nil ? payload['phone_numbers_requested'] : payload['phone_numbers_requested'].to_i,
212
+ 'phone_numbers_ported' => payload['phone_numbers_ported'] == nil ? payload['phone_numbers_ported'] : payload['phone_numbers_ported'].to_i,
213
+ 'suggested_action' => payload['suggested_action'],
214
+ }
215
+ end
216
+
217
+
218
+ ##
219
+ # @return [String] The SID of the Port-in request
220
+ def port_in_request_sid
221
+ @properties['port_in_request_sid']
222
+ end
223
+
224
+ ##
225
+ # @return [String] Status of the Port In Request
226
+ def port_in_request_status
227
+ @properties['port_in_request_status']
228
+ end
229
+
230
+ ##
231
+ # @return [String] The last updated timestamp of the request
232
+ def status_last_updated_timestamp
233
+ @properties['status_last_updated_timestamp']
234
+ end
235
+
236
+ ##
237
+ # @return [String] Amount of phone numbers requested
238
+ def phone_numbers_requested
239
+ @properties['phone_numbers_requested']
240
+ end
241
+
242
+ ##
243
+ # @return [String] Amount of phone numbers ported
244
+ def phone_numbers_ported
245
+ @properties['phone_numbers_ported']
246
+ end
247
+
248
+ ##
249
+ # @return [String] Suggested action on this ticket
250
+ def suggested_action
251
+ @properties['suggested_action']
252
+ end
253
+
254
+ ##
255
+ # Provide a user friendly representation
256
+ def to_s
257
+ "<Twilio.Numbers.V1.PortingAllPortInInstance>"
258
+ end
259
+
260
+ ##
261
+ # Provide a detailed, user friendly representation
262
+ def inspect
263
+ "<Twilio.Numbers.V1.PortingAllPortInInstance>"
264
+ end
265
+ end
266
+
267
+ end
268
+ end
269
+ end
270
+ end
@@ -19,6 +19,94 @@ module Twilio
19
19
  class V1 < Version
20
20
  class PortingPortInList < ListResource
21
21
 
22
+ class NumbersV1PortingAddress
23
+ # @param [street]: [String] The street address, ex: 101 Spear St
24
+ # @param [street_2]: [String] The building information, ex : 5th floor.
25
+ # @param [city]: [String] The city name, ex: San Francisco.
26
+ # @param [state]: [String] The state name, ex: CA or California. Note this should match the losing carrier’s information exactly. So if they spell out the entire state’s name instead of abbreviating it, please do so.
27
+ # @param [zip]: [String] The zip code, ex: 94105.
28
+ # @param [country]: [String] The country, ex: USA.
29
+ attr_accessor :street, :street_2, :city, :state, :zip, :country
30
+ def initialize(payload)
31
+ @street = payload["street"]
32
+ @street_2 = payload["street_2"]
33
+ @city = payload["city"]
34
+ @state = payload["state"]
35
+ @zip = payload["zip"]
36
+ @country = payload["country"]
37
+ end
38
+ def to_json(options = {})
39
+ {
40
+ "street": @street,
41
+ "street_2": @street_2,
42
+ "city": @city,
43
+ "state": @state,
44
+ "zip": @zip,
45
+ "country": @country,
46
+ }.to_json(options)
47
+ end
48
+ end
49
+
50
+ class NumbersV1PortingPortInCreate
51
+ # @param [account_sid]: [String] Account Sid or subaccount where the phone number(s) will be Ported
52
+ # @param [documents]: [Array<String>] List of document SIDs for all phone numbers included in the port in request. At least one document SID referring to a document of the type Utility Bill is required.
53
+ # @param [phone_numbers]: [Array<PortingPortInList.NumbersV1PortingPortInCreatePhoneNumbers>] List of phone numbers to be ported. Maximum of 1,000 phone numbers per request.
54
+ # @param [losing_carrier_information]: [PortingPortInList.NumbersV1PortingLosingCarrierInformation]
55
+ # @param [notification_emails]: [Array<String>] Additional emails to send a copy of the signed LOA to.
56
+ # @param [target_port_in_date]: [Date] Target date to port the number. We cannot guarantee that this date will be honored by the other carriers, please work with Ops to get a confirmation of the firm order commitment (FOC) date. Expected format is ISO Local Date, example: ‘2011-12-03`. This date must be at least 7 days in the future for US ports and 10 days in the future for Japanese ports. We can't guarantee the exact date and time, as this depends on the losing carrier
57
+ # @param [target_port_in_time_range_start]: [String] The earliest time that the port should occur on the target port in date. Expected format is ISO Offset Time, example: ‘10:15:00-08:00'. We can't guarantee the exact date and time, as this depends on the losing carrier
58
+ # @param [target_port_in_time_range_end]: [String] The latest time that the port should occur on the target port in date. Expected format is ISO Offset Time, example: ‘10:15:00-08:00'. We can't guarantee the exact date and time, as this depends on the losing carrier
59
+ # @param [bundle_sid]: [String] The bundle sid is an optional identifier to reference a group of regulatory documents for a port request.
60
+ # @param [portability_advance_carrier]: [String] A field only required for Japan port in requests. It is a unique identifier for the donor carrier service the line is being ported from.
61
+ # @param [auto_cancel_approval_numbers]: [String] Japan specific field, indicates the number of phone numbers to automatically approve for cancellation.
62
+ attr_accessor :account_sid, :documents, :phone_numbers, :losing_carrier_information, :notification_emails, :target_port_in_date, :target_port_in_time_range_start, :target_port_in_time_range_end, :bundle_sid, :portability_advance_carrier, :auto_cancel_approval_numbers
63
+ def initialize(payload)
64
+ @account_sid = payload["account_sid"]
65
+ @documents = payload["documents"]
66
+ @phone_numbers = payload["phone_numbers"]
67
+ @losing_carrier_information = payload["losing_carrier_information"]
68
+ @notification_emails = payload["notification_emails"]
69
+ @target_port_in_date = payload["target_port_in_date"]
70
+ @target_port_in_time_range_start = payload["target_port_in_time_range_start"]
71
+ @target_port_in_time_range_end = payload["target_port_in_time_range_end"]
72
+ @bundle_sid = payload["bundle_sid"]
73
+ @portability_advance_carrier = payload["portability_advance_carrier"]
74
+ @auto_cancel_approval_numbers = payload["auto_cancel_approval_numbers"]
75
+ end
76
+ def to_json(options = {})
77
+ {
78
+ "account_sid": @account_sid,
79
+ "documents": @documents,
80
+ "phone_numbers": @phone_numbers,
81
+ "losing_carrier_information": @losing_carrier_information,
82
+ "notification_emails": @notification_emails,
83
+ "target_port_in_date": @target_port_in_date,
84
+ "target_port_in_time_range_start": @target_port_in_time_range_start,
85
+ "target_port_in_time_range_end": @target_port_in_time_range_end,
86
+ "bundle_sid": @bundle_sid,
87
+ "portability_advance_carrier": @portability_advance_carrier,
88
+ "auto_cancel_approval_numbers": @auto_cancel_approval_numbers,
89
+ }.to_json(options)
90
+ end
91
+ end
92
+
93
+ class NumbersV1PortingPortInCreatePhoneNumbers
94
+ # @param [phone_number]: [String] Phone number to be ported. This must be in the E164 Format.
95
+ # @param [pin]: [String] Some losing carriers require a PIN to authorize the port of a phone number. If the phone number is a US mobile phone number, the PIN is mandatory to process a porting request. Other carriers and number types may also require a PIN, you'll need to contact the losing carrier to determine what your phone number's PIN is.
96
+ attr_accessor :phone_number, :pin
97
+ def initialize(payload)
98
+ @phone_number = payload["phone_number"]
99
+ @pin = payload["pin"]
100
+ end
101
+ def to_json(options = {})
102
+ {
103
+ "phone_number": @phone_number,
104
+ "pin": @pin,
105
+ }.to_json(options)
106
+ end
107
+ end
108
+
109
+
22
110
  ##
23
111
  # Initialize the PortingPortInList
24
112
  # @param [Version] version Version that contains the resource
@@ -32,9 +120,9 @@ module Twilio
32
120
  end
33
121
  ##
34
122
  # Create the PortingPortInInstance
35
- # @param [Object] body
123
+ # @param [NumbersV1PortingPortInCreate] numbers_v1_porting_port_in_create
36
124
  # @return [PortingPortInInstance] Created PortingPortInInstance
37
- def create(body: :unset
125
+ def create(numbers_v1_porting_port_in_create: nil
38
126
  )
39
127
 
40
128
  headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
@@ -43,7 +131,7 @@ module Twilio
43
131
 
44
132
 
45
133
 
46
- payload = @version.create('POST', @uri, headers: headers, data: body.to_json)
134
+ payload = @version.create('POST', @uri, headers: headers, data: numbers_v1_porting_port_in_create.to_json)
47
135
  PortingPortInInstance.new(
48
136
  @version,
49
137
  payload,
@@ -173,6 +261,7 @@ module Twilio
173
261
  'target_port_in_time_range_start' => payload['target_port_in_time_range_start'],
174
262
  'target_port_in_time_range_end' => payload['target_port_in_time_range_end'],
175
263
  'port_in_request_status' => payload['port_in_request_status'],
264
+ 'order_cancellation_reason' => payload['order_cancellation_reason'],
176
265
  'losing_carrier_information' => payload['losing_carrier_information'],
177
266
  'phone_numbers' => payload['phone_numbers'],
178
267
  'bundle_sid' => payload['bundle_sid'],
@@ -247,13 +336,19 @@ module Twilio
247
336
  end
248
337
 
249
338
  ##
250
- # @return [Hash] Details regarding the customer’s information with the losing carrier. These values will be used to generate the letter of authorization and should match the losing carrier’s data as closely as possible to ensure the port is accepted.
339
+ # @return [String] If the order is cancelled this field will provide further context on the cause of the cancellation.
340
+ def order_cancellation_reason
341
+ @properties['order_cancellation_reason']
342
+ end
343
+
344
+ ##
345
+ # @return [NumbersV1PortingLosingCarrierInformation]
251
346
  def losing_carrier_information
252
347
  @properties['losing_carrier_information']
253
348
  end
254
349
 
255
350
  ##
256
- # @return [Array<Hash>]
351
+ # @return [Array<NumbersV1PortingPortInPhoneNumberResult>]
257
352
  def phone_numbers
258
353
  @properties['phone_numbers']
259
354
  end
@@ -23,6 +23,7 @@ module Twilio
23
23
  @version = 'v1'
24
24
  @bulk_eligibilities = nil
25
25
  @eligibilities = nil
26
+ @porting_all_port_ins = nil
26
27
  @porting_port_ins = nil
27
28
  @porting_port_in_phone_number = nil
28
29
  @porting_portabilities = nil
@@ -52,6 +53,11 @@ module Twilio
52
53
  @eligibilities ||= EligibilityList.new self
53
54
  end
54
55
  ##
56
+ # @return [Twilio::REST::Numbers::V1::PortingAllPortInList]
57
+ def porting_all_port_ins
58
+ @porting_all_port_ins ||= PortingAllPortInList.new self
59
+ end
60
+ ##
55
61
  # @param [String] port_in_request_sid The SID of the Port In request. This is a unique identifier of the port in request.
56
62
  # @return [Twilio::REST::Numbers::V1::PortingPortInContext] if portInRequestSid was passed.
57
63
  # @return [Twilio::REST::Numbers::V1::PortingPortInList]
@@ -42,8 +42,8 @@ module Twilio
42
42
  # @param [String] scope The scope of token
43
43
  # @return [TokenInstance] Created TokenInstance
44
44
  def create(
45
- grant_type: nil,
46
- client_id: nil,
45
+ grant_type: :unset,
46
+ client_id: :unset,
47
47
  client_secret: :unset,
48
48
  code: :unset,
49
49
  redirect_uri: :unset,