Class: AllQ::Release
- Inherits:
-
Base
- Object
- Base
- AllQ::Release
show all
- Defined in:
- lib/allq/actions/release.rb
Constant Summary
Constants inherited
from Base
Base::ALLQ_DEBUG_DATA
Instance Attribute Summary
Attributes inherited from Base
#client, #connection
Instance Method Summary
collapse
Methods inherited from Base
#build_job, #initialize, #send_hash_as_json, #setup
Constructor Details
This class inherits a constructor from AllQ::Base
Instance Method Details
#base_send(job_id, delay) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/allq/actions/release.rb', line 18
def base_send(job_id, delay)
{
'action' => 'release',
'params' => {
'job_id' => job_id,
'delay' => delay
}
}
end
|
#rcv(data) ⇒ Object
13
14
15
16
|
# File 'lib/allq/actions/release.rb', line 13
def rcv(data)
return nil if data.to_s == '' || data.to_s.strip == '{}'
JSON.parse(data)
end
|
#snd(data) ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/allq/actions/release.rb', line 4
def snd(data)
job_id = data[:job_id]
delay = data[:delay] || 0
send_data = base_send(job_id, delay)
response = send_hash_as_json(send_data, true)
result = rcv(response)
return result["release"] && result["release"]["job_id"]
end
|