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.



80
81
82
83
84
85
86
87
88
89
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 80

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)


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 113

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:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 93

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    InteractionInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



138
139
140
141
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 138

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

#to_sObject

Provide a user friendly representation



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

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