class Twilio::REST::Chat::V2::ServiceContext::RoleContext

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the RoleContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the

{Service}[https://www.twilio.com/docs/chat/rest/service-resource] to fetch the
Role resource from.

@param [String] sid The SID of the Role resource to fetch. @return [RoleContext] RoleContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
179 def initialize(version, service_sid, sid)
180   super(version)
181 
182   # Path Solution
183   @solution = {service_sid: service_sid, sid: sid, }
184   @uri = "/Services/#{@solution[:service_sid]}/Roles/#{@solution[:sid]}"
185 end

Public Instance Methods

delete() click to toggle source

Delete the RoleInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
199 def delete
200    @version.delete('DELETE', @uri)
201 end
fetch() click to toggle source

Fetch the RoleInstance @return [RoleInstance] Fetched RoleInstance

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
190 def fetch
191   payload = @version.fetch('GET', @uri)
192 
193   RoleInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
194 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
229 def inspect
230   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
231   "#<Twilio.Chat.V2.RoleContext #{context}>"
232 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
222 def to_s
223   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
224   "#<Twilio.Chat.V2.RoleContext #{context}>"
225 end
update(permission: nil) click to toggle source

Update the RoleInstance @param [Array] permission A permission that you grant to the role. Only

one permission can be granted per parameter. To assign more than one permission,
repeat this parameter for each permission value. Note that the update action
replaces all previously assigned permissions with those defined in the update
action. To remove a permission, do not include it in the subsequent update
action. The values for this parameter depend on the role's `type`.

@return [RoleInstance] Updated RoleInstance

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
212 def update(permission: nil)
213   data = Twilio::Values.of({'Permission' => Twilio.serialize_list(permission) { |e| e }, })
214 
215   payload = @version.update('POST', @uri, data: data)
216 
217   RoleInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
218 end