Class: Zenaton::Query::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/zenaton/query/builder.rb

Overview

Wrapper class around the client to interact with workflows by id

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Builder

Returns a new instance of Builder.



12
13
14
15
16
# File 'lib/zenaton/query/builder.rb', line 12

def initialize(klass)
  check_klass(klass)
  @klass = klass
  @client = Client.instance
end

Instance Method Details

#findZenaton::Interfaces::Workflow

Finds a workflow



28
29
30
# File 'lib/zenaton/query/builder.rb', line 28

def find
  @client.find_workflow(@klass.to_s, @id)
end

#killZenaton::Query::Builder

Stops a workflow

Returns:



42
43
44
45
# File 'lib/zenaton/query/builder.rb', line 42

def kill
  @client.kill_workflow(@klass.to_s, @id)
  self
end

#pauseZenaton::Query::Builder

Pauses a workflow

Returns:



49
50
51
52
# File 'lib/zenaton/query/builder.rb', line 49

def pause
  @client.pause_workflow(@klass.to_s, @id)
  self
end

#resumeZenaton::Query::Builder

Resumes a workflow

Returns:



56
57
58
59
# File 'lib/zenaton/query/builder.rb', line 56

def resume
  @client.resume_workflow(@klass.to_s, @id)
  self
end

#send_event(event) ⇒ Zenaton::Query::Builder

Sends an event to a workflow

Parameters:

Returns:



35
36
37
38
# 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) ⇒ Zenaton::Query::Builder

Sets the id of the workflow we want to find

Parameters:

  • id (String, NilClass)

    the id

Returns:



21
22
23
24
# File 'lib/zenaton/query/builder.rb', line 21

def where_id(id)
  @id = id
  self
end