class BillTrap::Adapters::Ooffice

Attributes

id[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/billtrap/adapters/ooffice.rb, line 9
def initialize attributes
  attributes.each do |key, val|
    # slurp attributes into instances variables
    instance_variable_set("@#{key}", val)
  end
end

Public Instance Methods

generate() click to toggle source
# File lib/billtrap/adapters/ooffice.rb, line 16
  def generate
    date = @invoice[:created]
    output_path = "#{Config['billtrap_archive']}/#{date.year}/#{date.month}/#{date.mday}"
    FileUtils.mkpath(output_path)

    render_odt Config['serenity_template'], "#{output_path}/#{@invoice.id}.odt"
    puts "Generated invoice has been output to: #{output_path}/#{@invoice.id}.odt"
end