class Zenaton::Query::Builder
Wrapper class around the client to interact with workflows by id
Public Class Methods
new(klass)
click to toggle source
# File lib/zenaton/query/builder.rb, line 12 def initialize(klass) check_klass(klass) @klass = klass @client = Client.instance end
Public Instance Methods
find()
click to toggle source
Finds a workflow @return [Zenaton::Interfaces::Workflow]
# File lib/zenaton/query/builder.rb, line 28 def find @client.find_workflow(@klass.to_s, @id) end
kill()
click to toggle source
Stops a workflow @return [Zenaton::Query::Builder] the current builder
# File lib/zenaton/query/builder.rb, line 42 def kill @client.kill_workflow(@klass.to_s, @id) self end
pause()
click to toggle source
Pauses a workflow @return [Zenaton::Query::Builder] the current builder
# File lib/zenaton/query/builder.rb, line 49 def pause @client.pause_workflow(@klass.to_s, @id) self end
resume()
click to toggle source
Resumes a workflow @return [Zenaton::Query::Builder] the current builder
# File lib/zenaton/query/builder.rb, line 56 def resume @client.resume_workflow(@klass.to_s, @id) self end
send_event(event)
click to toggle source
Sends an event to a workflow @param event [Zenaton::Interfaces::Event] the event to send @return [Zenaton::Query::Builder] the current builder
# File lib/zenaton/query/builder.rb, line 35 def send_event(event) @client.send_event(@klass.to_s, @id, event) self end
where_id(id)
click to toggle source
Sets the id of the workflow we want to find @param id [String, NilClass] the id @return [Zenaton::Query::Builder] the current builder
# File lib/zenaton/query/builder.rb, line 21 def where_id(id) @id = id self end
Private Instance Methods
check_klass(klass)
click to toggle source
# File lib/zenaton/query/builder.rb, line 63 def check_klass(klass) msg = "#{klass} should be a subclass of Zenaton::Interfaces::Workflow" raise ExternalError, msg unless klass < Interfaces::Workflow end