Class: AllQ::Get
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(tube) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/allq/actions/get.rb', line 22
def base_send(tube)
{
'action' => 'get',
'params' => {
'tube' => tube
}
}
end
|
#rcv(data) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/allq/actions/get.rb', line 10
def rcv(data)
return nil if data.to_s == '' || data.to_s.strip == '{}'
result = JSON.parse(data)
if result['job']
return nil if result['job'].empty?
job = Job.new_from_hash(result['job'], @client)
return job
end
nil
end
|
#snd(data) ⇒ Object
4
5
6
7
8
|
# File 'lib/allq/actions/get.rb', line 4
def snd(data)
send_data = base_send(data)
response = send_hash_as_json(send_data, true)
rcv(response)
end
|