Class: Twilio::REST::Studio::V1::FlowContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Studio::V1::FlowContext
- 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, EngagementInstanceMetadata, EngagementList, EngagementListResponse, EngagementPage, EngagementPageMetadata, ExecutionContext, ExecutionInstance, ExecutionInstanceMetadata, ExecutionList, ExecutionListResponse, ExecutionPage, ExecutionPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the FlowInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the FlowInstanceMetadata.
-
#engagements(sid = :unset) ⇒ EngagementList, EngagementContext
Access the engagements.
-
#executions(sid = :unset) ⇒ ExecutionList, ExecutionContext
Access the executions.
-
#fetch ⇒ FlowInstance
Fetch the FlowInstance.
-
#fetch_with_metadata ⇒ FlowInstance
Fetch the FlowInstanceMetadata.
-
#initialize(version, sid) ⇒ FlowContext
constructor
Initialize the FlowContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, sid) ⇒ FlowContext
Initialize the FlowContext
159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 159 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Flows/#{@solution[:sid]}" # Dependents @executions = nil @engagements = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the FlowInstance
174 175 176 177 178 179 180 181 182 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 174 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the FlowInstanceMetadata
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 187 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) flow_instance = FlowInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) FlowInstanceMetadata.new(@version, flow_instance, response.headers, response.status_code) end |
#engagements(sid = :unset) ⇒ EngagementList, EngagementContext
Access the engagements
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 270 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
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 251 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 |
#fetch ⇒ FlowInstance
Fetch the FlowInstance
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 206 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 |
#fetch_with_metadata ⇒ FlowInstance
Fetch the FlowInstanceMetadata
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 225 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) flow_instance = FlowInstance.new( @version, response.body, sid: @solution[:sid], ) FlowInstanceMetadata.new( @version, flow_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
295 296 297 298 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 295 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V1.FlowContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
288 289 290 291 |
# File 'lib/twilio-ruby/rest/studio/v1/flow.rb', line 288 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V1.FlowContext #{context}>" end |