Class: Twilio::REST::Studio::V1::FlowContext::EngagementContext

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

Defined Under Namespace

Classes: EngagementContextContext, EngagementContextInstance, EngagementContextList, EngagementContextPage, 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 unique SID identifier of the Flow.

  • sid (String)

    The unique SID identifier of the Engagement.



184
185
186
187
188
189
190
191
192
193
194
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 184

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
  @engagement_context = nil
end

Instance Method Details

#deleteBoolean

Deletes the EngagementInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



214
215
216
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 214

def delete
  @version.delete('delete', @uri)
end

#engagement_contextEngagementContextList, EngagementContextContext

Access the engagement_context



240
241
242
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 240

def engagement_context
  EngagementContextContext.new(@version, @solution[:flow_sid], @solution[:sid], )
end

#fetchEngagementInstance

Fetch a EngagementInstance

Returns:



199
200
201
202
203
204
205
206
207
208
209
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 199

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

#inspectObject

Provide a detailed, user friendly representation



253
254
255
256
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 253

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

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

Access the steps

Returns:

Raises:

  • (ArgumentError)


222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 222

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



246
247
248
249
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement.rb', line 246

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