Class: SEFAZ::Webservice::SAT::Templates::Base
- Inherits:
-
Object
- Object
- SEFAZ::Webservice::SAT::Templates::Base
- Includes:
- Utils::PrawnHelper
- Defined in:
- lib/sefaz/webservice/sat/templates/base.rb
Overview
Classe base dos templates para CFe-SAT
Direct Known Subclasses
Instance Method Summary collapse
- #build(doc, aut, canc, summary, infAdic) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #render(aut, canc, summary, infAdic) ⇒ Object
Methods included from Utils::PrawnHelper
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
12 13 14 15 16 17 |
# File 'lib/sefaz/webservice/sat/templates/base.rb', line 12 def initialize @page_width = 0 @margin = 0 @page_break = 80.m @page_layout = :portrait end |
Instance Method Details
#build(doc, aut, canc, summary, infAdic) ⇒ Object
19 20 21 |
# File 'lib/sefaz/webservice/sat/templates/base.rb', line 19 def build(doc, aut, canc, summary, infAdic) raise SEFAZ::NotImplemented, "Você deve implementar o método 'build' em uma subclasse." end |
#render(aut, canc, summary, infAdic) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/sefaz/webservice/sat/templates/base.rb', line 23 def render(aut, canc, summary, infAdic) validation(aut, canc) Prawn::Document.new(page_size: [@page_width, @page_break], margin: @margin, page_layout: @page_layout) do |doc| build(doc, aut, canc, summary, infAdic) doc.page.dictionary.data[:MediaBox] = [0, (doc.y - @margin), @page_width, @page_break] end.render end |