Class: Twilio::REST::Proxy::V1::ServiceContext::SessionContext::ParticipantContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb,
lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Defined Under Namespace

Classes: MessageInteractionContext, MessageInteractionInstance, MessageInteractionList, MessageInteractionPage

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, session_sid, sid) ⇒ ParticipantContext

Initialize the ParticipantContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The SID of the parent Service of the resource to fetch.

  • session_sid (String)

    The SID of the parent Session of the resource to fetch.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Participant resource to fetch.


214
215
216
217
218
219
220
221
222
223
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb', line 214

def initialize(version, service_sid, session_sid, sid)
  super(version)

  # Path Solution
  @solution = {service_sid: service_sid, session_sid: session_sid, sid: sid, }
  @uri = "/Services/#{@solution[:service_sid]}/Sessions/#{@solution[:session_sid]}/Participants/#{@solution[:sid]}"

  # Dependents
  @message_interactions = nil
end

Instance Method Details

#deleteBoolean

Delete the ParticipantInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


243
244
245
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb', line 243

def delete
   @version.delete('DELETE', @uri)
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:


228
229
230
231
232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb', line 228

def fetch
  payload = @version.fetch('GET', @uri)

  ParticipantInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      session_sid: @solution[:session_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


285
286
287
288
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb', line 285

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Proxy.V1.ParticipantContext #{context}>"
end

#message_interactions(sid = :unset) ⇒ MessageInteractionList, MessageInteractionContext

Access the message_interactions

Returns:

Raises:

  • (ArgumentError)

251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb', line 251

def message_interactions(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return MessageInteractionContext.new(
        @version,
        @solution[:service_sid],
        @solution[:session_sid],
        @solution[:sid],
        sid,
    )
  end

  unless @message_interactions
    @message_interactions = MessageInteractionList.new(
        @version,
        service_sid: @solution[:service_sid],
        session_sid: @solution[:session_sid],
        participant_sid: @solution[:sid],
    )
  end

  @message_interactions
end

#to_sObject

Provide a user friendly representation


278
279
280
281
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb', line 278

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Proxy.V1.ParticipantContext #{context}>"
end