class Twilio::REST::Conversations::V1::RoleContext

Public Class Methods

new(version, sid) click to toggle source

Initialize the RoleContext @param [Version] version Version that contains the resource @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/conversations/v1/role.rb
173 def initialize(version, sid)
174   super(version)
175 
176   # Path Solution
177   @solution = {sid: sid, }
178   @uri = "/Roles/#{@solution[:sid]}"
179 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/conversations/v1/role.rb
201 def delete
202    @version.delete('DELETE', @uri)
203 end
fetch() click to toggle source

Fetch the RoleInstance @return [RoleInstance] Fetched RoleInstance

    # File lib/twilio-ruby/rest/conversations/v1/role.rb
208 def fetch
209   payload = @version.fetch('GET', @uri)
210 
211   RoleInstance.new(@version, payload, sid: @solution[:sid], )
212 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/role.rb
223 def inspect
224   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
225   "#<Twilio.Conversations.V1.RoleContext #{context}>"
226 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/role.rb
216 def to_s
217   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
218   "#<Twilio.Conversations.V1.RoleContext #{context}>"
219 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/conversations/v1/role.rb
190 def update(permission: nil)
191   data = Twilio::Values.of({'Permission' => Twilio.serialize_list(permission) { |e| e }, })
192 
193   payload = @version.update('POST', @uri, data: data)
194 
195   RoleInstance.new(@version, payload, sid: @solution[:sid], )
196 end