class Twilio::REST::Conversations::V1::ServiceContext::RoleInstance

Public Class Methods

new(version, payload, chat_service_sid: nil, sid: nil) click to toggle source

Initialize the RoleInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] chat_service_sid The SID of the {Conversation

Service}[https://www.twilio.com/docs/conversations/api/service-resource] the
Role resource is associated with.

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

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
256 def initialize(version, payload, chat_service_sid: nil, sid: nil)
257   super(version)
258 
259   # Marshaled Properties
260   @properties = {
261       'sid' => payload['sid'],
262       'account_sid' => payload['account_sid'],
263       'chat_service_sid' => payload['chat_service_sid'],
264       'friendly_name' => payload['friendly_name'],
265       'type' => payload['type'],
266       'permissions' => payload['permissions'],
267       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
268       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
269       'url' => payload['url'],
270   }
271 
272   # Context
273   @instance_context = nil
274   @params = {'chat_service_sid' => chat_service_sid, 'sid' => sid || @properties['sid'], }
275 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
296 def account_sid
297   @properties['account_sid']
298 end
chat_service_sid() click to toggle source

@return [String] The SID of the Conversation Service that the resource is associated with

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
302 def chat_service_sid
303   @properties['chat_service_sid']
304 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [RoleContext] RoleContext for this RoleInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
281 def context
282   unless @instance_context
283     @instance_context = RoleContext.new(@version, @params['chat_service_sid'], @params['sid'], )
284   end
285   @instance_context
286 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
326 def date_created
327   @properties['date_created']
328 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
332 def date_updated
333   @properties['date_updated']
334 end
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
358 def delete
359   context.delete
360 end
fetch() click to toggle source

Fetch the RoleInstance @return [RoleInstance] Fetched RoleInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
365 def fetch
366   context.fetch
367 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
308 def friendly_name
309   @properties['friendly_name']
310 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
378 def inspect
379   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
380   "<Twilio.Conversations.V1.RoleInstance #{values}>"
381 end
permissions() click to toggle source

@return [Array] An array of the permissions the role has been granted

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
320 def permissions
321   @properties['permissions']
322 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
290 def sid
291   @properties['sid']
292 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
371 def to_s
372   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
373   "<Twilio.Conversations.V1.RoleInstance #{values}>"
374 end
type() click to toggle source

@return [role.RoleType] The type of role

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
314 def type
315   @properties['type']
316 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
351 def update(permission: nil)
352   context.update(permission: permission, )
353 end
url() click to toggle source

@return [String] An absolute URL for this user role.

    # File lib/twilio-ruby/rest/conversations/v1/service/role.rb
338 def url
339   @properties['url']
340 end