Class: Shushu::Report

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

Direct Known Subclasses

Invoice, RateCodeReport, UsageReport

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#billable_unitsObject

Returns the value of attribute billable_units.



3
4
5
# File 'lib/models/report.rb', line 3

def billable_units
  @billable_units
end

#fromObject

Returns the value of attribute from.



3
4
5
# File 'lib/models/report.rb', line 3

def from
  @from
end

#toObject

Returns the value of attribute to.



3
4
5
# File 'lib/models/report.rb', line 3

def to
  @to
end

Instance Method Details

#fetchObject



9
10
11
12
13
14
15
16
17
# File 'lib/models/report.rb', line 9

def fetch
  url = [Shushu.url, resource].join
  Shushu.handle_req do
    RestClient.get(url, {:params => {
      :from => from.utc.to_s,
      :to => to.utc.to_s
    }})
  end
end

#reportObject



27
28
29
# File 'lib/models/report.rb', line 27

def report
  @report ||= fetch
end

#totalObject



23
24
25
# File 'lib/models/report.rb', line 23

def total
  report["total"]
end