Class: Twilio::REST::FlexApi::V1::InteractionInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/interaction.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ InteractionInstance

Initialize the InteractionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The SID of the Interaction resource to fetch.


144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 144

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'channel' => payload['channel'],
      'routing' => payload['routing'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#channelHash

Returns The Interaction's channel.

Returns:

  • (Hash)

    The Interaction's channel


180
181
182
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 180

def channel
  @properties['channel']
end

#channelschannels

Access the channels

Returns:


212
213
214
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 212

def channels
  context.channels
end

#contextInteractionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


165
166
167
168
169
170
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 165

def context
  unless @instance_context
    @instance_context = InteractionContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#fetchInteractionInstance

Fetch the InteractionInstance

Returns:


205
206
207
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 205

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


225
226
227
228
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 225

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.FlexApi.V1.InteractionInstance #{values}>"
end

Returns The links.

Returns:

  • (String)

    The links


198
199
200
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 198

def links
  @properties['links']
end

#routingHash

Returns The Interaction's routing logic.

Returns:

  • (Hash)

    The Interaction's routing logic


186
187
188
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 186

def routing
  @properties['routing']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


174
175
176
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 174

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


218
219
220
221
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 218

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.FlexApi.V1.InteractionInstance #{values}>"
end

#urlString

Returns The url.

Returns:

  • (String)

    The url


192
193
194
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 192

def url
  @properties['url']
end