class Twilio::REST::Conversations::V1::ServiceContext::BindingList

Public Class Methods

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

Initialize the BindingList @param [Version] version Version that contains the resource @param [String] chat_service_sid The SID of the {Conversation

Service}[https://www.twilio.com/docs/conversations/api/service-resource] the
Binding resource is associated with.

@return [BindingList] BindingList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/conversations/v1/service/binding.rb
22 def initialize(version, chat_service_sid: nil)
23   super(version)
24 
25   # Path Solution
26   @solution = {chat_service_sid: chat_service_sid}
27   @uri = "/Services/#{@solution[:chat_service_sid]}/Bindings"
28 end

Public Instance Methods

each() { |x| ... } click to toggle source

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/conversations/v1/service/binding.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 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/conversations/v1/service/binding.rb
139 def get_page(target_url)
140   response = @version.domain.request(
141       'GET',
142       target_url
143   )
144   BindingPage.new(@version, response, @solution)
145 end
list(binding_type: :unset, identity: :unset, limit: nil, page_size: nil) click to toggle source

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 identity of a {Conversation

User}[https://www.twilio.com/docs/conversations/api/user-resource] this binding
belongs to. See {access
tokens}[https://www.twilio.com/docs/conversations/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/conversations/v1/service/binding.rb
51 def list(binding_type: :unset, identity: :unset, limit: nil, page_size: nil)
52   self.stream(
53       binding_type: binding_type,
54       identity: identity,
55       limit: limit,
56       page_size: page_size
57   ).entries
58 end
page(binding_type: :unset, identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

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 identity of a {Conversation

User}[https://www.twilio.com/docs/conversations/api/user-resource] this binding
belongs to. See {access
tokens}[https://www.twilio.com/docs/conversations/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/conversations/v1/service/binding.rb
120 def page(binding_type: :unset, identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
121   params = Twilio::Values.of({
122       'BindingType' => Twilio.serialize_list(binding_type) { |e| e },
123       'Identity' => Twilio.serialize_list(identity) { |e| e },
124       'PageToken' => page_token,
125       'Page' => page_number,
126       'PageSize' => page_size,
127   })
128 
129   response = @version.page('GET', @uri, params: params)
130 
131   BindingPage.new(@version, response, @solution)
132 end
stream(binding_type: :unset, identity: :unset, limit: nil, page_size: nil) click to toggle source

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 identity of a {Conversation

User}[https://www.twilio.com/docs/conversations/api/user-resource] this binding
belongs to. See {access
tokens}[https://www.twilio.com/docs/conversations/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/conversations/v1/service/binding.rb
81 def stream(binding_type: :unset, identity: :unset, limit: nil, page_size: nil)
82   limits = @version.read_limits(limit, page_size)
83 
84   page = self.page(binding_type: binding_type, identity: identity, 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/conversations/v1/service/binding.rb
149 def to_s
150   '#<Twilio.Conversations.V1.BindingList>'
151 end