Class: Twilio::REST::Preview::Studio::FlowContext::EngagementContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/studio/flow/engagement.rb,
lib/twilio-ruby/rest/preview/studio/flow/engagement/step.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Defined Under Namespace

Classes: StepContext, StepInstance, StepList, StepPage

Instance Method Summary collapse

Constructor Details

#initialize(version, flow_sid, sid) ⇒ EngagementContext

Initialize the EngagementContext

Parameters:

  • version (Version)

    Version that contains the resource

  • flow_sid (String)

    The flow_sid

  • sid (String)

    The sid



176
177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/preview/studio/flow/engagement.rb', line 176

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

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

  # Dependents
  @steps = nil
end

Instance Method Details

#fetchEngagementInstance

Fetch a EngagementInstance

Returns:



190
191
192
193
194
195
196
197
198
199
200
# File 'lib/twilio-ruby/rest/preview/studio/flow/engagement.rb', line 190

def fetch
  params = Twilio::Values.of({})

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

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

#steps(sid = :unset) ⇒ StepList, StepContext

Access the steps

Returns:

Raises:

  • (ArgumentError)


206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/preview/studio/flow/engagement.rb', line 206

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

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

  unless @steps
    @steps = StepList.new(@version, flow_sid: @solution[:flow_sid], engagement_sid: @solution[:sid], )
  end

  @steps
end

#to_sObject

Provide a user friendly representation



222
223
224
225
# File 'lib/twilio-ruby/rest/preview/studio/flow/engagement.rb', line 222

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