class Twilio::REST::Trusthub::V1::CustomerProfilesContext::CustomerProfilesEvaluationsList
Public Class Methods
Initialize the CustomerProfilesEvaluationsList
@param [Version] version Version
that contains the resource @param [String] customer_profile_sid The unique string that we created to
identify the customer_profile resource.
@return [CustomerProfilesEvaluationsList] CustomerProfilesEvaluationsList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.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]}/Evaluations" 27 end
Public Instance Methods
Create the CustomerProfilesEvaluationsInstance
@param [String] policy_sid The unique string of a policy that is associated to
the customer_profile resource.
@return [CustomerProfilesEvaluationsInstance] Created CustomerProfilesEvaluationsInstance
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb 34 def create(policy_sid: nil) 35 data = Twilio::Values.of({'PolicySid' => policy_sid, }) 36 37 payload = @version.create('POST', @uri, data: data) 38 39 CustomerProfilesEvaluationsInstance.new( 40 @version, 41 payload, 42 customer_profile_sid: @solution[:customer_profile_sid], 43 ) 44 end
When passed a block, yields CustomerProfilesEvaluationsInstance
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_evaluations.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
Retrieve a single page of CustomerProfilesEvaluationsInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of CustomerProfilesEvaluationsInstance
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb 118 def get_page(target_url) 119 response = @version.domain.request( 120 'GET', 121 target_url 122 ) 123 CustomerProfilesEvaluationsPage.new(@version, response, @solution) 124 end
Lists CustomerProfilesEvaluationsInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @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_evaluations.rb 57 def list(limit: nil, page_size: nil) 58 self.stream(limit: limit, page_size: page_size).entries 59 end
Retrieve a single page of CustomerProfilesEvaluationsInstance
records from the API. Request
is executed immediately. @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 CustomerProfilesEvaluationsInstance
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb 101 def page(page_token: :unset, page_number: :unset, page_size: :unset) 102 params = Twilio::Values.of({ 103 'PageToken' => page_token, 104 'Page' => page_number, 105 'PageSize' => page_size, 106 }) 107 108 response = @version.page('GET', @uri, params: params) 109 110 CustomerProfilesEvaluationsPage.new(@version, response, @solution) 111 end
Streams CustomerProfilesEvaluationsInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @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_evaluations.rb 72 def stream(limit: nil, page_size: nil) 73 limits = @version.read_limits(limit, page_size) 74 75 page = self.page(page_size: limits[:page_size], ) 76 77 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 78 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb 128 def to_s 129 '#<Twilio.Trusthub.V1.CustomerProfilesEvaluationsList>' 130 end