Module: UnovaFacturX
- Defined in:
- lib/unova_factur_x.rb,
lib/unova_factur_x/version.rb,
lib/unova_factur_x/xml_generator.rb,
lib/unova_factur_x/factur_x_generator.rb,
sig/unova_factur_x.rbs
Defined Under Namespace
Classes: Error, FacturXGenerator, XmlGenerator
Constant Summary collapse
- VERSION =
"0.1.6"
Class Method Summary collapse
-
.generate(pdf:, document_hash:, type: :invoice, with_validations: true, currency: "EUR", validator_profile: :br_fr) ⇒ Object
See the writing guide of rbs: https://github.com/ruby/rbs#guides.
Class Method Details
.generate(pdf:, document_hash:, type: :invoice, with_validations: true, currency: "EUR", validator_profile: :br_fr) ⇒ Object
See the writing guide of rbs: https://github.com/ruby/rbs#guides
4 5 6 7 8 9 10 11 12 13 14 |
# File 'sig/unova_factur_x.rbs', line 4 def self.generate(pdf:, document_hash:, type: :invoice, with_validations: true, currency: "EUR", validator_profile: :br_fr) unless %i[invoice credit].include?(type) raise ArgumentError, "Type must be :invoice or :credit (default is :invoice)" end # Génération du XML à partir du hash en entré xml = UnovaFacturX::XmlGenerator.new(document_hash, type: type, validate: with_validations, currency: currency, validator_profile: validator_profile).call # Génération et retour du PDF FacturX à partir du PDF en entré et du XML généré UnovaFacturX::FacturXGenerator.new(pdf: pdf, xml: xml).call end |