Class: Vfwcash::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/vfwcash/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date = nil) ⇒ Api

Returns a new instance of Api.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/vfwcash/api.rb', line 5

def initialize(date=nil)
  @date = Vfwcash.set_date(date)
  @config = Vfwcash.config
  require_relative './sqlite_base'
  Dir.glob(File.join(LibPath,'models/*')).each do |file|
    require file
  end
  @cash = Gcash.new(@config)
  unless @cash.dates.include?(@date)
    puts "No transactions exist for #{@date.beginning_of_month}"
  end
end

Instance Attribute Details

#cashObject

Returns the value of attribute cash.



4
5
6
# File 'lib/vfwcash/api.rb', line 4

def cash
  @cash
end

#configObject

Returns the value of attribute config.



4
5
6
# File 'lib/vfwcash/api.rb', line 4

def config
  @config
end

Instance Method Details

#auditObject



42
43
44
# File 'lib/vfwcash/api.rb', line 42

def audit
  pdf = Audit.new(@date,@cash)
end

#balanceObject



46
47
48
# File 'lib/vfwcash/api.rb', line 46

def balance
  pdf = Balance.new(@date,@cash)
end

#between(from, to) ⇒ Object



18
19
20
# File 'lib/vfwcash/api.rb', line 18

def between(from,to)
  pdf = Between.new(@date,@cash,from,to)
end

#ledgerObject



26
27
28
# File 'lib/vfwcash/api.rb', line 26

def ledger
  pdf = Ledger.new(@date,@cash)
end

#profit_loss(report) ⇒ Object



22
23
24
# File 'lib/vfwcash/api.rb', line 22

def profit_loss(report)
  pdf = ProfitLoss.new(report)
end

#register_pdfObject



34
35
36
# File 'lib/vfwcash/api.rb', line 34

def register_pdf
  pdf = RegisterPdf.new(@date,@cash)
end

#splitObject



38
39
40
# File 'lib/vfwcash/api.rb', line 38

def split
  pdf = SplitLedger.new(@date,@cash)
end

#summaryObject



30
31
32
# File 'lib/vfwcash/api.rb', line 30

def summary
  pdf = Summary.new(@cash)
end