class Twilio::REST::IpMessaging::V2::ServiceContext::ChannelContext::InviteList

Public Class Methods

new(version, service_sid: nil, channel_sid: nil) click to toggle source

Initialize the InviteList @param [Version] version Version that contains the resource @param [String] service_sid The service_sid @param [String] channel_sid The channel_sid @return [InviteList] InviteList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb
22 def initialize(version, service_sid: nil, channel_sid: nil)
23   super(version)
24 
25   # Path Solution
26   @solution = {service_sid: service_sid, channel_sid: channel_sid}
27   @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Invites"
28 end

Public Instance Methods

create(identity: nil, role_sid: :unset) click to toggle source

Create the InviteInstance @param [String] identity The identity @param [String] role_sid The role_sid @return [InviteInstance] Created InviteInstance

   # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb
35 def create(identity: nil, role_sid: :unset)
36   data = Twilio::Values.of({'Identity' => identity, 'RoleSid' => role_sid, })
37 
38   payload = @version.create('POST', @uri, data: data)
39 
40   InviteInstance.new(
41       @version,
42       payload,
43       service_sid: @solution[:service_sid],
44       channel_sid: @solution[:channel_sid],
45   )
46 end
each() { |x| ... } click to toggle source

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

   # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb
88 def each
89   limits = @version.read_limits
90 
91   page = self.page(page_size: limits[:page_size], )
92 
93   @version.stream(page,
94                   limit: limits[:limit],
95                   page_limit: limits[:page_limit]).each {|x| yield x}
96 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb
124 def get_page(target_url)
125   response = @version.domain.request(
126       'GET',
127       target_url
128   )
129   InvitePage.new(@version, response, @solution)
130 end
list(identity: :unset, limit: nil, page_size: nil) click to toggle source

Lists InviteInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Array] identity The identity @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/ip_messaging/v2/service/channel/invite.rb
60 def list(identity: :unset, limit: nil, page_size: nil)
61   self.stream(identity: identity, limit: limit, page_size: page_size).entries
62 end
page(identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of InviteInstance records from the API. Request is executed immediately. @param [Array] identity The identity @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 InviteInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb
106 def page(identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
107   params = Twilio::Values.of({
108       'Identity' => Twilio.serialize_list(identity) { |e| e },
109       'PageToken' => page_token,
110       'Page' => page_number,
111       'PageSize' => page_size,
112   })
113 
114   response = @version.page('GET', @uri, params: params)
115 
116   InvitePage.new(@version, response, @solution)
117 end
stream(identity: :unset, limit: nil, page_size: nil) click to toggle source

Streams InviteInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Array] identity The identity @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/ip_messaging/v2/service/channel/invite.rb
76 def stream(identity: :unset, limit: nil, page_size: nil)
77   limits = @version.read_limits(limit, page_size)
78 
79   page = self.page(identity: identity, page_size: limits[:page_size], )
80 
81   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
82 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb
134 def to_s
135   '#<Twilio.IpMessaging.V2.InviteList>'
136 end