class Twilio::REST::Trunking::V1::TrunkContext::CredentialListList

Public Class Methods

new(version, trunk_sid: nil) click to toggle source

Initialize the CredentialListList @param [Version] version Version that contains the resource @param [String] trunk_sid The SID of the Trunk the credential list in associated

with.

@return [CredentialListList] CredentialListList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
21 def initialize(version, trunk_sid: nil)
22   super(version)
23 
24   # Path Solution
25   @solution = {trunk_sid: trunk_sid}
26   @uri = "/Trunks/#{@solution[:trunk_sid]}/CredentialLists"
27 end

Public Instance Methods

create(credential_list_sid: nil) click to toggle source

Create the CredentialListInstance @param [String] credential_list_sid The SID of the {Credential

List}[https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource]
that you want to associate with the trunk. Once associated, we will authenticate
access to the trunk against this list.

@return [CredentialListInstance] Created CredentialListInstance

   # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
36 def create(credential_list_sid: nil)
37   data = Twilio::Values.of({'CredentialListSid' => credential_list_sid, })
38 
39   payload = @version.create('POST', @uri, data: data)
40 
41   CredentialListInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], )
42 end
each() { |x| ... } click to toggle source

When passed a block, yields CredentialListInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.

   # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
82 def each
83   limits = @version.read_limits
84 
85   page = self.page(page_size: limits[:page_size], )
86 
87   @version.stream(page,
88                   limit: limits[:limit],
89                   page_limit: limits[:page_limit]).each {|x| yield x}
90 end
get_page(target_url) click to toggle source

Retrieve a single page of CredentialListInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of CredentialListInstance

    # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
116 def get_page(target_url)
117   response = @version.domain.request(
118       'GET',
119       target_url
120   )
121   CredentialListPage.new(@version, response, @solution)
122 end
list(limit: nil, page_size: nil) click to toggle source

Lists CredentialListInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit.  Default is no limit

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records.  If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Array] Array of up to limit results

   # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
55 def list(limit: nil, page_size: nil)
56   self.stream(limit: limit, page_size: page_size).entries
57 end
page(page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of CredentialListInstance records from the API. Request is executed immediately. @param [String] page_token PageToken provided by the API @param [Integer] page_number Page Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page of CredentialListInstance

    # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
 99 def page(page_token: :unset, page_number: :unset, page_size: :unset)
100   params = Twilio::Values.of({
101       'PageToken' => page_token,
102       'Page' => page_number,
103       'PageSize' => page_size,
104   })
105 
106   response = @version.page('GET', @uri, params: params)
107 
108   CredentialListPage.new(@version, response, @solution)
109 end
stream(limit: nil, page_size: nil) click to toggle source

Streams CredentialListInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit. Default is no limit.

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records. If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Enumerable] Enumerable that will yield up to limit results

   # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
70 def stream(limit: nil, page_size: nil)
71   limits = @version.read_limits(limit, page_size)
72 
73   page = self.page(page_size: limits[:page_size], )
74 
75   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
76 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb
126 def to_s
127   '#<Twilio.Trunking.V1.CredentialListList>'
128 end