Class: Qmetrics::Caller
- Inherits:
-
Object
- Object
- Qmetrics::Caller
- Defined in:
- lib/qmetrics/caller.rb
Class Attribute Summary collapse
-
.api_methods ⇒ Object
readonly
Returns the value of attribute api_methods.
Class Method Summary collapse
Instance Method Summary collapse
- #api_methods ⇒ Object
- #get(*args) ⇒ Object
-
#initialize(queues:, api:) ⇒ Caller
constructor
A new instance of Caller.
-
#to_s ⇒ Object
url encoded ‘|’ to ‘%7C’.
Constructor Details
#initialize(queues:, api:) ⇒ Caller
Returns a new instance of Caller.
8 9 10 11 12 |
# File 'lib/qmetrics/caller.rb', line 8 def initialize(queues: , api: ) @queues = queues @api = api clear_blocks end |
Class Attribute Details
.api_methods ⇒ Object (readonly)
Returns the value of attribute api_methods.
5 6 7 |
# File 'lib/qmetrics/caller.rb', line 5 def api_methods @api_methods end |
Class Method Details
.load_api_methods(file) ⇒ Object
27 28 29 |
# File 'lib/qmetrics/caller.rb', line 27 def self.load_api_methods(file) @api_methods ||= load_yml(file) end |
Instance Method Details
#api_methods ⇒ Object
31 32 33 |
# File 'lib/qmetrics/caller.rb', line 31 def api_methods self.class.api_methods end |
#get(*args) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/qmetrics/caller.rb', line 14 def get(*args) clear_blocks args.each do |k| @blocks.push(api_methods[k.to_sym]) if call_exists?(k.to_sym) end execute end |
#to_s ⇒ Object
url encoded ‘|’ to ‘%7C’
23 24 25 |
# File 'lib/qmetrics/caller.rb', line 23 def to_s "/jsonStatsApi.do?queues=#{@queues.join('%7C')}" end |