Class: Appfigures::Archive
- Inherits:
-
Object
- Object
- Appfigures::Archive
- Includes:
- HTTParty
- Defined in:
- lib/appfigures/archive.rb
Constant Summary collapse
- TYPE =
{ :DAILY => "daily", :WEEKLY => "weekly", :FINANCIAL => "financial", :PAYMENT => "payment", :ALL => "all" }
Instance Method Summary collapse
- #archives(type = "all") ⇒ Object
- #by_date(date, type = "all") ⇒ Object
-
#initialize(username, password) ⇒ Archive
constructor
A new instance of Archive.
- #latest(type = "all") ⇒ Object
-
#raw(id) ⇒ Object
get the raw report by report id requires admin.
Constructor Details
#initialize(username, password) ⇒ Archive
Returns a new instance of Archive.
16 17 18 |
# File 'lib/appfigures/archive.rb', line 16 def initialize(username, password) @auth = {:username => username, :password => password} end |
Instance Method Details
#archives(type = "all") ⇒ Object
20 21 22 23 |
# File 'lib/appfigures/archive.rb', line 20 def archives(type="all") raise ArgumentError, "Type must be one of TYPE: #{TYPE.values.join(", ")}" unless TYPE.values.index(type) self.class.get("/archive", {:basic_auth => @auth, :type => type}) end |
#by_date(date, type = "all") ⇒ Object
29 30 31 |
# File 'lib/appfigures/archive.rb', line 29 def by_date(date, type="all") self.class.get("/archive/#{date}", {:basic_auth => @auth, :type => type}) end |
#latest(type = "all") ⇒ Object
25 26 27 |
# File 'lib/appfigures/archive.rb', line 25 def latest(type="all") self.class.get("/archive/latest", {:basic_auth => @auth, :type => type}) end |
#raw(id) ⇒ Object
get the raw report by report id requires admin
35 36 37 |
# File 'lib/appfigures/archive.rb', line 35 def raw(id) self.class.get("/archive/raw/#{id}", {:basic_auth => @auth}) end |