class Twilio::REST::Chat::V2::ServiceContext::UserContext::UserBindingList

Public Class Methods

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

Initialize the UserBindingList @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 User
Binding resource is associated with.

@param [String] user_sid The SID of the

{User}[https://www.twilio.com/docs/chat/rest/user-resource] with the User
Binding resource.  See {push notification
configuration}[https://www.twilio.com/docs/chat/push-notification-configuration]
for more info.

@return [UserBindingList] UserBindingList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb
28 def initialize(version, service_sid: nil, user_sid: nil)
29   super(version)
30 
31   # Path Solution
32   @solution = {service_sid: service_sid, user_sid: user_sid}
33   @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:user_sid]}/Bindings"
34 end

Public Instance Methods

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

When passed a block, yields UserBindingInstance 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/user/user_binding.rb
84 def each
85   limits = @version.read_limits
86 
87   page = self.page(page_size: limits[:page_size], )
88 
89   @version.stream(page,
90                   limit: limits[:limit],
91                   page_limit: limits[:page_limit]).each {|x| yield x}
92 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb
124 def get_page(target_url)
125   response = @version.domain.request(
126       'GET',
127       target_url
128   )
129   UserBindingPage.new(@version, response, @solution)
130 end
list(binding_type: :unset, limit: nil, page_size: nil) click to toggle source

Lists UserBindingInstance 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 User 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 [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/user/user_binding.rb
52 def list(binding_type: :unset, limit: nil, page_size: nil)
53   self.stream(binding_type: binding_type, limit: limit, page_size: page_size).entries
54 end
page(binding_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of UserBindingInstance records from the API. Request is executed immediately. @param [Array] binding_type The push technology used

by the User 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 [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 UserBindingInstance

    # File lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb
106 def page(binding_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
107   params = Twilio::Values.of({
108       'BindingType' => Twilio.serialize_list(binding_type) { |e| e },
109       'PageToken' => page_token,
110       'Page' => page_number,
111       'PageSize' => page_size,
112   })
113 
114   response = @version.page('GET', @uri, params: params)
115 
116   UserBindingPage.new(@version, response, @solution)
117 end
stream(binding_type: :unset, limit: nil, page_size: nil) click to toggle source

Streams UserBindingInstance 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 User 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 [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/user/user_binding.rb
72 def stream(binding_type: :unset, limit: nil, page_size: nil)
73   limits = @version.read_limits(limit, page_size)
74 
75   page = self.page(binding_type: binding_type, page_size: limits[:page_size], )
76 
77   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
78 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb
134 def to_s
135   '#<Twilio.Chat.V2.UserBindingList>'
136 end