class Twilio::REST::Chat::V1::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/api/chat/rest/services] to fetch the resource from.
@param [String] channel_sid The unique ID of the
{Channel}[https://www.twilio.com/docs/api/chat/rest/channels] the member to fetch belongs to. Can be the Channel resource's `sid` or `unique_name` value.
@param [String] sid The Twilio-provided string that uniquely identifies the
Member resource to fetch.
@return [MemberContext] MemberContext
Calls superclass method
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 208 def initialize(version, service_sid, channel_sid, sid) 209 super(version) 210 211 # Path Solution 212 @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, } 213 @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Members/#{@solution[:sid]}" 214 end
Public Instance Methods
delete()
click to toggle source
Delete the MemberInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 234 def delete 235 @version.delete('DELETE', @uri) 236 end
fetch()
click to toggle source
Fetch the MemberInstance
@return [MemberInstance] Fetched MemberInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 219 def fetch 220 payload = @version.fetch('GET', @uri) 221 222 MemberInstance.new( 223 @version, 224 payload, 225 service_sid: @solution[:service_sid], 226 channel_sid: @solution[:channel_sid], 227 sid: @solution[:sid], 228 ) 229 end
inspect()
click to toggle source
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 275 def inspect 276 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 277 "#<Twilio.Chat.V1.MemberContext #{context}>" 278 end
to_s()
click to toggle source
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/channel/member.rb 268 def to_s 269 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 270 "#<Twilio.Chat.V1.MemberContext #{context}>" 271 end
update(role_sid: :unset, last_consumed_message_index: :unset)
click to toggle source
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 249 def update(role_sid: :unset, last_consumed_message_index: :unset) 250 data = Twilio::Values.of({ 251 'RoleSid' => role_sid, 252 'LastConsumedMessageIndex' => last_consumed_message_index, 253 }) 254 255 payload = @version.update('POST', @uri, data: data) 256 257 MemberInstance.new( 258 @version, 259 payload, 260 service_sid: @solution[:service_sid], 261 channel_sid: @solution[:channel_sid], 262 sid: @solution[:sid], 263 ) 264 end