class Twilio::REST::Chat::V2::ServiceContext::ChannelContext::MemberContext

Public Class Methods

new(version, service_sid, channel_sid, sid) click to toggle source

Initialize the MemberContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the

{Service}[https://www.twilio.com/docs/chat/rest/service-resource] to fetch the
Member resource from.

@param [String] channel_sid The SID of the

{Channel}[https://www.twilio.com/docs/chat/channels] the Member resource to
fetch belongs to. This value can be the Channel resource's `sid` or
`unique_name`.

@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 [MemberContext] MemberContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb
238 def initialize(version, service_sid, channel_sid, sid)
239   super(version)
240 
241   # Path Solution
242   @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, }
243   @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Members/#{@solution[:sid]}"
244 end

Public Instance Methods

delete(x_twilio_webhook_enabled: :unset) click to toggle source

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
266 def delete(x_twilio_webhook_enabled: :unset)
267   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
268 
269    @version.delete('DELETE', @uri, headers: headers)
270 end
fetch() click to toggle source

Fetch the MemberInstance @return [MemberInstance] Fetched MemberInstance

    # File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb
249 def fetch
250   payload = @version.fetch('GET', @uri)
251 
252   MemberInstance.new(
253       @version,
254       payload,
255       service_sid: @solution[:service_sid],
256       channel_sid: @solution[:channel_sid],
257       sid: @solution[:sid],
258   )
259 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb
329 def inspect
330   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
331   "#<Twilio.Chat.V2.MemberContext #{context}>"
332 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/service/channel/member.rb
322 def to_s
323   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
324   "#<Twilio.Chat.V2.MemberContext #{context}>"
325 end
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) click to toggle source

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
298 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)
299   data = Twilio::Values.of({
300       'RoleSid' => role_sid,
301       'LastConsumedMessageIndex' => last_consumed_message_index,
302       'LastConsumptionTimestamp' => Twilio.serialize_iso8601_datetime(last_consumption_timestamp),
303       'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
304       'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
305       'Attributes' => attributes,
306   })
307   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
308 
309   payload = @version.update('POST', @uri, data: data, headers: headers)
310 
311   MemberInstance.new(
312       @version,
313       payload,
314       service_sid: @solution[:service_sid],
315       channel_sid: @solution[:channel_sid],
316       sid: @solution[:sid],
317   )
318 end