Class: Twilio::REST::Studio::V2::FlowContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Studio::V2::FlowContext
- Defined in:
- lib/twilio-ruby/rest/studio/v2/flow.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution.rb,
lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb,
lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb
Defined Under Namespace
Classes: ExecutionContext, ExecutionInstance, ExecutionList, ExecutionPage, FlowRevisionContext, FlowRevisionInstance, FlowRevisionList, FlowRevisionPage, FlowTestUserContext, FlowTestUserInstance, FlowTestUserList, FlowTestUserPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the FlowInstance.
-
#executions(sid = :unset) ⇒ ExecutionList, ExecutionContext
Access the executions.
-
#fetch ⇒ FlowInstance
Fetch the FlowInstance.
-
#initialize(version, sid) ⇒ FlowContext
constructor
Initialize the FlowContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#revisions(revision = :unset) ⇒ FlowRevisionList, FlowRevisionContext
Access the revisions.
-
#test_users ⇒ FlowTestUserList, FlowTestUserContext
Access the test_users.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance
Update the FlowInstance.
Constructor Details
#initialize(version, sid) ⇒ FlowContext
Initialize the FlowContext
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 170 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Flows/#{@solution[:sid]}" # Dependents @executions = nil @test_users = nil @revisions = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the FlowInstance
185 186 187 188 189 190 191 192 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 185 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#executions(sid = :unset) ⇒ ExecutionList, ExecutionContext
Access the executions
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 252 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
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 197 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 |
#inspect ⇒ Object
Provide a detailed, user friendly representation
306 307 308 309 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 306 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.FlowContext #{context}>" end |
#revisions(revision = :unset) ⇒ FlowRevisionList, FlowRevisionContext
Access the revisions
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 281 def revisions(revision=:unset) raise ArgumentError, 'revision cannot be nil' if revision.nil? if revision != :unset return FlowRevisionContext.new(@version, @solution[:sid],revision ) end unless @revisions @revisions = FlowRevisionList.new( @version, sid: @solution[:sid], ) end @revisions end |
#test_users ⇒ FlowTestUserList, FlowTestUserContext
Access the test_users
271 272 273 274 275 276 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 271 def test_users FlowTestUserContext.new( @version, @solution[:sid] ) end |
#to_s ⇒ Object
Provide a user friendly representation
299 300 301 302 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 299 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.FlowContext #{context}>" end |
#update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance
Update the FlowInstance
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 220 def update( status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset ) data = Twilio::Values.of({ 'Status' => status, 'FriendlyName' => friendly_name, 'Definition' => Twilio.serialize_object(definition), 'CommitMessage' => , }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) FlowInstance.new( @version, payload, sid: @solution[:sid], ) end |