twilio-ruby 5.31.1 → 5.31.2

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.rubocop_todo.yml +4 -3
  4. data/CHANGES.md +16 -0
  5. data/LICENSE.md +1 -1
  6. data/README.md +2 -2
  7. data/lib/twilio-ruby.rb +5 -5
  8. data/lib/twilio-ruby/rest/client.rb +7 -0
  9. data/lib/twilio-ruby/rest/numbers.rb +44 -0
  10. data/lib/twilio-ruby/rest/numbers/v2.rb +35 -0
  11. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +189 -0
  12. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +482 -0
  13. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.rb +333 -0
  14. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +361 -0
  15. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user_type.rb +281 -0
  16. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +374 -0
  17. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document_type.rb +281 -0
  18. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +30 -5
  19. data/lib/twilio-ruby/rest/studio.rb +16 -3
  20. data/lib/twilio-ruby/rest/studio/v2.rb +50 -0
  21. data/lib/twilio-ruby/rest/studio/v2/flow.rb +451 -0
  22. data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +343 -0
  23. data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +126 -0
  24. data/lib/twilio-ruby/twiml/voice_response.rb +3 -2
  25. data/lib/twilio-ruby/version.rb +1 -1
  26. data/spec/integration/numbers/v2/regulatory_compliance/bundle/item_assignment_spec.rb +198 -0
  27. data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +226 -0
  28. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +214 -0
  29. data/spec/integration/numbers/v2/regulatory_compliance/end_user_type_spec.rb +143 -0
  30. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +226 -0
  31. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_type_spec.rb +133 -0
  32. data/spec/integration/numbers/v2/regulatory_compliance_spec.rb +12 -0
  33. data/spec/integration/serverless/v1/service/environment/log_spec.rb +2 -2
  34. data/spec/integration/studio/v2/flow/flow_revision_spec.rb +112 -0
  35. data/spec/integration/studio/v2/flow_spec.rb +234 -0
  36. data/spec/integration/studio/v2/flow_validate_spec.rb +42 -0
  37. data/twilio-ruby.gemspec +2 -2
  38. metadata +39 -6
@@ -0,0 +1,343 @@
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 Studio < Domain
12
+ class V2 < Version
13
+ class FlowContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class FlowRevisionList < ListResource
17
+ ##
18
+ # Initialize the FlowRevisionList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] sid The unique string that we created to identify the Flow
21
+ # resource.
22
+ # @return [FlowRevisionList] FlowRevisionList
23
+ def initialize(version, sid: nil)
24
+ super(version)
25
+
26
+ # Path Solution
27
+ @solution = {sid: sid}
28
+ @uri = "/Flows/#{@solution[:sid]}/Revisions"
29
+ end
30
+
31
+ ##
32
+ # Lists FlowRevisionInstance records from the API as a list.
33
+ # Unlike stream(), this operation is eager and will load `limit` records into
34
+ # memory before returning.
35
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
36
+ # guarantees to never return more than limit. Default is no limit
37
+ # @param [Integer] page_size Number of records to fetch per request, when
38
+ # not set will use the default value of 50 records. If no page_size is defined
39
+ # but a limit is defined, stream() will attempt to read the limit with the most
40
+ # efficient page size, i.e. min(limit, 1000)
41
+ # @return [Array] Array of up to limit results
42
+ def list(limit: nil, page_size: nil)
43
+ self.stream(limit: limit, page_size: page_size).entries
44
+ end
45
+
46
+ ##
47
+ # Streams FlowRevisionInstance records from the API as an Enumerable.
48
+ # This operation lazily loads records as efficiently as possible until the limit
49
+ # is reached.
50
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
51
+ # guarantees to never return more than limit. Default is no limit.
52
+ # @param [Integer] page_size Number of records to fetch per request, when
53
+ # not set will use the default value of 50 records. If no page_size is defined
54
+ # but a limit is defined, stream() will attempt to read the limit with the most
55
+ # efficient page size, i.e. min(limit, 1000)
56
+ # @return [Enumerable] Enumerable that will yield up to limit results
57
+ def stream(limit: nil, page_size: nil)
58
+ limits = @version.read_limits(limit, page_size)
59
+
60
+ page = self.page(page_size: limits[:page_size], )
61
+
62
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
63
+ end
64
+
65
+ ##
66
+ # When passed a block, yields FlowRevisionInstance records from the API.
67
+ # This operation lazily loads records as efficiently as possible until the limit
68
+ # is reached.
69
+ def each
70
+ limits = @version.read_limits
71
+
72
+ page = self.page(page_size: limits[:page_size], )
73
+
74
+ @version.stream(page,
75
+ limit: limits[:limit],
76
+ page_limit: limits[:page_limit]).each {|x| yield x}
77
+ end
78
+
79
+ ##
80
+ # Retrieve a single page of FlowRevisionInstance records from the API.
81
+ # Request is executed immediately.
82
+ # @param [String] page_token PageToken provided by the API
83
+ # @param [Integer] page_number Page Number, this value is simply for client state
84
+ # @param [Integer] page_size Number of records to return, defaults to 50
85
+ # @return [Page] Page of FlowRevisionInstance
86
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
87
+ params = Twilio::Values.of({
88
+ 'PageToken' => page_token,
89
+ 'Page' => page_number,
90
+ 'PageSize' => page_size,
91
+ })
92
+ response = @version.page(
93
+ 'GET',
94
+ @uri,
95
+ params
96
+ )
97
+ FlowRevisionPage.new(@version, response, @solution)
98
+ end
99
+
100
+ ##
101
+ # Retrieve a single page of FlowRevisionInstance records from the API.
102
+ # Request is executed immediately.
103
+ # @param [String] target_url API-generated URL for the requested results page
104
+ # @return [Page] Page of FlowRevisionInstance
105
+ def get_page(target_url)
106
+ response = @version.domain.request(
107
+ 'GET',
108
+ target_url
109
+ )
110
+ FlowRevisionPage.new(@version, response, @solution)
111
+ end
112
+
113
+ ##
114
+ # Provide a user friendly representation
115
+ def to_s
116
+ '#<Twilio.Studio.V2.FlowRevisionList>'
117
+ end
118
+ end
119
+
120
+ ##
121
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
122
+ class FlowRevisionPage < Page
123
+ ##
124
+ # Initialize the FlowRevisionPage
125
+ # @param [Version] version Version that contains the resource
126
+ # @param [Response] response Response from the API
127
+ # @param [Hash] solution Path solution for the resource
128
+ # @return [FlowRevisionPage] FlowRevisionPage
129
+ def initialize(version, response, solution)
130
+ super(version, response)
131
+
132
+ # Path Solution
133
+ @solution = solution
134
+ end
135
+
136
+ ##
137
+ # Build an instance of FlowRevisionInstance
138
+ # @param [Hash] payload Payload response from the API
139
+ # @return [FlowRevisionInstance] FlowRevisionInstance
140
+ def get_instance(payload)
141
+ FlowRevisionInstance.new(@version, payload, sid: @solution[:sid], )
142
+ end
143
+
144
+ ##
145
+ # Provide a user friendly representation
146
+ def to_s
147
+ '<Twilio.Studio.V2.FlowRevisionPage>'
148
+ end
149
+ end
150
+
151
+ ##
152
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
153
+ class FlowRevisionContext < InstanceContext
154
+ ##
155
+ # Initialize the FlowRevisionContext
156
+ # @param [Version] version Version that contains the resource
157
+ # @param [String] sid The SID of the Flow resource to fetch.
158
+ # @param [String] revision Specific Revision number or can be `LatestPublished`
159
+ # and `LatestRevision`.
160
+ # @return [FlowRevisionContext] FlowRevisionContext
161
+ def initialize(version, sid, revision)
162
+ super(version)
163
+
164
+ # Path Solution
165
+ @solution = {sid: sid, revision: revision, }
166
+ @uri = "/Flows/#{@solution[:sid]}/Revisions/#{@solution[:revision]}"
167
+ end
168
+
169
+ ##
170
+ # Fetch a FlowRevisionInstance
171
+ # @return [FlowRevisionInstance] Fetched FlowRevisionInstance
172
+ def fetch
173
+ params = Twilio::Values.of({})
174
+
175
+ payload = @version.fetch(
176
+ 'GET',
177
+ @uri,
178
+ params,
179
+ )
180
+
181
+ FlowRevisionInstance.new(@version, payload, sid: @solution[:sid], revision: @solution[:revision], )
182
+ end
183
+
184
+ ##
185
+ # Provide a user friendly representation
186
+ def to_s
187
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
188
+ "#<Twilio.Studio.V2.FlowRevisionContext #{context}>"
189
+ end
190
+
191
+ ##
192
+ # Provide a detailed, user friendly representation
193
+ def inspect
194
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
195
+ "#<Twilio.Studio.V2.FlowRevisionContext #{context}>"
196
+ end
197
+ end
198
+
199
+ ##
200
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
201
+ class FlowRevisionInstance < InstanceResource
202
+ ##
203
+ # Initialize the FlowRevisionInstance
204
+ # @param [Version] version Version that contains the resource
205
+ # @param [Hash] payload payload that contains response from Twilio
206
+ # @param [String] sid The unique string that we created to identify the Flow
207
+ # resource.
208
+ # @param [String] revision Specific Revision number or can be `LatestPublished`
209
+ # and `LatestRevision`.
210
+ # @return [FlowRevisionInstance] FlowRevisionInstance
211
+ def initialize(version, payload, sid: nil, revision: nil)
212
+ super(version)
213
+
214
+ # Marshaled Properties
215
+ @properties = {
216
+ 'sid' => payload['sid'],
217
+ 'account_sid' => payload['account_sid'],
218
+ 'friendly_name' => payload['friendly_name'],
219
+ 'definition' => payload['definition'],
220
+ 'status' => payload['status'],
221
+ 'revision' => payload['revision'].to_i,
222
+ 'commit_message' => payload['commit_message'],
223
+ 'valid' => payload['valid'],
224
+ 'errors' => payload['errors'],
225
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
226
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
227
+ 'url' => payload['url'],
228
+ }
229
+
230
+ # Context
231
+ @instance_context = nil
232
+ @params = {'sid' => sid, 'revision' => revision || @properties['revision'], }
233
+ end
234
+
235
+ ##
236
+ # Generate an instance context for the instance, the context is capable of
237
+ # performing various actions. All instance actions are proxied to the context
238
+ # @return [FlowRevisionContext] FlowRevisionContext for this FlowRevisionInstance
239
+ def context
240
+ unless @instance_context
241
+ @instance_context = FlowRevisionContext.new(@version, @params['sid'], @params['revision'], )
242
+ end
243
+ @instance_context
244
+ end
245
+
246
+ ##
247
+ # @return [String] The unique string that identifies the resource
248
+ def sid
249
+ @properties['sid']
250
+ end
251
+
252
+ ##
253
+ # @return [String] The SID of the Account that created the resource
254
+ def account_sid
255
+ @properties['account_sid']
256
+ end
257
+
258
+ ##
259
+ # @return [String] The string that you assigned to describe the Flow
260
+ def friendly_name
261
+ @properties['friendly_name']
262
+ end
263
+
264
+ ##
265
+ # @return [Hash] JSON representation of flow definition
266
+ def definition
267
+ @properties['definition']
268
+ end
269
+
270
+ ##
271
+ # @return [flow_revision.Status] The status of the Flow
272
+ def status
273
+ @properties['status']
274
+ end
275
+
276
+ ##
277
+ # @return [String] The latest revision number of the Flow's definition
278
+ def revision
279
+ @properties['revision']
280
+ end
281
+
282
+ ##
283
+ # @return [String] Description on change made in the revision
284
+ def commit_message
285
+ @properties['commit_message']
286
+ end
287
+
288
+ ##
289
+ # @return [Boolean] Boolean if the flow definition is valid
290
+ def valid
291
+ @properties['valid']
292
+ end
293
+
294
+ ##
295
+ # @return [Hash] List of error in the flow definition
296
+ def errors
297
+ @properties['errors']
298
+ end
299
+
300
+ ##
301
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
302
+ def date_created
303
+ @properties['date_created']
304
+ end
305
+
306
+ ##
307
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
308
+ def date_updated
309
+ @properties['date_updated']
310
+ end
311
+
312
+ ##
313
+ # @return [String] The absolute URL of the resource
314
+ def url
315
+ @properties['url']
316
+ end
317
+
318
+ ##
319
+ # Fetch a FlowRevisionInstance
320
+ # @return [FlowRevisionInstance] Fetched FlowRevisionInstance
321
+ def fetch
322
+ context.fetch
323
+ end
324
+
325
+ ##
326
+ # Provide a user friendly representation
327
+ def to_s
328
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
329
+ "<Twilio.Studio.V2.FlowRevisionInstance #{values}>"
330
+ end
331
+
332
+ ##
333
+ # Provide a detailed, user friendly representation
334
+ def inspect
335
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
336
+ "<Twilio.Studio.V2.FlowRevisionInstance #{values}>"
337
+ end
338
+ end
339
+ end
340
+ end
341
+ end
342
+ end
343
+ end
@@ -0,0 +1,126 @@
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 Studio < 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 FlowValidateList < ListResource
16
+ ##
17
+ # Initialize the FlowValidateList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [FlowValidateList] FlowValidateList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/Flows/Validate"
26
+ end
27
+
28
+ ##
29
+ # Update the FlowValidateInstance
30
+ # @param [String] friendly_name The friendly_name
31
+ # @param [flow_validate.Status] status The status
32
+ # @param [String] definition The definition
33
+ # @param [String] commit_message The commit_message
34
+ # @return [FlowValidateInstance] Updated FlowValidateInstance
35
+ def update(friendly_name: nil, status: nil, definition: nil, commit_message: :unset)
36
+ data = Twilio::Values.of({
37
+ 'FriendlyName' => friendly_name,
38
+ 'Status' => status,
39
+ 'Definition' => definition,
40
+ 'CommitMessage' => commit_message,
41
+ })
42
+
43
+ payload = @version.update(
44
+ 'POST',
45
+ @uri,
46
+ data: data,
47
+ )
48
+
49
+ FlowValidateInstance.new(@version, payload, )
50
+ end
51
+
52
+ ##
53
+ # Provide a user friendly representation
54
+ def to_s
55
+ '#<Twilio.Studio.V2.FlowValidateList>'
56
+ end
57
+ end
58
+
59
+ ##
60
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
61
+ class FlowValidatePage < Page
62
+ ##
63
+ # Initialize the FlowValidatePage
64
+ # @param [Version] version Version that contains the resource
65
+ # @param [Response] response Response from the API
66
+ # @param [Hash] solution Path solution for the resource
67
+ # @return [FlowValidatePage] FlowValidatePage
68
+ def initialize(version, response, solution)
69
+ super(version, response)
70
+
71
+ # Path Solution
72
+ @solution = solution
73
+ end
74
+
75
+ ##
76
+ # Build an instance of FlowValidateInstance
77
+ # @param [Hash] payload Payload response from the API
78
+ # @return [FlowValidateInstance] FlowValidateInstance
79
+ def get_instance(payload)
80
+ FlowValidateInstance.new(@version, payload, )
81
+ end
82
+
83
+ ##
84
+ # Provide a user friendly representation
85
+ def to_s
86
+ '<Twilio.Studio.V2.FlowValidatePage>'
87
+ end
88
+ end
89
+
90
+ ##
91
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
92
+ class FlowValidateInstance < InstanceResource
93
+ ##
94
+ # Initialize the FlowValidateInstance
95
+ # @param [Version] version Version that contains the resource
96
+ # @param [Hash] payload payload that contains response from Twilio
97
+ # @return [FlowValidateInstance] FlowValidateInstance
98
+ def initialize(version, payload)
99
+ super(version)
100
+
101
+ # Marshaled Properties
102
+ @properties = {'valid' => payload['valid'], }
103
+ end
104
+
105
+ ##
106
+ # @return [Boolean] The valid
107
+ def valid
108
+ @properties['valid']
109
+ end
110
+
111
+ ##
112
+ # Provide a user friendly representation
113
+ def to_s
114
+ "<Twilio.Studio.V2.FlowValidateInstance>"
115
+ end
116
+
117
+ ##
118
+ # Provide a detailed, user friendly representation
119
+ def inspect
120
+ "<Twilio.Studio.V2.FlowValidateInstance>"
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end