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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, flow_sid: nil, engagement_sid: nil, step_sid: nil) ⇒ StepContextInstance

Initialize the StepContextInstance

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.

  • step_sid (String) (defaults to: nil)

    The SID of the Step the context is associated with.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 134

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'context' => payload['context'],
      'engagement_sid' => payload['engagement_sid'],
      'flow_sid' => payload['flow_sid'],
      'step_sid' => payload['step_sid'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'flow_sid' => flow_sid, 'engagement_sid' => engagement_sid, 'step_sid' => step_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



170
171
172
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 170

def 
  @properties['account_sid']
end

#contextHash

Returns The current state of the flow.

Returns:

  • (Hash)

    The current state of the flow



156
157
158
159
160
161
162
163
164
165
166
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 156

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

#engagement_sidString

Returns The SID of the Engagement.

Returns:

  • (String)

    The SID of the Engagement



182
183
184
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 182

def engagement_sid
  @properties['engagement_sid']
end

#fetchStepContextInstance

Fetch a StepContextInstance

Returns:



207
208
209
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 207

def fetch
  context.fetch
end

#flow_sidString

Returns The SID of the Flow.

Returns:

  • (String)

    The SID of the Flow



188
189
190
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 188

def flow_sid
  @properties['flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



220
221
222
223
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 220

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

#step_sidString

Returns Step SID.

Returns:

  • (String)

    Step SID



194
195
196
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 194

def step_sid
  @properties['step_sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



200
201
202
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 200

def url
  @properties['url']
end