Class: LEWT::SimpleInvoices

Inherits:
Extension show all
Defined in:
lib/extensions/simple-invoices.rb

Instance Attribute Summary collapse

Attributes inherited from Extension

#command_name, #customers, #enterprise, #lewt_settings, #lewt_stash, #options

Instance Method Summary collapse

Methods inherited from Extension

#get_matched_customers, #lewt_extensions

Constructor Details

#initializeSimpleInvoices

Sets up this extensions command



18
19
20
# File 'lib/extensions/simple-invoices.rb', line 18

def initialize
  super({:cmd => "invoice"})
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



15
16
17
# File 'lib/extensions/simple-invoices.rb', line 15

def data
  @data
end

Instance Method Details

#process(options, data) ⇒ Object

Processes the provided extract data into an invoice for the given targets.

options [Hash]

An hash containing run-time options passed to this extension by LEWT.

data [LEWTBook]

A hash-like object containing all the extracted data in the LEWTLedger format.

returns [Array]: The invoice data as an array of hashes.



26
27
28
29
30
31
32
33
# File 'lib/extensions/simple-invoices.rb', line 26

def process ( options, data )
  matchData = get_matched_customers( options[:target] )
  bills = Array.new
  matchData.each do |client|
    bills.push( generateBill( client, data) )
  end
  return bills
end