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

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/interaction.rb,
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: InteractionChannelContext, InteractionChannelInstance, InteractionChannelList, InteractionChannelPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ InteractionContext

Initialize the InteractionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Interaction resource to fetch.


84
85
86
87
88
89
90
91
92
93
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 84

def initialize(version, sid)
  super(version)

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

  # Dependents
  @channels = nil
end

Instance Method Details

#channels(sid = :unset) ⇒ InteractionChannelList, InteractionChannelContext

Access the channels

Returns:

Raises:

  • (ArgumentError)

108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 108

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

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

  unless @channels
    @channels = InteractionChannelList.new(@version, interaction_sid: @solution[:sid], )
  end

  @channels
end

#fetchInteractionInstance

Fetch the InteractionInstance

Returns:


98
99
100
101
102
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 98

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

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

#inspectObject

Provide a detailed, user friendly representation


131
132
133
134
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 131

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

#to_sObject

Provide a user friendly representation


124
125
126
127
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 124

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