class Twilio::REST::Chat::V2::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/chat/rest/service-resource] the Member resource is associated with.
@param [String] channel_sid
The SID of the
{Channel}[https://www.twilio.com/docs/chat/channels] the Member resource belongs to.
@param [String] sid The SID of the Member resource to fetch. This value can be
either the Member's `sid` or its `identity` value.
@return [MemberInstance] MemberInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 349 def initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil) 350 super(version) 351 352 # Marshaled Properties 353 @properties = { 354 'sid' => payload['sid'], 355 'account_sid' => payload['account_sid'], 356 'channel_sid' => payload['channel_sid'], 357 'service_sid' => payload['service_sid'], 358 'identity' => payload['identity'], 359 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 360 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 361 'role_sid' => payload['role_sid'], 362 'last_consumed_message_index' => payload['last_consumed_message_index'] == nil ? payload['last_consumed_message_index'] : payload['last_consumed_message_index'].to_i, 363 'last_consumption_timestamp' => Twilio.deserialize_iso8601_datetime(payload['last_consumption_timestamp']), 364 'url' => payload['url'], 365 'attributes' => payload['attributes'], 366 } 367 368 # Context 369 @instance_context = nil 370 @params = { 371 'service_sid' => service_sid, 372 'channel_sid' => channel_sid, 373 'sid' => sid || @properties['sid'], 374 } 375 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 401 def account_sid 402 @properties['account_sid'] 403 end
@return [String] The JSON string that stores application-specific data
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 461 def attributes 462 @properties['attributes'] 463 end
@return [String] The SID of the Channel for the member
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 407 def channel_sid 408 @properties['channel_sid'] 409 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/v2/service/channel/member.rb 381 def context 382 unless @instance_context 383 @instance_context = MemberContext.new( 384 @version, 385 @params['service_sid'], 386 @params['channel_sid'], 387 @params['sid'], 388 ) 389 end 390 @instance_context 391 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 425 def date_created 426 @properties['date_created'] 427 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 431 def date_updated 432 @properties['date_updated'] 433 end
Delete the MemberInstance
@param [member.WebhookEnabledType] x_twilio_webhook_enabled The
X-Twilio-Webhook-Enabled HTTP request header
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 477 def delete(x_twilio_webhook_enabled: :unset) 478 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 479 end
Fetch the MemberInstance
@return [MemberInstance] Fetched MemberInstance
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 468 def fetch 469 context.fetch 470 end
@return [String] The string that identifies the resource's User
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 419 def identity 420 @properties['identity'] 421 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 528 def inspect 529 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 530 "<Twilio.Chat.V2.MemberInstance #{values}>" 531 end
@return [String] The index of the last Message that the Member has read within the Channel
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 443 def last_consumed_message_index 444 @properties['last_consumed_message_index'] 445 end
@return [Time] The ISO 8601 based timestamp string that represents the datetime of the last Message read event for the Member within the Channel
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 449 def last_consumption_timestamp 450 @properties['last_consumption_timestamp'] 451 end
@return [String] The SID of the Role assigned to the member
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 437 def role_sid 438 @properties['role_sid'] 439 end
@return [String] The SID of the Service that the resource is associated with
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 413 def service_sid 414 @properties['service_sid'] 415 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 395 def sid 396 @properties['sid'] 397 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 521 def to_s 522 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 523 "<Twilio.Chat.V2.MemberInstance #{values}>" 524 end
Update the MemberInstance
@param [String] role_sid
The SID of the
{Role}[https://www.twilio.com/docs/chat/rest/role-resource] to assign to the member. The default roles are those specified on the {Service}[https://www.twilio.com/docs/chat/rest/service-resource].
@param [String] last_consumed_message_index
The index of the last
{Message}[https://www.twilio.com/docs/chat/rest/message-resource] that the Member has read within the {Channel}[https://www.twilio.com/docs/chat/channels].
@param [Time] last_consumption_timestamp
The {ISO
8601}[https://en.wikipedia.org/wiki/ISO_8601] timestamp of the last {Message}[https://www.twilio.com/docs/chat/rest/message-resource] read event for the Member within the {Channel}[https://www.twilio.com/docs/chat/channels].
@param [Time] date_created
The date, specified in {ISO
8601}[https://en.wikipedia.org/wiki/ISO_8601] format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source.
@param [Time] date_updated
The date, specified in {ISO
8601}[https://en.wikipedia.org/wiki/ISO_8601] format, to assign to the resource as the date it was last updated.
@param [String] attributes A valid JSON string that contains
application-specific data.
@param [member.WebhookEnabledType] x_twilio_webhook_enabled The
X-Twilio-Webhook-Enabled HTTP request header
@return [MemberInstance] Updated MemberInstance
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 507 def update(role_sid: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, x_twilio_webhook_enabled: :unset) 508 context.update( 509 role_sid: role_sid, 510 last_consumed_message_index: last_consumed_message_index, 511 last_consumption_timestamp: last_consumption_timestamp, 512 date_created: date_created, 513 date_updated: date_updated, 514 attributes: attributes, 515 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 516 ) 517 end
@return [String] The absolute URL of the Member resource
# File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb 455 def url 456 @properties['url'] 457 end