Module: JokerDMAPI::Result

Included in:
Client
Defined in:
lib/joker-dmapi/result.rb

Instance Method Summary collapse

Instance Method Details

#complete?(proc_id) ⇒ Boolean

Check result

Get proc_id Returned true if done (result deleted)

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/joker-dmapi/result.rb', line 7

def complete?(proc_id)
  response = result_retrieve(proc_id)
  result = parse_attributes(response[:body].split("\n\n", 1)[0])
  return false unless result.has_key? :completion_status
  case result[:completion_status]
    when 'ack' then
      result_delete proc_id
      true
    when 'nack' then
      raise_response response
    else
      false
  end
end

#result_delete(proc_id) ⇒ Object



26
27
28
# File 'lib/joker-dmapi/result.rb', line 26

def result_delete(proc_id)
  query :result_delete, { proc_id: proc_id }
end

#result_retrieve(proc_id) ⇒ Object



22
23
24
# File 'lib/joker-dmapi/result.rb', line 22

def result_retrieve(proc_id)
  query :result_retrieve, { proc_id: proc_id }
end