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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, flow_sid: nil, engagement_sid: nil, sid: nil) ⇒ StepInstance

Initialize the StepInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • flow_sid (String) (defaults to: nil)

    The SID of the Flow.

  • engagement_sid (String) (defaults to: nil)

    The SID of the Engagement.

  • sid (String) (defaults to: nil)

    The SID of the Step resource to fetch.



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 225

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

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'flow_sid' => payload['flow_sid'],
      'engagement_sid' => payload['engagement_sid'],
      'name' => payload['name'],
      'context' => payload['context'],
      'transitioned_from' => payload['transitioned_from'],
      'transitioned_to' => payload['transitioned_to'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



277
278
279
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 277

def 
  @properties['account_sid']
end

#contextHash

Returns The current state of the flow.

Returns:

  • (Hash)

    The current state of the flow



257
258
259
260
261
262
263
264
265
266
267
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 257

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

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created



319
320
321
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 319

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was last updated



325
326
327
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 325

def date_updated
  @properties['date_updated']
end

#engagement_sidString

Returns The SID of the Engagement.

Returns:

  • (String)

    The SID of the Engagement



289
290
291
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 289

def engagement_sid
  @properties['engagement_sid']
end

#fetchStepInstance

Fetch a StepInstance

Returns:



344
345
346
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 344

def fetch
  context.fetch
end

#flow_sidString

Returns The SID of the Flow.

Returns:

  • (String)

    The SID of the Flow



283
284
285
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 283

def flow_sid
  @properties['flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



364
365
366
367
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 364

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

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources



337
338
339
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 337

def links
  @properties['links']
end

#nameString

Returns The event that caused the Flow to transition to the Step.

Returns:

  • (String)

    The event that caused the Flow to transition to the Step



295
296
297
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 295

def name
  @properties['name']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



271
272
273
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 271

def sid
  @properties['sid']
end

#step_contextstep_context

Access the step_context

Returns:



351
352
353
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 351

def step_context
  context.step_context
end

#to_sObject

Provide a user friendly representation



357
358
359
360
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 357

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

#transitioned_fromString

Returns The Widget that preceded the Widget for the Step.

Returns:

  • (String)

    The Widget that preceded the Widget for the Step



307
308
309
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 307

def transitioned_from
  @properties['transitioned_from']
end

#transitioned_toString

Returns The Widget that will follow the Widget for the Step.

Returns:

  • (String)

    The Widget that will follow the Widget for the Step



313
314
315
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 313

def transitioned_to
  @properties['transitioned_to']
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



331
332
333
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 331

def url
  @properties['url']
end