class Twilio::REST::Trusthub::V1::CustomerProfilesList
Public Class Methods
Initialize the CustomerProfilesList
@param [Version] version Version
that contains the resource @return [CustomerProfilesList] CustomerProfilesList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb 18 def initialize(version) 19 super(version) 20 21 # Path Solution 22 @solution = {} 23 @uri = "/CustomerProfiles" 24 end
Public Instance Methods
Create the CustomerProfilesInstance
@param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] email The email address that will receive updates when the
Customer-Profile resource changes status.
@param [String] policy_sid The unique string of a policy that is associated to
the Customer-Profile resource.
@param [String] status_callback The URL we call to inform your application of
status changes.
@return [CustomerProfilesInstance] Created CustomerProfilesInstance
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb 37 def create(friendly_name: nil, email: nil, policy_sid: nil, status_callback: :unset) 38 data = Twilio::Values.of({ 39 'FriendlyName' => friendly_name, 40 'Email' => email, 41 'PolicySid' => policy_sid, 42 'StatusCallback' => status_callback, 43 }) 44 45 payload = @version.create('POST', @uri, data: data) 46 47 CustomerProfilesInstance.new(@version, payload, ) 48 end
When passed a block, yields CustomerProfilesInstance
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.rb 111 def each 112 limits = @version.read_limits 113 114 page = self.page(page_size: limits[:page_size], ) 115 116 @version.stream(page, 117 limit: limits[:limit], 118 page_limit: limits[:page_limit]).each {|x| yield x} 119 end
Retrieve a single page of CustomerProfilesInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of CustomerProfilesInstance
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb 154 def get_page(target_url) 155 response = @version.domain.request( 156 'GET', 157 target_url 158 ) 159 CustomerProfilesPage.new(@version, response, @solution) 160 end
Lists CustomerProfilesInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [customer_profiles.Status] status The verification status of the
Customer-Profile resource.
@param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] policy_sid The unique string of a policy that is associated to
the Customer-Profile resource.
@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.rb 67 def list(status: :unset, friendly_name: :unset, policy_sid: :unset, limit: nil, page_size: nil) 68 self.stream( 69 status: status, 70 friendly_name: friendly_name, 71 policy_sid: policy_sid, 72 limit: limit, 73 page_size: page_size 74 ).entries 75 end
Retrieve a single page of CustomerProfilesInstance
records from the API. Request
is executed immediately. @param [customer_profiles.Status] status The verification status of the
Customer-Profile resource.
@param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] policy_sid The unique string of a policy that is associated to
the Customer-Profile resource.
@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 CustomerProfilesInstance
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb 134 def page(status: :unset, friendly_name: :unset, policy_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 135 params = Twilio::Values.of({ 136 'Status' => status, 137 'FriendlyName' => friendly_name, 138 'PolicySid' => policy_sid, 139 'PageToken' => page_token, 140 'Page' => page_number, 141 'PageSize' => page_size, 142 }) 143 144 response = @version.page('GET', @uri, params: params) 145 146 CustomerProfilesPage.new(@version, response, @solution) 147 end
Streams CustomerProfilesInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [customer_profiles.Status] status The verification status of the
Customer-Profile resource.
@param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] policy_sid The unique string of a policy that is associated to
the Customer-Profile resource.
@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.rb 94 def stream(status: :unset, friendly_name: :unset, policy_sid: :unset, limit: nil, page_size: nil) 95 limits = @version.read_limits(limit, page_size) 96 97 page = self.page( 98 status: status, 99 friendly_name: friendly_name, 100 policy_sid: policy_sid, 101 page_size: limits[:page_size], 102 ) 103 104 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 105 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb 164 def to_s 165 '#<Twilio.Trusthub.V1.CustomerProfilesList>' 166 end