Class: DashingContrib::Kue::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dashing-contrib/bottles/kue/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Creates a new Kue Client Arguments:

endpoint

endpoint of Kue web interface



12
13
14
# File 'lib/dashing-contrib/bottles/kue/client.rb', line 12

def initialize(options = {})
  @endpoint = options[:endpoint]
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



6
7
8
# File 'lib/dashing-contrib/bottles/kue/client.rb', line 6

def endpoint
  @endpoint
end

Instance Method Details

#statsObject

Returns a stats summary of Kue status in following format

Tries to transform from camalCase JSON key to ruby friendly symbal underscore format

{
  :inactive_count: 235,
  :complete_count: 29426,
  :active_count: 4,
  :failed_count: 11,
  :delayed_count: 0,
  :work_time: 778205330
}


30
31
32
33
34
35
36
# File 'lib/dashing-contrib/bottles/kue/client.rb', line 30

def stats
  payload = {}
  get_request('stats').each do |key, value|
    payload[:"#{key.underscore}"] = value
  end
  payload
end