class Twilio::REST::Trusthub::V1::CustomerProfilesContext::CustomerProfilesChannelEndpointAssignmentList

Public Class Methods

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

Initialize the CustomerProfilesChannelEndpointAssignmentList @param [Version] version Version that contains the resource @param [String] customer_profile_sid The unique string that we created to

identify the CustomerProfile resource.

@return [CustomerProfilesChannelEndpointAssignmentList] CustomerProfilesChannelEndpointAssignmentList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
21 def initialize(version, customer_profile_sid: nil)
22   super(version)
23 
24   # Path Solution
25   @solution = {customer_profile_sid: customer_profile_sid}
26   @uri = "/CustomerProfiles/#{@solution[:customer_profile_sid]}/ChannelEndpointAssignments"
27 end

Public Instance Methods

create(channel_endpoint_type: nil, channel_endpoint_sid: nil) click to toggle source

Create the CustomerProfilesChannelEndpointAssignmentInstance @param [String] channel_endpoint_type The type of channel endpoint. eg:

phone-number

@param [String] channel_endpoint_sid The SID of an channel endpoint @return [CustomerProfilesChannelEndpointAssignmentInstance] Created CustomerProfilesChannelEndpointAssignmentInstance

   # File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
35 def create(channel_endpoint_type: nil, channel_endpoint_sid: nil)
36   data = Twilio::Values.of({
37       'ChannelEndpointType' => channel_endpoint_type,
38       'ChannelEndpointSid' => channel_endpoint_sid,
39   })
40 
41   payload = @version.create('POST', @uri, data: data)
42 
43   CustomerProfilesChannelEndpointAssignmentInstance.new(
44       @version,
45       payload,
46       customer_profile_sid: @solution[:customer_profile_sid],
47   )
48 end
each() { |x| ... } click to toggle source

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

    # File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
103 def each
104   limits = @version.read_limits
105 
106   page = self.page(page_size: limits[:page_size], )
107 
108   @version.stream(page,
109                   limit: limits[:limit],
110                   page_limit: limits[:page_limit]).each {|x| yield x}
111 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
142 def get_page(target_url)
143   response = @version.domain.request(
144       'GET',
145       target_url
146   )
147   CustomerProfilesChannelEndpointAssignmentPage.new(@version, response, @solution)
148 end
list(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, limit: nil, page_size: nil) click to toggle source

Lists CustomerProfilesChannelEndpointAssignmentInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] channel_endpoint_sid The SID of an channel endpoint @param [String] channel_endpoint_sids comma separated list of channel endpoint

sids

@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/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
64 def list(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, limit: nil, page_size: nil)
65   self.stream(
66       channel_endpoint_sid: channel_endpoint_sid,
67       channel_endpoint_sids: channel_endpoint_sids,
68       limit: limit,
69       page_size: page_size
70   ).entries
71 end
page(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance records from the API. Request is executed immediately. @param [String] channel_endpoint_sid The SID of an channel endpoint @param [String] channel_endpoint_sids comma separated list of channel endpoint

sids

@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 CustomerProfilesChannelEndpointAssignmentInstance

    # File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
123 def page(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
124   params = Twilio::Values.of({
125       'ChannelEndpointSid' => channel_endpoint_sid,
126       'ChannelEndpointSids' => channel_endpoint_sids,
127       'PageToken' => page_token,
128       'Page' => page_number,
129       'PageSize' => page_size,
130   })
131 
132   response = @version.page('GET', @uri, params: params)
133 
134   CustomerProfilesChannelEndpointAssignmentPage.new(@version, response, @solution)
135 end
stream(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, limit: nil, page_size: nil) click to toggle source

Streams CustomerProfilesChannelEndpointAssignmentInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] channel_endpoint_sid The SID of an channel endpoint @param [String] channel_endpoint_sids comma separated list of channel endpoint

sids

@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/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
87 def stream(channel_endpoint_sid: :unset, channel_endpoint_sids: :unset, limit: nil, page_size: nil)
88   limits = @version.read_limits(limit, page_size)
89 
90   page = self.page(
91       channel_endpoint_sid: channel_endpoint_sid,
92       channel_endpoint_sids: channel_endpoint_sids,
93       page_size: limits[:page_size],
94   )
95 
96   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
97 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb
152 def to_s
153   '#<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentList>'
154 end