class Twilio::REST::Chat::V2::ServiceContext::BindingList
Public Class Methods
Initialize the BindingList
@param [Version] version Version
that contains the resource @param [String] service_sid The SID of the
{Service}[https://www.twilio.com/docs/chat/rest/service-resource] the Binding resource is associated with.
@return [BindingList] BindingList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/chat/v2/service/binding.rb 22 def initialize(version, service_sid: nil) 23 super(version) 24 25 # Path Solution 26 @solution = {service_sid: service_sid} 27 @uri = "/Services/#{@solution[:service_sid]}/Bindings" 28 end
Public Instance Methods
When passed a block, yields BindingInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/chat/v2/service/binding.rb 91 def each 92 limits = @version.read_limits 93 94 page = self.page(page_size: limits[:page_size], ) 95 96 @version.stream(page, 97 limit: limits[:limit], 98 page_limit: limits[:page_limit]).each {|x| yield x} 99 end
Retrieve a single page of BindingInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of BindingInstance
# File lib/twilio-ruby/rest/chat/v2/service/binding.rb 136 def get_page(target_url) 137 response = @version.domain.request( 138 'GET', 139 target_url 140 ) 141 BindingPage.new(@version, response, @solution) 142 end
Lists BindingInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Array] binding_type The push technology used by the
Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See {push notification configuration}[https://www.twilio.com/docs/chat/push-notification-configuration] for more info.
@param [Array] identity The
{User}[https://www.twilio.com/docs/chat/rest/user-resource]'s `identity` value of the resources to read. See {access tokens}[https://www.twilio.com/docs/chat/create-tokens] for more details.
@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/chat/v2/service/binding.rb 50 def list(binding_type: :unset, identity: :unset, limit: nil, page_size: nil) 51 self.stream( 52 binding_type: binding_type, 53 identity: identity, 54 limit: limit, 55 page_size: page_size 56 ).entries 57 end
Retrieve a single page of BindingInstance
records from the API. Request
is executed immediately. @param [Array] binding_type The push technology used by the
Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See {push notification configuration}[https://www.twilio.com/docs/chat/push-notification-configuration] for more info.
@param [Array] identity The
{User}[https://www.twilio.com/docs/chat/rest/user-resource]'s `identity` value of the resources to read. See {access tokens}[https://www.twilio.com/docs/chat/create-tokens] for more details.
@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 BindingInstance
# File lib/twilio-ruby/rest/chat/v2/service/binding.rb 117 def page(binding_type: :unset, identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 118 params = Twilio::Values.of({ 119 'BindingType' => Twilio.serialize_list(binding_type) { |e| e }, 120 'Identity' => Twilio.serialize_list(identity) { |e| e }, 121 'PageToken' => page_token, 122 'Page' => page_number, 123 'PageSize' => page_size, 124 }) 125 126 response = @version.page('GET', @uri, params: params) 127 128 BindingPage.new(@version, response, @solution) 129 end
Streams BindingInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Array] binding_type The push technology used by the
Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See {push notification configuration}[https://www.twilio.com/docs/chat/push-notification-configuration] for more info.
@param [Array] identity The
{User}[https://www.twilio.com/docs/chat/rest/user-resource]'s `identity` value of the resources to read. See {access tokens}[https://www.twilio.com/docs/chat/create-tokens] for more details.
@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/chat/v2/service/binding.rb 79 def stream(binding_type: :unset, identity: :unset, limit: nil, page_size: nil) 80 limits = @version.read_limits(limit, page_size) 81 82 page = self.page(binding_type: binding_type, identity: identity, page_size: limits[:page_size], ) 83 84 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 85 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service/binding.rb 146 def to_s 147 '#<Twilio.Chat.V2.BindingList>' 148 end