lib/twilio-ruby/rest/chat/v2/service/role.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/chat/v2/service/role.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -31,23 +31,23 @@
# @param [String] friendly_name The friendly_name
# @param [role.RoleType] type The type
# @param [String] permission The permission
# @return [RoleInstance] Newly created RoleInstance
def create(friendly_name: nil, type: nil, permission: nil)
- data = {
+ data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'Type' => type,
'Permission' => permission,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return RoleInstance.new(
+ RoleInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -118,25 +118,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 RoleInstance
- 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 RolePage.new(@version, response, @solution)
+ RolePage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of RoleInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of RoleInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ RolePage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Chat.V2.RoleList>'
end
end
@@ -159,11 +172,11 @@
##
# Build an instance of RoleInstance
# @param [Hash] payload Payload response from the API
# @return [RoleInstance] RoleInstance
def get_instance(payload)
- return RoleInstance.new(
+ RoleInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -195,19 +208,19 @@
##
# Fetch a RoleInstance
# @return [RoleInstance] Fetched RoleInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return RoleInstance.new(
+ RoleInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
@@ -215,28 +228,28 @@
##
# Deletes the RoleInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Update the RoleInstance
# @param [String] permission The permission
# @return [RoleInstance] Updated RoleInstance
def update(permission: nil)
- data = {
+ data = Twilio::Values.of({
'Permission' => permission,
- }
+ })
payload = @version.update(
'POST',
@uri,
data: data,
)
- return RoleInstance.new(
+ RoleInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
\ No newline at end of file