Class: AllQ::Throttle

Inherits:
Base
  • Object
show all
Defined in:
lib/allq/actions/throttle.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, #rcv, #send_hash_as_json, #setup

Constructor Details

This class inherits a constructor from AllQ::Base

Instance Method Details

#base_send(name, tps) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/allq/actions/throttle.rb', line 13

def base_send(name, tps)
  {
      'action' => 'throttle',
      'params' => {
        'tube' => name,
        'tps' => tps
      }
    }
    
end

#snd(data) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/allq/actions/throttle.rb', line 4

def snd(data)
  name = data[:name]
  tps = data[:tps].to_i || 10

  send_data = base_send(name, tps)
  response = send_hash_as_json(send_data, true)
  rcv(response)
end