class Twilio::REST::Chat::V1::ServiceContext::RoleInstance
Public Class Methods
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/api/chat/rest/services] the resource is associated with.
@param [String] sid The Twilio-provided string that uniquely identifies the Role
resource to fetch.
@return [RoleInstance] RoleInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/chat/v1/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
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 285 def account_sid 286 @properties['account_sid'] 287 end
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/v1/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
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 315 def date_created 316 @properties['date_created'] 317 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 321 def date_updated 322 @properties['date_updated'] 323 end
Delete the RoleInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 341 def delete 342 context.delete 343 end
Fetch the RoleInstance
@return [RoleInstance] Fetched RoleInstance
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 334 def fetch 335 context.fetch 336 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 297 def friendly_name 298 @properties['friendly_name'] 299 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 365 def inspect 366 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 367 "<Twilio.Chat.V1.RoleInstance #{values}>" 368 end
@return [Array] An array of the permissions the role has been granted
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 309 def permissions 310 @properties['permissions'] 311 end
@return [String] The SID of the Service that the resource is associated with
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 291 def service_sid 292 @properties['service_sid'] 293 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 279 def sid 280 @properties['sid'] 281 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 358 def to_s 359 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 360 "<Twilio.Chat.V1.RoleInstance #{values}>" 361 end
@return [role.RoleType] The type of role
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 303 def type 304 @properties['type'] 305 end
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 352 def update(permission: nil) 353 context.update(permission: permission, ) 354 end
@return [String] The absolute URL of the Role resource
# File lib/twilio-ruby/rest/chat/v1/service/role.rb 327 def url 328 @properties['url'] 329 end