Class: Eotb::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/eotb/report.rb

Class Method Summary collapse

Class Method Details

.find(query) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/eotb/report.rb', line 4

def self.find(query)
  configure 'find'
  hash = {}
  query.each_pair { |k, v|
    hash.merge!(hash_format(v, k)) 
  }
  @@post.set_form_data(hash)
  array = JSON.parse send
  array.map { |a| OpenStruct.new(a) }.sort {|x ,y| y.created_on <=> x.created_on}
end

.latestObject



15
16
17
18
19
# File 'lib/eotb/report.rb', line 15

def self.latest
  configure 'latest'
  array = JSON.parse(send)
  array.map { |a| OpenStruct.new(a) }
end

.latest_dailyObject



21
22
23
24
25
# File 'lib/eotb/report.rb', line 21

def self.latest_daily
  configure 'latest_daily'
  array = JSON.parse(send)
  array.map { |a| OpenStruct.new(a) }
end

.latest_weeklyObject



27
28
29
30
31
# File 'lib/eotb/report.rb', line 27

def self.latest_weekly
  configure 'latest_weekly'
  array = JSON.parse(send)
  array.map { |a| OpenStruct.new(a) }
end