class Twilio::REST::Conversations::V1::ServiceContext::RoleContext
Public Class Methods
new(version, chat_service_sid, sid)
click to toggle source
Initialize the RoleContext
@param [Version] version Version
that contains the resource @param [String] chat_service_sid The SID of the {Conversation
Service}[https://www.twilio.com/docs/conversations/api/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/conversations/v1/service/role.rb 180 def initialize(version, chat_service_sid, sid) 181 super(version) 182 183 # Path Solution 184 @solution = {chat_service_sid: chat_service_sid, sid: sid, } 185 @uri = "/Services/#{@solution[:chat_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/conversations/v1/service/role.rb 213 def delete 214 @version.delete('DELETE', @uri) 215 end
fetch()
click to toggle source
Fetch the RoleInstance
@return [RoleInstance] Fetched RoleInstance
# File lib/twilio-ruby/rest/conversations/v1/service/role.rb 220 def fetch 221 payload = @version.fetch('GET', @uri) 222 223 RoleInstance.new( 224 @version, 225 payload, 226 chat_service_sid: @solution[:chat_service_sid], 227 sid: @solution[:sid], 228 ) 229 end
inspect()
click to toggle source
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/role.rb 240 def inspect 241 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 242 "#<Twilio.Conversations.V1.RoleContext #{context}>" 243 end
to_s()
click to toggle source
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/role.rb 233 def to_s 234 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 235 "#<Twilio.Conversations.V1.RoleContext #{context}>" 236 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/service/role.rb 197 def update(permission: nil) 198 data = Twilio::Values.of({'Permission' => Twilio.serialize_list(permission) { |e| e }, }) 199 200 payload = @version.update('POST', @uri, data: data) 201 202 RoleInstance.new( 203 @version, 204 payload, 205 chat_service_sid: @solution[:chat_service_sid], 206 sid: @solution[:sid], 207 ) 208 end