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

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

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

Initialize the EngagementContextInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • flow_sid (String) (defaults to: nil)

    The unique SID identifier of the Flow.

  • engagement_sid (String) (defaults to: nil)

    The unique SID identifier of the Engagement.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 129

def initialize(version, payload, flow_sid: nil, engagement_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'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'flow_sid' => flow_sid, 'engagement_sid' => engagement_sid, }
end

Instance Method Details

#account_sidString

Returns Account Sid.

Returns:

  • (String)

    Account Sid.



163
164
165
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 163

def 
  @properties['account_sid']
end

#contextHash

Returns Flow state.

Returns:

  • (Hash)

    Flow state.



150
151
152
153
154
155
156
157
158
159
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 150

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

#engagement_sidString

Returns Engagement Sid.

Returns:

  • (String)

    Engagement Sid.



175
176
177
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 175

def engagement_sid
  @properties['engagement_sid']
end

#fetchEngagementContextInstance

Fetch a EngagementContextInstance

Returns:



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

def fetch
  context.fetch
end

#flow_sidString

Returns Flow Sid.

Returns:

  • (String)

    Flow Sid.



181
182
183
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 181

def flow_sid
  @properties['flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



187
188
189
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 187

def url
  @properties['url']
end