Class: Twilio::REST::FlexApi::V1::InteractionContext::InteractionChannelContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb,
lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb,
lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb

Defined Under Namespace

Classes: InteractionChannelInviteInstance, InteractionChannelInviteList, InteractionChannelInvitePage, InteractionChannelParticipantContext, InteractionChannelParticipantInstance, InteractionChannelParticipantList, InteractionChannelParticipantPage

Instance Method Summary collapse

Constructor Details

#initialize(version, interaction_sid, sid) ⇒ InteractionChannelContext

Initialize the InteractionChannelContext

Parameters:

  • version (Version)

    Version that contains the resource

  • interaction_sid (String)

    The unique string created by Twilio to identify an Interaction resource, prefixed with KD.

  • sid (String)

    The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO.


154
155
156
157
158
159
160
161
162
163
164
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 154

def initialize(version, interaction_sid, sid)
  super(version)

  # Path Solution
  @solution = {interaction_sid: interaction_sid, sid: sid, }
  @uri = "/Interactions/#{@solution[:interaction_sid]}/Channels/#{@solution[:sid]}"

  # Dependents
  @invites = nil
  @participants = nil
end

Instance Method Details

#fetchInteractionChannelInstance

Fetch the InteractionChannelInstance

Returns:


169
170
171
172
173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 169

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

  InteractionChannelInstance.new(
      @version,
      payload,
      interaction_sid: @solution[:interaction_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


254
255
256
257
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 254

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

#invitesInteractionChannelInviteList, InteractionChannelInviteContext

Access the invites

Returns:


206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 206

def invites
  unless @invites
    @invites = InteractionChannelInviteList.new(
        @version,
        interaction_sid: @solution[:interaction_sid],
        channel_sid: @solution[:sid],
    )
  end

  @invites
end

#participants(sid = :unset) ⇒ InteractionChannelParticipantList, InteractionChannelParticipantContext

Access the participants

Returns:

Raises:

  • (ArgumentError)

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 222

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

  if sid != :unset
    return InteractionChannelParticipantContext.new(
        @version,
        @solution[:interaction_sid],
        @solution[:sid],
        sid,
    )
  end

  unless @participants
    @participants = InteractionChannelParticipantList.new(
        @version,
        interaction_sid: @solution[:interaction_sid],
        channel_sid: @solution[:sid],
    )
  end

  @participants
end

#to_sObject

Provide a user friendly representation


247
248
249
250
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 247

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

#update(status: nil, routing: :unset) ⇒ InteractionChannelInstance

Update the InteractionChannelInstance

Parameters:

  • status (interaction_channel.Status) (defaults to: nil)

    Required. Indicates the Interaction channel's status. When a channel is set to `closed`, all tasks are put in the `wrapping` state by default unless the Routing status is set to `closed` in which case the tasks will be `completed`. Value: `closed`.

  • routing (Hash) (defaults to: :unset)

    Optional. The state of associated tasks. If not specified, all tasks will be set to `wrapping`.

Returns:


189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 189

def update(status: nil, routing: :unset)
  data = Twilio::Values.of({'Status' => status, 'Routing' => Twilio.serialize_object(routing), })

  payload = @version.update('POST', @uri, data: data)

  InteractionChannelInstance.new(
      @version,
      payload,
      interaction_sid: @solution[:interaction_sid],
      sid: @solution[:sid],
  )
end