twilio-ruby 7.0.1 → 7.1.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +55 -0
  3. data/Gemfile +1 -0
  4. data/README.md +2 -2
  5. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +6 -6
  6. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +1 -1
  7. data/lib/twilio-ruby/rest/client.rb +0 -5
  8. data/lib/twilio-ruby/rest/content/v2/content.rb +259 -0
  9. data/lib/twilio-ruby/rest/content/v2/content_and_approvals.rb +252 -0
  10. data/lib/twilio-ruby/rest/content/v2.rb +46 -0
  11. data/lib/twilio-ruby/rest/content_base.rb +6 -1
  12. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +1 -1
  13. data/lib/twilio-ruby/rest/flex_api/v1/plugin/plugin_versions.rb +8 -1
  14. data/lib/twilio-ruby/rest/flex_api/v2/flex_user.rb +289 -0
  15. data/lib/twilio-ruby/rest/flex_api/v2/web_channels.rb +5 -2
  16. data/lib/twilio-ruby/rest/flex_api/v2.rb +37 -0
  17. data/lib/twilio-ruby/rest/intelligence/v2/custom_operator.rb +444 -0
  18. data/lib/twilio-ruby/rest/intelligence/v2/operator.rb +355 -0
  19. data/lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb +215 -0
  20. data/lib/twilio-ruby/rest/intelligence/v2/operator_attachments.rb +196 -0
  21. data/lib/twilio-ruby/rest/intelligence/v2/operator_type.rb +357 -0
  22. data/lib/twilio-ruby/rest/intelligence/v2/prebuilt_operator.rb +355 -0
  23. data/lib/twilio-ruby/rest/intelligence/v2/service.rb +9 -8
  24. data/lib/twilio-ruby/rest/intelligence/v2/transcript.rb +18 -18
  25. data/lib/twilio-ruby/rest/intelligence/v2.rb +112 -0
  26. data/lib/twilio-ruby/rest/messaging/v1/service.rb +0 -7
  27. data/lib/twilio-ruby/rest/numbers/v1/porting_port_in.rb +154 -4
  28. data/lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb +292 -0
  29. data/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration.rb +148 -0
  30. data/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_delete.rb +167 -0
  31. data/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_fetch.rb +160 -0
  32. data/lib/twilio-ruby/rest/numbers/v1.rb +63 -20
  33. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +1 -1
  34. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +2 -2
  35. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +2 -2
  36. data/lib/twilio-ruby/rest/preview/sync/service.rb +2 -2
  37. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +1 -1
  38. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +2 -2
  39. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +2 -2
  40. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +1 -1
  41. data/lib/twilio-ruby/rest/sync/v1/service.rb +3 -3
  42. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +33 -4
  43. data/lib/twilio-ruby/rest/trusthub/v1/compliance_tollfree_inquiries.rb +4 -1
  44. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +7 -0
  45. data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +7 -0
  46. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +1 -1
  47. data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +1 -1
  48. data/lib/twilio-ruby/rest/verify/v2/service.rb +1 -1
  49. data/lib/twilio-ruby/version.rb +1 -1
  50. metadata +16 -9
  51. data/lib/twilio-ruby/rest/numbers/v1/porting_bulk_portability.rb +0 -230
  52. data/lib/twilio-ruby/rest/numbers/v1/porting_port_in_fetch.rb +0 -252
  53. data/lib/twilio-ruby/rest/preview_messaging/v1/broadcast.rb +0 -164
  54. data/lib/twilio-ruby/rest/preview_messaging/v1/message.rb +0 -235
  55. data/lib/twilio-ruby/rest/preview_messaging/v1.rb +0 -46
  56. data/lib/twilio-ruby/rest/preview_messaging.rb +0 -12
  57. data/lib/twilio-ruby/rest/preview_messaging_base.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87282b59934c59ef97afb9ec219bf3e4b84834b1
4
- data.tar.gz: daab71d45a3dd7d2cf1a92b54303506c1f474de6
3
+ metadata.gz: f71d5659db847a052763617e04e4c70e7f6c6f85
4
+ data.tar.gz: 41d828b50f287396e6f396031c60589b93000e47
5
5
  SHA512:
6
- metadata.gz: 675d66180d805096fc40152ec2de327a00a28e2bcd96784c454b3859a2aa51da4c70651822f9a99a581d8984f91940017b388d096b464db35f5917b204f6da21
7
- data.tar.gz: 53c10c95ff94ee894cac40055152f0f439cd7c32dc51276839231673b5abf9fb82d88b11883730e5ef01ced4b50cd2fc7264baa68333efb799d82c657cdbb586
6
+ metadata.gz: ad4b018328b80cba16bf6a84fba4bd91ee983fd7190766b8d5ea07f71dc0720804a80074f00dbb087a4a8f0bc8e94579acca90a302fc5fbbe761fdba7d3af538
7
+ data.tar.gz: c39823aeb05c0be4a37eaae418b0424e1ad408a333234ddc6ded603797626698ce6ed7c3eb7cf4c7a8517d3d772862d7036bfe7b029b8ec9cb8558b21278c945
data/CHANGES.md CHANGED
@@ -1,6 +1,61 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2024-05-24] Version 7.1.0
5
+ --------------------------
6
+ **Library - Chore**
7
+ - [PR #720](https://github.com/twilio/twilio-ruby/pull/720): removing preview_messaging reference. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)!
8
+
9
+ **Api**
10
+ - Add ie1 as supported region for UserDefinedMessage and UserDefinedMessageSubscription.
11
+
12
+ **Flex**
13
+ - Adding validated field to `plugin_versions`
14
+ - Corrected the data type for `runtime_domain`, `call_recording_webhook_url`, `crm_callback_url`, `crm_fallback_url`, `flex_url` in Flex Configuration
15
+ - Making `routing` optional in Create Interactions endpoint
16
+
17
+ **Intelligence**
18
+ - Expose operator authoring apis to public visibility
19
+ - Deleted `language_code` parameter from updating service in v2 **(breaking change)**
20
+ - Add read_only_attached_operator_sids to v2 services
21
+
22
+ **Numbers**
23
+ - Add API endpoint for GET Porting Webhook Configurations By Account SID
24
+ - Remove bulk portability api under version `/v1`. **(breaking change)**
25
+ - Removed porting_port_in_fetch.json files and move the content into porting_port_in.json files
26
+ - Add API endpoint to deleting Webhook Configurations
27
+ - Add Get Phone Number by Port in request SID and Phone Number SID api
28
+ - Add Create Porting webhook configuration API
29
+ - Added bundle_sid and losing_carrier_information fields to Create PortInRequest api to support Japan porting
30
+
31
+ **Taskrouter**
32
+ - Add back `routing_target` property to tasks
33
+ - Add back `ignore_capacity` property to tasks
34
+ - Removing `routing_target` property to tasks due to revert
35
+ - Removing `ignore_capacity` property to tasks due to revert
36
+ - Add `routing_target` property to tasks
37
+ - Add `ignore_capacity` property to tasks
38
+
39
+ **Trusthub**
40
+ - Add new field errors to bundle as part of public API response in customer_profile.json and trust_product.json **(breaking change)**
41
+ - Add themeSetId field in compliance_tollfree_inquiry.
42
+
43
+ **Verify**
44
+ - Update `friendly_name` description on service docs
45
+
46
+
47
+ [2024-04-18] Version 7.0.2
48
+ --------------------------
49
+ **Flex**
50
+ - Add header `ui_version` to `web_channels` API
51
+
52
+ **Messaging**
53
+ - Redeploy after failed pipeline
54
+
55
+ **Numbers**
56
+ - Add Delete Port In request phone number api and Add Delete Port In request api
57
+
58
+
4
59
  [2024-04-04] Version 7.0.1
5
60
  --------------------------
6
61
  **Api**
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ gem 'simplecov', require: false, group: :test
3
3
  gemspec
4
4
 
5
5
  gem "base64"
6
+ gem "rexml"
data/README.md CHANGED
@@ -39,13 +39,13 @@ This library supports the following Ruby implementations:
39
39
  To install using [Bundler][bundler] grab the latest stable version:
40
40
 
41
41
  ```ruby
42
- gem 'twilio-ruby', '~> 7.0.1'
42
+ gem 'twilio-ruby', '~> 7.1.0'
43
43
  ```
44
44
 
45
45
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
46
46
 
47
47
  ```bash
48
- gem install twilio-ruby -v 7.0.1
48
+ gem install twilio-ruby -v 7.1.0
49
49
  ```
50
50
 
51
51
  To build and install the development branch yourself from the latest source:
@@ -35,11 +35,11 @@ module Twilio
35
35
  end
36
36
  ##
37
37
  # Create the StreamInstance
38
- # @param [String] url Relative or absolute url where WebSocket connection will be established.
39
- # @param [String] name The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream.
38
+ # @param [String] url Relative or absolute URL where WebSocket connection will be established.
39
+ # @param [String] name The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream.
40
40
  # @param [Track] track
41
- # @param [String] status_callback Absolute URL of the status callback.
42
- # @param [String] status_callback_method The http method for the status_callback (one of GET, POST).
41
+ # @param [String] status_callback Absolute URL to which Twilio sends status callback HTTP requests.
42
+ # @param [String] status_callback_method The HTTP method Twilio uses when sending `status_callback` requests. Possible values are `GET` and `POST`. Default is `POST`.
43
43
  # @param [String] parameter1_name Parameter name
44
44
  # @param [String] parameter1_value Parameter value
45
45
  # @param [String] parameter2_name Parameter name
@@ -677,7 +677,7 @@ module Twilio
677
677
  # @param [Version] version Version that contains the resource
678
678
  # @param [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource.
679
679
  # @param [String] call_sid The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with.
680
- # @param [String] sid The SID of the Stream resource, or the `name` used when creating the resource
680
+ # @param [String] sid The SID or the `name` of the Stream resource to be stopped
681
681
  # @return [StreamContext] StreamContext
682
682
  def initialize(version, account_sid, call_sid, sid)
683
683
  super(version)
@@ -814,7 +814,7 @@ module Twilio
814
814
  end
815
815
 
816
816
  ##
817
- # @return [String] The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream.
817
+ # @return [String] The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream.
818
818
  def name
819
819
  @properties['name']
820
820
  end
@@ -510,7 +510,7 @@ module Twilio
510
510
  end
511
511
 
512
512
  ##
513
- # @return [String] The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. The value is `null` if a Messaging Service was not used.
513
+ # @return [String] The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. A unique default value is assigned if a Messaging Service is not used.
514
514
  def messaging_service_sid
515
515
  @properties['messaging_service_sid']
516
516
  end
@@ -82,11 +82,6 @@ module Twilio
82
82
  @lookups ||= Lookups.new self
83
83
  end
84
84
  ##
85
- # Access the PreviewMessaging Twilio Domain
86
- def preview_messaging
87
- @preview_messaging ||= PreviewMessaging.new self
88
- end
89
- ##
90
85
  # Access the Messaging Twilio Domain
91
86
  def messaging
92
87
  @messaging ||= Messaging.new self
@@ -0,0 +1,259 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Content
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 Content < ContentBase
19
+ class V2 < Version
20
+ class ContentList < ListResource
21
+
22
+ ##
23
+ # Initialize the ContentList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [ContentList] ContentList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = "/Content"
31
+
32
+ end
33
+
34
+ ##
35
+ # Lists ContentInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
39
+ # guarantees to never return more than limit. Default is no limit
40
+ # @param [Integer] page_size Number of records to fetch per request, when
41
+ # not set will use the default value of 50 records. If no page_size is defined
42
+ # but a limit is defined, stream() will attempt to read the limit with the most
43
+ # efficient page size, i.e. min(limit, 1000)
44
+ # @return [Array] Array of up to limit results
45
+ def list(limit: nil, page_size: nil)
46
+ self.stream(
47
+ limit: limit,
48
+ page_size: page_size
49
+ ).entries
50
+ end
51
+
52
+ ##
53
+ # Streams Instance records from the API as an Enumerable.
54
+ # This operation lazily loads records as efficiently as possible until the limit
55
+ # is reached.
56
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
57
+ # guarantees to never return more than limit. Default is no limit
58
+ # @param [Integer] page_size Number of records to fetch per request, when
59
+ # not set will use the default value of 50 records. If no page_size is defined
60
+ # but a limit is defined, stream() will attempt to read the limit with the most
61
+ # efficient page size, i.e. min(limit, 1000)
62
+ # @return [Enumerable] Enumerable that will yield up to limit results
63
+ def stream(limit: nil, page_size: nil)
64
+ limits = @version.read_limits(limit, page_size)
65
+
66
+ page = self.page(
67
+ page_size: limits[:page_size], )
68
+
69
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
70
+ end
71
+
72
+ ##
73
+ # When passed a block, yields ContentInstance records from the API.
74
+ # This operation lazily loads records as efficiently as possible until the limit
75
+ # is reached.
76
+ def each
77
+ limits = @version.read_limits
78
+
79
+ page = self.page(page_size: limits[:page_size], )
80
+
81
+ @version.stream(page,
82
+ limit: limits[:limit],
83
+ page_limit: limits[:page_limit]).each {|x| yield x}
84
+ end
85
+
86
+ ##
87
+ # Retrieve a single page of ContentInstance records from the API.
88
+ # Request is executed immediately.
89
+ # @param [String] page_token PageToken provided by the API
90
+ # @param [Integer] page_number Page Number, this value is simply for client state
91
+ # @param [Integer] page_size Number of records to return, defaults to 50
92
+ # @return [Page] Page of ContentInstance
93
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
94
+ params = Twilio::Values.of({
95
+ 'PageToken' => page_token,
96
+ 'Page' => page_number,
97
+ 'PageSize' => page_size,
98
+ })
99
+
100
+ response = @version.page('GET', @uri, params: params)
101
+
102
+ ContentPage.new(@version, response, @solution)
103
+ end
104
+
105
+ ##
106
+ # Retrieve a single page of ContentInstance records from the API.
107
+ # Request is executed immediately.
108
+ # @param [String] target_url API-generated URL for the requested results page
109
+ # @return [Page] Page of ContentInstance
110
+ def get_page(target_url)
111
+ response = @version.domain.request(
112
+ 'GET',
113
+ target_url
114
+ )
115
+ ContentPage.new(@version, response, @solution)
116
+ end
117
+
118
+
119
+
120
+ # Provide a user friendly representation
121
+ def to_s
122
+ '#<Twilio.Content.V2.ContentList>'
123
+ end
124
+ end
125
+
126
+ class ContentPage < Page
127
+ ##
128
+ # Initialize the ContentPage
129
+ # @param [Version] version Version that contains the resource
130
+ # @param [Response] response Response from the API
131
+ # @param [Hash] solution Path solution for the resource
132
+ # @return [ContentPage] ContentPage
133
+ def initialize(version, response, solution)
134
+ super(version, response)
135
+
136
+ # Path Solution
137
+ @solution = solution
138
+ end
139
+
140
+ ##
141
+ # Build an instance of ContentInstance
142
+ # @param [Hash] payload Payload response from the API
143
+ # @return [ContentInstance] ContentInstance
144
+ def get_instance(payload)
145
+ ContentInstance.new(@version, payload)
146
+ end
147
+
148
+ ##
149
+ # Provide a user friendly representation
150
+ def to_s
151
+ '<Twilio.Content.V2.ContentPage>'
152
+ end
153
+ end
154
+ class ContentInstance < InstanceResource
155
+ ##
156
+ # Initialize the ContentInstance
157
+ # @param [Version] version Version that contains the resource
158
+ # @param [Hash] payload payload that contains response from Twilio
159
+ # @param [String] account_sid The SID of the
160
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Content
161
+ # resource.
162
+ # @param [String] sid The SID of the Call resource to fetch.
163
+ # @return [ContentInstance] ContentInstance
164
+ def initialize(version, payload )
165
+ super(version)
166
+
167
+ # Marshaled Properties
168
+ @properties = {
169
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
170
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
171
+ 'sid' => payload['sid'],
172
+ 'account_sid' => payload['account_sid'],
173
+ 'friendly_name' => payload['friendly_name'],
174
+ 'language' => payload['language'],
175
+ 'variables' => payload['variables'],
176
+ 'types' => payload['types'],
177
+ 'url' => payload['url'],
178
+ 'links' => payload['links'],
179
+ }
180
+ end
181
+
182
+
183
+ ##
184
+ # @return [Time] The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
185
+ def date_created
186
+ @properties['date_created']
187
+ end
188
+
189
+ ##
190
+ # @return [Time] The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
191
+ def date_updated
192
+ @properties['date_updated']
193
+ end
194
+
195
+ ##
196
+ # @return [String] The unique string that that we created to identify the Content resource.
197
+ def sid
198
+ @properties['sid']
199
+ end
200
+
201
+ ##
202
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
203
+ def account_sid
204
+ @properties['account_sid']
205
+ end
206
+
207
+ ##
208
+ # @return [String] A string name used to describe the Content resource. Not visible to the end recipient.
209
+ def friendly_name
210
+ @properties['friendly_name']
211
+ end
212
+
213
+ ##
214
+ # @return [String] Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
215
+ def language
216
+ @properties['language']
217
+ end
218
+
219
+ ##
220
+ # @return [Hash] Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
221
+ def variables
222
+ @properties['variables']
223
+ end
224
+
225
+ ##
226
+ # @return [Hash] The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource.
227
+ def types
228
+ @properties['types']
229
+ end
230
+
231
+ ##
232
+ # @return [String] The URL of the resource, relative to `https://content.twilio.com`.
233
+ def url
234
+ @properties['url']
235
+ end
236
+
237
+ ##
238
+ # @return [Hash] A list of links related to the Content resource, such as approval_fetch and approval_create
239
+ def links
240
+ @properties['links']
241
+ end
242
+
243
+ ##
244
+ # Provide a user friendly representation
245
+ def to_s
246
+ "<Twilio.Content.V2.ContentInstance>"
247
+ end
248
+
249
+ ##
250
+ # Provide a detailed, user friendly representation
251
+ def inspect
252
+ "<Twilio.Content.V2.ContentInstance>"
253
+ end
254
+ end
255
+
256
+ end
257
+ end
258
+ end
259
+ end
@@ -0,0 +1,252 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Content
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 Content < ContentBase
19
+ class V2 < Version
20
+ class ContentAndApprovalsList < ListResource
21
+
22
+ ##
23
+ # Initialize the ContentAndApprovalsList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [ContentAndApprovalsList] ContentAndApprovalsList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = "/ContentAndApprovals"
31
+
32
+ end
33
+
34
+ ##
35
+ # Lists ContentAndApprovalsInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
39
+ # guarantees to never return more than limit. Default is no limit
40
+ # @param [Integer] page_size Number of records to fetch per request, when
41
+ # not set will use the default value of 50 records. If no page_size is defined
42
+ # but a limit is defined, stream() will attempt to read the limit with the most
43
+ # efficient page size, i.e. min(limit, 1000)
44
+ # @return [Array] Array of up to limit results
45
+ def list(limit: nil, page_size: nil)
46
+ self.stream(
47
+ limit: limit,
48
+ page_size: page_size
49
+ ).entries
50
+ end
51
+
52
+ ##
53
+ # Streams Instance records from the API as an Enumerable.
54
+ # This operation lazily loads records as efficiently as possible until the limit
55
+ # is reached.
56
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
57
+ # guarantees to never return more than limit. Default is no limit
58
+ # @param [Integer] page_size Number of records to fetch per request, when
59
+ # not set will use the default value of 50 records. If no page_size is defined
60
+ # but a limit is defined, stream() will attempt to read the limit with the most
61
+ # efficient page size, i.e. min(limit, 1000)
62
+ # @return [Enumerable] Enumerable that will yield up to limit results
63
+ def stream(limit: nil, page_size: nil)
64
+ limits = @version.read_limits(limit, page_size)
65
+
66
+ page = self.page(
67
+ page_size: limits[:page_size], )
68
+
69
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
70
+ end
71
+
72
+ ##
73
+ # When passed a block, yields ContentAndApprovalsInstance records from the API.
74
+ # This operation lazily loads records as efficiently as possible until the limit
75
+ # is reached.
76
+ def each
77
+ limits = @version.read_limits
78
+
79
+ page = self.page(page_size: limits[:page_size], )
80
+
81
+ @version.stream(page,
82
+ limit: limits[:limit],
83
+ page_limit: limits[:page_limit]).each {|x| yield x}
84
+ end
85
+
86
+ ##
87
+ # Retrieve a single page of ContentAndApprovalsInstance records from the API.
88
+ # Request is executed immediately.
89
+ # @param [String] page_token PageToken provided by the API
90
+ # @param [Integer] page_number Page Number, this value is simply for client state
91
+ # @param [Integer] page_size Number of records to return, defaults to 50
92
+ # @return [Page] Page of ContentAndApprovalsInstance
93
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
94
+ params = Twilio::Values.of({
95
+ 'PageToken' => page_token,
96
+ 'Page' => page_number,
97
+ 'PageSize' => page_size,
98
+ })
99
+
100
+ response = @version.page('GET', @uri, params: params)
101
+
102
+ ContentAndApprovalsPage.new(@version, response, @solution)
103
+ end
104
+
105
+ ##
106
+ # Retrieve a single page of ContentAndApprovalsInstance records from the API.
107
+ # Request is executed immediately.
108
+ # @param [String] target_url API-generated URL for the requested results page
109
+ # @return [Page] Page of ContentAndApprovalsInstance
110
+ def get_page(target_url)
111
+ response = @version.domain.request(
112
+ 'GET',
113
+ target_url
114
+ )
115
+ ContentAndApprovalsPage.new(@version, response, @solution)
116
+ end
117
+
118
+
119
+
120
+ # Provide a user friendly representation
121
+ def to_s
122
+ '#<Twilio.Content.V2.ContentAndApprovalsList>'
123
+ end
124
+ end
125
+
126
+ class ContentAndApprovalsPage < Page
127
+ ##
128
+ # Initialize the ContentAndApprovalsPage
129
+ # @param [Version] version Version that contains the resource
130
+ # @param [Response] response Response from the API
131
+ # @param [Hash] solution Path solution for the resource
132
+ # @return [ContentAndApprovalsPage] ContentAndApprovalsPage
133
+ def initialize(version, response, solution)
134
+ super(version, response)
135
+
136
+ # Path Solution
137
+ @solution = solution
138
+ end
139
+
140
+ ##
141
+ # Build an instance of ContentAndApprovalsInstance
142
+ # @param [Hash] payload Payload response from the API
143
+ # @return [ContentAndApprovalsInstance] ContentAndApprovalsInstance
144
+ def get_instance(payload)
145
+ ContentAndApprovalsInstance.new(@version, payload)
146
+ end
147
+
148
+ ##
149
+ # Provide a user friendly representation
150
+ def to_s
151
+ '<Twilio.Content.V2.ContentAndApprovalsPage>'
152
+ end
153
+ end
154
+ class ContentAndApprovalsInstance < InstanceResource
155
+ ##
156
+ # Initialize the ContentAndApprovalsInstance
157
+ # @param [Version] version Version that contains the resource
158
+ # @param [Hash] payload payload that contains response from Twilio
159
+ # @param [String] account_sid The SID of the
160
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this ContentAndApprovals
161
+ # resource.
162
+ # @param [String] sid The SID of the Call resource to fetch.
163
+ # @return [ContentAndApprovalsInstance] ContentAndApprovalsInstance
164
+ def initialize(version, payload )
165
+ super(version)
166
+
167
+ # Marshaled Properties
168
+ @properties = {
169
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
170
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
171
+ 'sid' => payload['sid'],
172
+ 'account_sid' => payload['account_sid'],
173
+ 'friendly_name' => payload['friendly_name'],
174
+ 'language' => payload['language'],
175
+ 'variables' => payload['variables'],
176
+ 'types' => payload['types'],
177
+ 'approval_requests' => payload['approval_requests'],
178
+ }
179
+ end
180
+
181
+
182
+ ##
183
+ # @return [Time] The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
184
+ def date_created
185
+ @properties['date_created']
186
+ end
187
+
188
+ ##
189
+ # @return [Time] The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
190
+ def date_updated
191
+ @properties['date_updated']
192
+ end
193
+
194
+ ##
195
+ # @return [String] The unique string that that we created to identify the Content resource.
196
+ def sid
197
+ @properties['sid']
198
+ end
199
+
200
+ ##
201
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
202
+ def account_sid
203
+ @properties['account_sid']
204
+ end
205
+
206
+ ##
207
+ # @return [String] A string name used to describe the Content resource. Not visible to the end recipient.
208
+ def friendly_name
209
+ @properties['friendly_name']
210
+ end
211
+
212
+ ##
213
+ # @return [String] Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
214
+ def language
215
+ @properties['language']
216
+ end
217
+
218
+ ##
219
+ # @return [Hash] Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
220
+ def variables
221
+ @properties['variables']
222
+ end
223
+
224
+ ##
225
+ # @return [Hash] The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource.
226
+ def types
227
+ @properties['types']
228
+ end
229
+
230
+ ##
231
+ # @return [Hash] The submitted information and approval request status of the Content resource.
232
+ def approval_requests
233
+ @properties['approval_requests']
234
+ end
235
+
236
+ ##
237
+ # Provide a user friendly representation
238
+ def to_s
239
+ "<Twilio.Content.V2.ContentAndApprovalsInstance>"
240
+ end
241
+
242
+ ##
243
+ # Provide a detailed, user friendly representation
244
+ def inspect
245
+ "<Twilio.Content.V2.ContentAndApprovalsInstance>"
246
+ end
247
+ end
248
+
249
+ end
250
+ end
251
+ end
252
+ end