Class: BillTrap::Adapters::Ooffice
- Inherits:
-
Object
- Object
- BillTrap::Adapters::Ooffice
- Includes:
- Helpers, Serenity::Generator
- Defined in:
- lib/billtrap/adapters/ooffice.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(attributes) ⇒ Ooffice
constructor
A new instance of Ooffice.
Methods included from Helpers
#format_date, #format_money, #is_i?
Methods included from Serenity::Generator
Constructor Details
#initialize(attributes) ⇒ Ooffice
Returns a new instance of Ooffice.
9 10 11 12 13 14 |
# 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 |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/billtrap/adapters/ooffice.rb', line 7 def id @id end |
Instance Method Details
#generate ⇒ Object
16 17 18 19 20 21 22 23 |
# 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 |