Class: Twilio::REST::Webhooks::V1::SettingList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Webhooks::V1::SettingList
- Defined in:
- lib/twilio-ruby/rest/webhooks/v1/setting.rb
Defined Under Namespace
Classes: InlineAuthValue, PatchSetting, PostAuthSetting, PostInlineAuthValue, PostSetting, RetryPolicy
Instance Method Summary collapse
-
#create(idempotency_key: :unset, post_setting: nil) ⇒ SettingInstance
Create the SettingInstance.
-
#create_with_metadata(idempotency_key: :unset, post_setting: nil) ⇒ SettingInstance
Create the SettingInstanceMetadata.
-
#each ⇒ Object
When passed a block, yields SettingInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of SettingInstance records from the API.
-
#initialize(version) ⇒ SettingList
constructor
Initialize the SettingList.
-
#list(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) ⇒ Array
Lists SettingInstance records from the API as a list.
-
#list_with_metadata(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) ⇒ Array
Array of up to limit results.
-
#page(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, page_size: :unset) ⇒ Page
Page of SettingInstance.
-
#stream(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :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) ⇒ SettingList
Initialize the SettingList
334 335 336 337 338 339 340 341 342 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 334 def initialize(version) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { } @uri = "/Webhooks/Settings" end |
Instance Method Details
#create(idempotency_key: :unset, post_setting: nil) ⇒ SettingInstance
Create the SettingInstance
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 348 def create( idempotency_key: :unset, post_setting: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' headers['Accept'] = '*/*' payload = @version.create('POST', @uri, headers: headers, data: post_setting.to_json) SettingInstance.new( @version, payload, ) end |
#create_with_metadata(idempotency_key: :unset, post_setting: nil) ⇒ SettingInstance
Create the SettingInstanceMetadata
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 371 def ( idempotency_key: :unset, post_setting: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' headers['Accept'] = '*/*' response = @version.('POST', @uri, headers: headers, data: post_setting.to_json) setting_instance = SettingInstance.new( @version, response.body, ) SettingInstanceMetadata.new( @version, setting_instance, response.headers, response.status_code ) end |
#each ⇒ Object
When passed a block, yields SettingInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 488 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 SettingInstance records from the API. Request is executed immediately.
533 534 535 536 537 538 539 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 533 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) SettingPage.new(@version, response, @solution) end |
#list(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) ⇒ Array
Lists SettingInstance records from the API as a list.
Unlike stream(), this operation is eager and will load limit records into
memory before returning.
411 412 413 414 415 416 417 418 419 420 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 411 def list(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) self.stream( page_token: page_token, auth_profile_id: auth_profile_id, shared_key_id: shared_key_id, type: type, limit: limit, page_size: page_size ).entries end |
#list_with_metadata(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) ⇒ Array
Returns Array of up to limit results.
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 467 def (page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) params = Twilio::Values.of({ 'pageToken' => page_token, 'authProfileId' => auth_profile_id, 'sharedKeyId' => shared_key_id, 'type' => type, 'PageSize' => limits[:page_size], }); headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) SettingPageMetadata.new(@version, response, @solution, limits[:limit]) end |
#page(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, page_size: :unset) ⇒ Page
Returns Page of SettingInstance.
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 511 def page(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, page_size: :unset) params = Twilio::Values.of({ 'pageToken' => page_token, 'authProfileId' => auth_profile_id, 'sharedKeyId' => shared_key_id, 'type' => type, 'PageSize' => page_size, }) headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) SettingPage.new(@version, response, @solution) end |
#stream(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :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.
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 437 def stream(page_token: :unset, auth_profile_id: :unset, shared_key_id: :unset, type: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( page_token: page_token, auth_profile_id: auth_profile_id, shared_key_id: shared_key_id, type: type, 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
544 545 546 |
# File 'lib/twilio-ruby/rest/webhooks/v1/setting.rb', line 544 def to_s '#<Twilio.Webhooks.V1.SettingList>' end |