Module: Invoicing::LedgerItem::RenderUBL
- Defined in:
- lib/invoicing/ledger_item/render_ubl.rb
Overview
Included into ActiveRecord model object when acts_as_ledger_item
is invoked.
Defined Under Namespace
Classes: UBLOutputBuilder
Instance Method Summary collapse
-
#render_ubl(options = {}) ⇒ Object
Renders this invoice or credit note into a complete XML document conforming to the OASIS Universal Business Language (UBL) open standard for interchange of business documents (specification).
Instance Method Details
#render_ubl(options = {}) ⇒ Object
Renders this invoice or credit note into a complete XML document conforming to the OASIS Universal Business Language (UBL) open standard for interchange of business documents (specification). This format, albeit a bit verbose, is increasingly being adopted as an international standard. It can represent some very complicated multi-currency, multi-party business relationships, but is still quite usable for simple cases.
It is recommended that you present machine-readable UBL data in your application in the same way as you present human-readable invoices in HTML. For example, in a Rails controller, you could use:
class AccountsController < ApplicationController
def show
@ledger_item = LedgerItem.find(params[:id])
# ... check whether current user has access to this document ...
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ledger_item.render_ubl }
end
end
end
29 30 31 |
# File 'lib/invoicing/ledger_item/render_ubl.rb', line 29 def render_ubl(={}) UBLOutputBuilder.new(self, ).build end |