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

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/studio/v1/flow.rb,
lib/twilio-ruby/rest/studio/v1/flow/execution.rb,
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/execution/execution_step.rb,
lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb,
lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb,
lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb,
lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb

Defined Under Namespace

Classes: EngagementContext, EngagementInstance, EngagementList, EngagementPage, ExecutionContext, ExecutionInstance, ExecutionList, ExecutionPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ FlowContext

Initialize the FlowContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Flow resource to fetch.



136
137
138
139
140
141
142
143
144
145
146
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 136

def initialize(version, sid)
    super(version)

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

    # Dependents
    @executions = nil
    @engagements = nil
end

Instance Method Details

#deleteBoolean

Delete the FlowInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#engagements(sid = :unset) ⇒ EngagementList, EngagementContext

Access the engagements

Returns:

Raises:

  • (ArgumentError)


201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 201

def engagements(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

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

    unless @engagements
        @engagements = EngagementList.new(
            @version, flow_sid: @solution[:sid], )
    end

 @engagements
end

#executions(sid = :unset) ⇒ ExecutionList, ExecutionContext

Access the executions

Returns:

Raises:

  • (ArgumentError)


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

def executions(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

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

    unless @executions
        @executions = ExecutionList.new(
            @version, flow_sid: @solution[:sid], )
    end

 @executions
end

#fetchFlowInstance

Fetch the FlowInstance

Returns:



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 162

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    FlowInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



226
227
228
229
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 226

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

#to_sObject

Provide a user friendly representation



219
220
221
222
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 219

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