class Twilio::REST::Chat::V1::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/api/chat/rest/services] to fetch the
resource from.

@param [String] sid The Twilio-provided string that uniquely identifies the Role

resource to fetch.

@return [RoleContext] RoleContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/chat/v1/service/role.rb
180 def initialize(version, service_sid, sid)
181   super(version)
182 
183   # Path Solution
184   @solution = {service_sid: service_sid, sid: sid, }
185   @uri = "/Services/#{@solution[:service_sid]}/Roles/#{@solution[:sid]}"
186 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/v1/service/role.rb
200 def delete
201    @version.delete('DELETE', @uri)
202 end
fetch() click to toggle source

Fetch the RoleInstance @return [RoleInstance] Fetched RoleInstance

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

Provide a detailed, user friendly representation

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

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v1/service/role.rb
221 def to_s
222   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
223   "#<Twilio.Chat.V1.RoleContext #{context}>"
224 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. The values for this parameter
depend on the role's `type` and are described in the documentation.

@return [RoleInstance] Updated RoleInstance

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