class Twilio::REST::Chat::V2::ServiceContext::RoleInstance

Public Class Methods

new(version, payload, 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] service_sid The SID of the

{Service}[https://www.twilio.com/docs/chat/rest/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/chat/v2/service/role.rb
245 def initialize(version, payload, service_sid: nil, sid: nil)
246   super(version)
247 
248   # Marshaled Properties
249   @properties = {
250       'sid' => payload['sid'],
251       'account_sid' => payload['account_sid'],
252       'service_sid' => payload['service_sid'],
253       'friendly_name' => payload['friendly_name'],
254       'type' => payload['type'],
255       'permissions' => payload['permissions'],
256       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
257       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
258       'url' => payload['url'],
259   }
260 
261   # Context
262   @instance_context = nil
263   @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
264 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/chat/v2/service/role.rb
285 def account_sid
286   @properties['account_sid']
287 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/chat/v2/service/role.rb
270 def context
271   unless @instance_context
272     @instance_context = RoleContext.new(@version, @params['service_sid'], @params['sid'], )
273   end
274   @instance_context
275 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/chat/v2/service/role.rb
315 def date_created
316   @properties['date_created']
317 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/chat/v2/service/role.rb
321 def date_updated
322   @properties['date_updated']
323 end
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
341 def delete
342   context.delete
343 end
fetch() click to toggle source

Fetch the RoleInstance @return [RoleInstance] Fetched RoleInstance

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
334 def fetch
335   context.fetch
336 end
friendly_name() click to toggle source

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

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
297 def friendly_name
298   @properties['friendly_name']
299 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
367 def inspect
368   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
369   "<Twilio.Chat.V2.RoleInstance #{values}>"
370 end
permissions() click to toggle source

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

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
309 def permissions
310   @properties['permissions']
311 end
service_sid() click to toggle source

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

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
291 def service_sid
292   @properties['service_sid']
293 end
sid() click to toggle source

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

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
279 def sid
280   @properties['sid']
281 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
360 def to_s
361   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
362   "<Twilio.Chat.V2.RoleInstance #{values}>"
363 end
type() click to toggle source

@return [role.RoleType] The type of role

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
303 def type
304   @properties['type']
305 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
354 def update(permission: nil)
355   context.update(permission: permission, )
356 end
url() click to toggle source

@return [String] The absolute URL of the Role resource

    # File lib/twilio-ruby/rest/chat/v2/service/role.rb
327 def url
328   @properties['url']
329 end