class Twilio::REST::Chat::V1::ServiceContext::ChannelContext::MemberInstance
Public Class Methods
Initialize the MemberInstance
@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] channel_sid
The unique ID of the
{Channel}[https://www.twilio.com/docs/api/chat/rest/channels] for the member.
@param [String] sid The Twilio-provided string that uniquely identifies the
Member resource to fetch.
@return [MemberInstance] MemberInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 294 def initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil) 295 super(version) 296 297 # Marshaled Properties 298 @properties = { 299 'sid' => payload['sid'], 300 'account_sid' => payload['account_sid'], 301 'channel_sid' => payload['channel_sid'], 302 'service_sid' => payload['service_sid'], 303 'identity' => payload['identity'], 304 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 305 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 306 'role_sid' => payload['role_sid'], 307 'last_consumed_message_index' => payload['last_consumed_message_index'] == nil ? payload['last_consumed_message_index'] : payload['last_consumed_message_index'].to_i, 308 'last_consumption_timestamp' => Twilio.deserialize_iso8601_datetime(payload['last_consumption_timestamp']), 309 'url' => payload['url'], 310 } 311 312 # Context 313 @instance_context = nil 314 @params = { 315 'service_sid' => service_sid, 316 'channel_sid' => channel_sid, 317 'sid' => sid || @properties['sid'], 318 } 319 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 345 def account_sid 346 @properties['account_sid'] 347 end
@return [String] The unique ID of the Channel for the member
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 351 def channel_sid 352 @properties['channel_sid'] 353 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 [MemberContext] MemberContext
for this MemberInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 325 def context 326 unless @instance_context 327 @instance_context = MemberContext.new( 328 @version, 329 @params['service_sid'], 330 @params['channel_sid'], 331 @params['sid'], 332 ) 333 end 334 @instance_context 335 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 369 def date_created 370 @properties['date_created'] 371 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/channel/member.rb 375 def date_updated 376 @properties['date_updated'] 377 end
Delete the MemberInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 413 def delete 414 context.delete 415 end
Fetch the MemberInstance
@return [MemberInstance] Fetched MemberInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 406 def fetch 407 context.fetch 408 end
@return [String] The string that identifies the resource's User
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 363 def identity 364 @properties['identity'] 365 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 441 def inspect 442 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 443 "<Twilio.Chat.V1.MemberInstance #{values}>" 444 end
@return [String] The index of the last Message that the Member has read within the Channel
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 387 def last_consumed_message_index 388 @properties['last_consumed_message_index'] 389 end
@return [Time] The ISO 8601 based timestamp string that represents the date-time of the last Message read event for the Member within the Channel
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 393 def last_consumption_timestamp 394 @properties['last_consumption_timestamp'] 395 end
@return [String] The SID of the Role assigned to the member
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 381 def role_sid 382 @properties['role_sid'] 383 end
@return [String] The SID of the Service that the resource is associated with
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 357 def service_sid 358 @properties['service_sid'] 359 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 339 def sid 340 @properties['sid'] 341 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 434 def to_s 435 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 436 "<Twilio.Chat.V1.MemberInstance #{values}>" 437 end
Update the MemberInstance
@param [String] role_sid
The SID of the
{Role}[https://www.twilio.com/docs/api/chat/rest/roles] to assign to the member. The default roles are those specified on the {Service}[https://www.twilio.com/docs/chat/api/services].
@param [String] last_consumed_message_index
The index of the last
{Message}[https://www.twilio.com/docs/api/chat/rest/messages] that the Member has read within the {Channel}[https://www.twilio.com/docs/api/chat/rest/channels].
@return [MemberInstance] Updated MemberInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 428 def update(role_sid: :unset, last_consumed_message_index: :unset) 429 context.update(role_sid: role_sid, last_consumed_message_index: last_consumed_message_index, ) 430 end
@return [String] The absolute URL of the Member resource
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 399 def url 400 @properties['url'] 401 end