Class: Twilio::REST::Insights::V3::CustomFieldMappingList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Insights::V3::CustomFieldMappingList
- Defined in:
- lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb
Defined Under Namespace
Classes: CustomFieldMappingRequest, CustomFieldMappingUpdateRequest, EntityMetadataUpdate, IntelligenceOperatorSource, IntelligenceOperatorSourceUpdate
Instance Method Summary collapse
-
#create(custom_field_mapping_request: nil) ⇒ CustomFieldMappingInstance
Create the CustomFieldMappingInstance.
-
#create_with_metadata(custom_field_mapping_request: nil) ⇒ CustomFieldMappingInstance
Create the CustomFieldMappingInstanceMetadata.
-
#each ⇒ Object
When passed a block, yields CustomFieldMappingInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of CustomFieldMappingInstance records from the API.
-
#initialize(version) ⇒ CustomFieldMappingList
constructor
Initialize the CustomFieldMappingList.
-
#list(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Lists CustomFieldMappingInstance records from the API as a list.
-
#list_with_metadata(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Array of up to limit results.
-
#page(page_token: :unset, page_size: :unset) ⇒ Page
Page of CustomFieldMappingInstance.
-
#stream(page_token: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version) ⇒ CustomFieldMappingList
Initialize the CustomFieldMappingList
194 195 196 197 198 199 200 201 202 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 194 def initialize(version) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { } @uri = "/ControlPlane/ConversationInsights/CustomFieldMappings" end |
Instance Method Details
#create(custom_field_mapping_request: nil) ⇒ CustomFieldMappingInstance
Create the CustomFieldMappingInstance
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 207 def create(custom_field_mapping_request: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' payload = @version.create('POST', @uri, headers: headers, data: custom_field_mapping_request.to_json) CustomFieldMappingInstance.new( @version, payload, ) end |
#create_with_metadata(custom_field_mapping_request: nil) ⇒ CustomFieldMappingInstance
Create the CustomFieldMappingInstanceMetadata
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 227 def (custom_field_mapping_request: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('POST', @uri, headers: headers, data: custom_field_mapping_request.to_json) custom_field_mapping_instance = CustomFieldMappingInstance.new( @version, response.body, ) CustomFieldMappingInstanceMetadata.new( @version, custom_field_mapping_instance, response.headers, response.status_code ) end |
#each ⇒ Object
When passed a block, yields CustomFieldMappingInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 324 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result.each {|x| yield x} end |
#get_page(target_url) ⇒ Page
Retrieve a single page of CustomFieldMappingInstance records from the API. Request is executed immediately.
363 364 365 366 367 368 369 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 363 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) CustomFieldMappingPage.new(@version, response, @solution) end |
#list(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Lists CustomFieldMappingInstance records from the API as a list.
Unlike stream(), this operation is eager and will load limit records into
memory before returning.
262 263 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 262 def list(page_token: :unset, limit: nil, page_size: nil) self.stream( page_token: page_token, limit: limit, page_size: page_size ).entries end |
#list_with_metadata(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Returns Array of up to limit results.
306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 306 def (page_token: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) params = Twilio::Values.of({ 'pageToken' => page_token, 'PageSize' => limits[:page_size], }); headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) CustomFieldMappingPageMetadata.new(@version, response, @solution, limits[:limit]) end |
#page(page_token: :unset, page_size: :unset) ⇒ Page
Returns Page of CustomFieldMappingInstance.
344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 344 def page(page_token: :unset, page_size: :unset) params = Twilio::Values.of({ 'pageToken' => page_token, 'PageSize' => page_size, }) headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) CustomFieldMappingPage.new(@version, response, @solution) end |
#stream(page_token: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 282 def stream(page_token: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( page_token: page_token, page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result end |
#to_s ⇒ Object
Provide a user friendly representation
374 375 376 |
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 374 def to_s '#<Twilio.Insights.V3.CustomFieldMappingList>' end |