class Twilio::REST::Trusthub::V1::SupportingDocumentList

Public Class Methods

new(version) click to toggle source

Initialize the SupportingDocumentList @param [Version] version Version that contains the resource @return [SupportingDocumentList] SupportingDocumentList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb
18 def initialize(version)
19   super(version)
20 
21   # Path Solution
22   @solution = {}
23   @uri = "/SupportingDocuments"
24 end

Public Instance Methods

create(friendly_name: nil, type: nil, attributes: :unset) click to toggle source

Create the SupportingDocumentInstance @param [String] friendly_name The string that you assigned to describe the

resource.

@param [String] type The type of the Supporting Document. @param [Hash] attributes The set of parameters that are the attributes of the

Supporting Documents resource which are derived Supporting Document Types.

@return [SupportingDocumentInstance] Created SupportingDocumentInstance

   # File lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb
34 def create(friendly_name: nil, type: nil, attributes: :unset)
35   data = Twilio::Values.of({
36       'FriendlyName' => friendly_name,
37       'Type' => type,
38       'Attributes' => Twilio.serialize_object(attributes),
39   })
40 
41   payload = @version.create('POST', @uri, data: data)
42 
43   SupportingDocumentInstance.new(@version, payload, )
44 end
each() { |x| ... } click to toggle source

When passed a block, yields SupportingDocumentInstance 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/supporting_document.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 SupportingDocumentInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of SupportingDocumentInstance

    # File lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb
118 def get_page(target_url)
119   response = @version.domain.request(
120       'GET',
121       target_url
122   )
123   SupportingDocumentPage.new(@version, response, @solution)
124 end
list(limit: nil, page_size: nil) click to toggle source

Lists SupportingDocumentInstance 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/supporting_document.rb
57 def list(limit: nil, page_size: nil)
58   self.stream(limit: limit, page_size: page_size).entries
59 end
page(page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of SupportingDocumentInstance 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 SupportingDocumentInstance

    # File lib/twilio-ruby/rest/trusthub/v1/supporting_document.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   SupportingDocumentPage.new(@version, response, @solution)
111 end
stream(limit: nil, page_size: nil) click to toggle source

Streams SupportingDocumentInstance 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/supporting_document.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
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/trusthub/v1/supporting_document.rb
128 def to_s
129   '#<Twilio.Trusthub.V1.SupportingDocumentList>'
130 end