lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -32,23 +32,23 @@
# Retrieve a single page of InviteInstance records from the API.
# Request is executed immediately.
# @param [String] identity The identity
# @param [String] role_sid The role_sid
# @return [InviteInstance] Newly created InviteInstance
- def create(identity: nil, role_sid: nil)
- data = {
+ def create(identity: nil, role_sid: :unset)
+ data = Twilio::Values.of({
'Identity' => identity,
'RoleSid' => role_sid,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return InviteInstance.new(
+ InviteInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
channel_sid: @solution[:channel_sid],
)
@@ -64,11 +64,11 @@
# @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
- def list(identity: nil, limit: nil, page_size: nil)
+ def list(identity: :unset, limit: nil, page_size: nil)
self.stream(
identity: identity,
limit: limit,
page_size: page_size
).entries
@@ -84,11 +84,11 @@
# @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
- def stream(identity: nil, limit: nil, page_size: nil)
+ def stream(identity: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
identity: identity,
page_size: limits[:page_size],
@@ -126,26 +126,39 @@
# @param [String] 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
- def page(identity: nil, page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'Identity' => identity,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return InvitePage.new(@version, response, @solution)
+ InvitePage.new(@version, response, @solution)
end
##
+ # 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
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ InvitePage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Chat.V2.InviteList>'
end
end
@@ -169,11 +182,11 @@
##
# Build an instance of InviteInstance
# @param [Hash] payload Payload response from the API
# @return [InviteInstance] InviteInstance
def get_instance(payload)
- return InviteInstance.new(
+ InviteInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
channel_sid: @solution[:channel_sid],
)
@@ -208,19 +221,19 @@
##
# Fetch a InviteInstance
# @return [InviteInstance] Fetched InviteInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return InviteInstance.new(
+ InviteInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
channel_sid: @solution[:channel_sid],
sid: @solution[:sid],
@@ -229,10 +242,10 @@
##
# Deletes the InviteInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Provide a user friendly representation
def to_s
\ No newline at end of file