lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -32,23 +32,23 @@
# Retrieve a single page of MemberInstance records from the API.
# Request is executed immediately.
# @param [String] identity The identity
# @param [String] role_sid The role_sid
# @return [MemberInstance] Newly created MemberInstance
- 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 MemberInstance.new(
+ MemberInstance.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 MemberInstance
- 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 MemberPage.new(@version, response, @solution)
+ MemberPage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of MemberInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of MemberInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ MemberPage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.IpMessaging.V1.MemberList>'
end
end
@@ -169,11 +182,11 @@
##
# Build an instance of MemberInstance
# @param [Hash] payload Payload response from the API
# @return [MemberInstance] MemberInstance
def get_instance(payload)
- return MemberInstance.new(
+ MemberInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
channel_sid: @solution[:channel_sid],
)
@@ -208,19 +221,19 @@
##
# Fetch a MemberInstance
# @return [MemberInstance] Fetched MemberInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return MemberInstance.new(
+ MemberInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
channel_sid: @solution[:channel_sid],
sid: @solution[:sid],
@@ -229,31 +242,31 @@
##
# Deletes the MemberInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Update the MemberInstance
# @param [String] role_sid The role_sid
# @param [String] last_consumed_message_index The last_consumed_message_index
# @return [MemberInstance] Updated MemberInstance
- def update(role_sid: nil, last_consumed_message_index: nil)
- data = {
+ def update(role_sid: :unset, last_consumed_message_index: :unset)
+ data = Twilio::Values.of({
'RoleSid' => role_sid,
'LastConsumedMessageIndex' => last_consumed_message_index,
- }
+ })
payload = @version.update(
'POST',
@uri,
data: data,
)
- return MemberInstance.new(
+ MemberInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
channel_sid: @solution[:channel_sid],
sid: @solution[:sid],
@@ -382,10 +395,10 @@
##
# Update the MemberInstance
# @param [String] role_sid The role_sid
# @param [String] last_consumed_message_index The last_consumed_message_index
# @return [MemberInstance] Updated MemberInstance
- def update(role_sid: nil, last_consumed_message_index: nil)
+ def update(role_sid: :unset, last_consumed_message_index: :unset)
context.update(
role_sid: role_sid,
last_consumed_message_index: last_consumed_message_index,
)
end
\ No newline at end of file