lib/twilio-ruby/rest/chat/v2/service/user.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/chat/v2/service/user.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -31,25 +31,25 @@
# @param [String] identity The identity
# @param [String] role_sid The role_sid
# @param [String] attributes The attributes
# @param [String] friendly_name The friendly_name
# @return [UserInstance] Newly created UserInstance
- def create(identity: nil, role_sid: nil, attributes: nil, friendly_name: nil)
- data = {
+ def create(identity: nil, role_sid: :unset, attributes: :unset, friendly_name: :unset)
+ data = Twilio::Values.of({
'Identity' => identity,
'RoleSid' => role_sid,
'Attributes' => attributes,
'FriendlyName' => friendly_name,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return UserInstance.new(
+ UserInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -120,25 +120,38 @@
# 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 UserInstance
- def page(page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return UserPage.new(@version, response, @solution)
+ UserPage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of UserInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of UserInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ UserPage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Chat.V2.UserList>'
end
end
@@ -161,11 +174,11 @@
##
# Build an instance of UserInstance
# @param [Hash] payload Payload response from the API
# @return [UserInstance] UserInstance
def get_instance(payload)
- return UserInstance.new(
+ UserInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -200,19 +213,19 @@
##
# Fetch a UserInstance
# @return [UserInstance] Fetched UserInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return UserInstance.new(
+ UserInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
@@ -220,33 +233,33 @@
##
# Deletes the UserInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Update the UserInstance
# @param [String] role_sid The role_sid
# @param [String] attributes The attributes
# @param [String] friendly_name The friendly_name
# @return [UserInstance] Updated UserInstance
- def update(role_sid: nil, attributes: nil, friendly_name: nil)
- data = {
+ def update(role_sid: :unset, attributes: :unset, friendly_name: :unset)
+ data = Twilio::Values.of({
'RoleSid' => role_sid,
'Attributes' => attributes,
'FriendlyName' => friendly_name,
- }
+ })
payload = @version.update(
'POST',
@uri,
data: data,
)
- return UserInstance.new(
+ UserInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
@@ -402,10 +415,10 @@
# Update the UserInstance
# @param [String] role_sid The role_sid
# @param [String] attributes The attributes
# @param [String] friendly_name The friendly_name
# @return [UserInstance] Updated UserInstance
- def update(role_sid: nil, attributes: nil, friendly_name: nil)
+ def update(role_sid: :unset, attributes: :unset, friendly_name: :unset)
context.update(
role_sid: role_sid,
attributes: attributes,
friendly_name: friendly_name,
)
\ No newline at end of file