Class: AllQ::Put
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#build_job, #initialize, #rcv, #send_hash_as_json, #setup
Constructor Details
This class inherits a constructor from AllQ::Base
Instance Method Details
#base_send(tube, body, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/allq/actions/put.rb', line 15 def base_send(tube, body, = {}) raise 'Must have tube name and body' unless tube && body base = { 'action' => 'put', 'params' => { 'tube' => tube, 'body' => body } } base['params']['ttl'] = ['ttl'] if ['ttl'] base['params']['delay'] = ['delay'] if ['delay'] base['params']['parent_id'] = ['parent_id'] if ['parent_id'] base['params']['priority'] = ['priority'] if ['priority'] return base end |
#snd(data) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/allq/actions/put.rb', line 4 def snd(data) result = nil tube = data.delete('tube') body = data.delete('body') send_data = base_send(tube, body, data) response = send_hash_as_json(send_data) result = rcv(response) build_job(result) end |