Module: Hinoki::Aggregates

Defined in:
lib/hinoki/aggregates.rb

Class Method Summary collapse

Class Method Details

.all(limit = nil, offset = nil) ⇒ Object

Return a list of all aggregates



9
10
11
12
13
14
15
# File 'lib/hinoki/aggregates.rb', line 9

def self.all(limit=nil, offset=nil)
  url = "/aggregates"
  if limit  then url.append("?limit=#{limit}") end
  if offset then url.append("&offset=#{offset}") end

  return Hinoki.conn.get(url)
end

.by_name(name, age = nil) ⇒ Object

Return a specific aggregate check



18
19
20
21
22
23
# File 'lib/hinoki/aggregates.rb', line 18

def self.by_name(name, age=nil)
  url = "/aggregates/#{name}"
  if age then url.append("?age=#{age}") end

  return Hinoki.conn.get(url)
end

.delete(name) ⇒ Object

Delete an aggregate check



26
27
28
# File 'lib/hinoki/aggregates.rb', line 26

def self.delete(name)
  return Hinoki.conn.delete("/aggregates/#{name}")
end

.summarize(name, summarize = nil, results = false) ⇒ Object

Returns the list of aggregates



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/hinoki/aggregates.rb', line 31

def self.summarize(name, summarize=nil, results=false)
  url = "/aggregates"
  if summarize && results
    url.append("?summarize=#{summarize}&results=#{results}")
  elsif summarize 
    url.append("?summarize=#{summarize}")
  elsif results 
    url.append("?results=#{results}") 
  end

  return Hinoki.conn.get(url)
end