lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -31,25 +31,25 @@
# @param [String] friendly_name The friendly_name
# @param [String] unique_name The unique_name
# @param [String] attributes The attributes
# @param [channel.ChannelType] type The type
# @return [ChannelInstance] Newly created ChannelInstance
- def create(friendly_name: nil, unique_name: nil, attributes: nil, type: nil)
- data = {
+ def create(friendly_name: :unset, unique_name: :unset, attributes: :unset, type: :unset)
+ data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'UniqueName' => unique_name,
'Attributes' => attributes,
'Type' => type,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return ChannelInstance.new(
+ ChannelInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -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(type: nil, limit: nil, page_size: nil)
+ def list(type: :unset, limit: nil, page_size: nil)
self.stream(
type: type,
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(type: nil, limit: nil, page_size: nil)
+ def stream(type: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
type: type,
page_size: limits[:page_size],
@@ -126,26 +126,39 @@
# @param [channel.ChannelType] type The type
# @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 ChannelInstance
- def page(type: nil, page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'Type' => type,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return ChannelPage.new(@version, response, @solution)
+ ChannelPage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of ChannelInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of ChannelInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ ChannelPage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.IpMessaging.V1.ChannelList>'
end
end
@@ -168,11 +181,11 @@
##
# Build an instance of ChannelInstance
# @param [Hash] payload Payload response from the API
# @return [ChannelInstance] ChannelInstance
def get_instance(payload)
- return ChannelInstance.new(
+ ChannelInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -209,19 +222,19 @@
##
# Fetch a ChannelInstance
# @return [ChannelInstance] Fetched ChannelInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return ChannelInstance.new(
+ ChannelInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
@@ -229,33 +242,33 @@
##
# Deletes the ChannelInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Update the ChannelInstance
# @param [String] friendly_name The friendly_name
# @param [String] unique_name The unique_name
# @param [String] attributes The attributes
# @return [ChannelInstance] Updated ChannelInstance
- def update(friendly_name: nil, unique_name: nil, attributes: nil)
- data = {
+ def update(friendly_name: :unset, unique_name: :unset, attributes: :unset)
+ data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'UniqueName' => unique_name,
'Attributes' => attributes,
- }
+ })
payload = @version.update(
'POST',
@uri,
data: data,
)
- return ChannelInstance.new(
+ ChannelInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
@@ -468,10 +481,10 @@
# Update the ChannelInstance
# @param [String] friendly_name The friendly_name
# @param [String] unique_name The unique_name
# @param [String] attributes The attributes
# @return [ChannelInstance] Updated ChannelInstance
- def update(friendly_name: nil, unique_name: nil, attributes: nil)
+ def update(friendly_name: :unset, unique_name: :unset, attributes: :unset)
context.update(
friendly_name: friendly_name,
unique_name: unique_name,
attributes: attributes,
)
\ No newline at end of file