class Twilio::REST::Preview::Sync::ServiceContext::SyncListContext::SyncListItemList

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.

Public Class Methods

new(version, service_sid: nil, list_sid: nil) click to toggle source

Initialize the SyncListItemList @param [Version] version Version that contains the resource @param [String] service_sid The service_sid @param [String] list_sid The list_sid @return [SyncListItemList] SyncListItemList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb
24 def initialize(version, service_sid: nil, list_sid: nil)
25   super(version)
26 
27   # Path Solution
28   @solution = {service_sid: service_sid, list_sid: list_sid}
29   @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Items"
30 end

Public Instance Methods

create(data: nil) click to toggle source

Create the SyncListItemInstance @param [Hash] data The data @return [SyncListItemInstance] Created SyncListItemInstance

   # File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb
36 def create(data: nil)
37   data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), })
38 
39   payload = @version.create('POST', @uri, data: data)
40 
41   SyncListItemInstance.new(
42       @version,
43       payload,
44       service_sid: @solution[:service_sid],
45       list_sid: @solution[:list_sid],
46   )
47 end
each() { |x| ... } click to toggle source

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

    # File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb
 93 def each
 94   limits = @version.read_limits
 95 
 96   page = self.page(page_size: limits[:page_size], )
 97 
 98   @version.stream(page,
 99                   limit: limits[:limit],
100                   page_limit: limits[:page_limit]).each {|x| yield x}
101 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb
133 def get_page(target_url)
134   response = @version.domain.request(
135       'GET',
136       target_url
137   )
138   SyncListItemPage.new(@version, response, @solution)
139 end
list(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil) click to toggle source

Lists SyncListItemInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [sync_list_item.QueryResultOrder] order The order @param [String] from The from @param [sync_list_item.QueryFromBoundType] bounds The bounds @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/preview/sync/service/sync_list/sync_list_item.rb
63 def list(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil)
64   self.stream(order: order, from: from, bounds: bounds, limit: limit, page_size: page_size).entries
65 end
page(order: :unset, from: :unset, bounds: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of SyncListItemInstance records from the API. Request is executed immediately. @param [sync_list_item.QueryResultOrder] order The order @param [String] from The from @param [sync_list_item.QueryFromBoundType] bounds The bounds @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 SyncListItemInstance

    # File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb
113 def page(order: :unset, from: :unset, bounds: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
114   params = Twilio::Values.of({
115       'Order' => order,
116       'From' => from,
117       'Bounds' => bounds,
118       'PageToken' => page_token,
119       'Page' => page_number,
120       'PageSize' => page_size,
121   })
122 
123   response = @version.page('GET', @uri, params: params)
124 
125   SyncListItemPage.new(@version, response, @solution)
126 end
stream(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil) click to toggle source

Streams SyncListItemInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [sync_list_item.QueryResultOrder] order The order @param [String] from The from @param [sync_list_item.QueryFromBoundType] bounds The bounds @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/preview/sync/service/sync_list/sync_list_item.rb
81 def stream(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil)
82   limits = @version.read_limits(limit, page_size)
83 
84   page = self.page(order: order, from: from, bounds: bounds, page_size: limits[:page_size], )
85 
86   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
87 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb
143 def to_s
144   '#<Twilio.Preview.Sync.SyncListItemList>'
145 end