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
163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 163 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
178 179 180 181 182 183 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 178 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
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 235 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
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 188 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
289 290 291 292 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 289 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.FlowContext #{context}>" end |
#revisions(revision = :unset) ⇒ FlowRevisionList, FlowRevisionContext
Access the revisions
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 264 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
254 255 256 257 258 259 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 254 def test_users FlowTestUserContext.new( @version, @solution[:sid] ) end |
#to_s ⇒ Object
Provide a user friendly representation
282 283 284 285 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 282 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
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 207 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 |