class Twilio::REST::Trunking::V1::TrunkContext::IpAccessControlListList
Public Class Methods
Initialize the IpAccessControlListList
@param [Version] version Version
that contains the resource @param [String] trunk_sid The SID of the Trunk the resource is associated with. @return [IpAccessControlListList] IpAccessControlListList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb 20 def initialize(version, trunk_sid: nil) 21 super(version) 22 23 # Path Solution 24 @solution = {trunk_sid: trunk_sid} 25 @uri = "/Trunks/#{@solution[:trunk_sid]}/IpAccessControlLists" 26 end
Public Instance Methods
Create the IpAccessControlListInstance
@param [String] ip_access_control_list_sid The SID of the {IP Access Control
List}[https://www.twilio.com/docs/voice/sip/api/sip-ipaccesscontrollist-resource] that you want to associate with the trunk.
@return [IpAccessControlListInstance] Created IpAccessControlListInstance
# File lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb 34 def create(ip_access_control_list_sid: nil) 35 data = Twilio::Values.of({'IpAccessControlListSid' => ip_access_control_list_sid, }) 36 37 payload = @version.create('POST', @uri, data: data) 38 39 IpAccessControlListInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid], ) 40 end
When passed a block, yields IpAccessControlListInstance
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/ip_access_control_list.rb 80 def each 81 limits = @version.read_limits 82 83 page = self.page(page_size: limits[:page_size], ) 84 85 @version.stream(page, 86 limit: limits[:limit], 87 page_limit: limits[:page_limit]).each {|x| yield x} 88 end
Retrieve a single page of IpAccessControlListInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of IpAccessControlListInstance
# File lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb 114 def get_page(target_url) 115 response = @version.domain.request( 116 'GET', 117 target_url 118 ) 119 IpAccessControlListPage.new(@version, response, @solution) 120 end
Lists IpAccessControlListInstance
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/ip_access_control_list.rb 53 def list(limit: nil, page_size: nil) 54 self.stream(limit: limit, page_size: page_size).entries 55 end
Retrieve a single page of IpAccessControlListInstance
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 IpAccessControlListInstance
# File lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb 97 def page(page_token: :unset, page_number: :unset, page_size: :unset) 98 params = Twilio::Values.of({ 99 'PageToken' => page_token, 100 'Page' => page_number, 101 'PageSize' => page_size, 102 }) 103 104 response = @version.page('GET', @uri, params: params) 105 106 IpAccessControlListPage.new(@version, response, @solution) 107 end
Streams IpAccessControlListInstance
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/ip_access_control_list.rb 68 def stream(limit: nil, page_size: nil) 69 limits = @version.read_limits(limit, page_size) 70 71 page = self.page(page_size: limits[:page_size], ) 72 73 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 74 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb 124 def to_s 125 '#<Twilio.Trunking.V1.IpAccessControlListList>' 126 end