class Twilio::REST::Trusthub::V1::TrustProductsContext::TrustProductsEntityAssignmentsList
Public Class Methods
Initialize the TrustProductsEntityAssignmentsList
@param [Version] version Version
that contains the resource @param [String] trust_product_sid The unique string that we created to identify
the TrustProduct resource.
@return [TrustProductsEntityAssignmentsList] TrustProductsEntityAssignmentsList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb 21 def initialize(version, trust_product_sid: nil) 22 super(version) 23 24 # Path Solution 25 @solution = {trust_product_sid: trust_product_sid} 26 @uri = "/TrustProducts/#{@solution[:trust_product_sid]}/EntityAssignments" 27 end
Public Instance Methods
Create the TrustProductsEntityAssignmentsInstance
@param [String] object_sid The SID of an object bag that holds information of
the different items.
@return [TrustProductsEntityAssignmentsInstance] Created TrustProductsEntityAssignmentsInstance
# File lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb 34 def create(object_sid: nil) 35 data = Twilio::Values.of({'ObjectSid' => object_sid, }) 36 37 payload = @version.create('POST', @uri, data: data) 38 39 TrustProductsEntityAssignmentsInstance.new( 40 @version, 41 payload, 42 trust_product_sid: @solution[:trust_product_sid], 43 ) 44 end
When passed a block, yields TrustProductsEntityAssignmentsInstance
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/trust_products/trust_products_entity_assignments.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 TrustProductsEntityAssignmentsInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of TrustProductsEntityAssignmentsInstance
# File lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb 118 def get_page(target_url) 119 response = @version.domain.request( 120 'GET', 121 target_url 122 ) 123 TrustProductsEntityAssignmentsPage.new(@version, response, @solution) 124 end
Lists TrustProductsEntityAssignmentsInstance
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/trust_products/trust_products_entity_assignments.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 TrustProductsEntityAssignmentsInstance
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 TrustProductsEntityAssignmentsInstance
# File lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.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 TrustProductsEntityAssignmentsPage.new(@version, response, @solution) 111 end
Streams TrustProductsEntityAssignmentsInstance
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/trust_products/trust_products_entity_assignments.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/trust_products/trust_products_entity_assignments.rb 128 def to_s 129 '#<Twilio.Trusthub.V1.TrustProductsEntityAssignmentsList>' 130 end