ubl 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d85586554b03950c5f00fc767da60c5cc179650d76c9afab96f40752dc83269b
4
- data.tar.gz: b767d4c66653121049e27d3208e6d518efe8093b240f8b05b852f82ce98b0605
3
+ metadata.gz: 1f37938a0758a7354e8fa16557aeadbb9733e8c249a649b17eb9095f2ba5fd97
4
+ data.tar.gz: 58b6ae9d4e7ed3701e01bfb05a0fe2b958d2f5adbd8f006912fe95a1ce8f9924
5
5
  SHA512:
6
- metadata.gz: 84c1e2c7e3335681e7aef44f3404cbe2d520d9003882a2991ed47c5e8ef21c4ab18d7db484048b626e97d51761f81b329fe10e2d0a93daff5ef3eb327cf96dcd
7
- data.tar.gz: 73332157c0330f6d1c7c1ba28e76e4bfc164d51c6fccba007ac36d37f927241897906725b9d7624632eeb2a9bd0a9209e3254c7f1213fdd6057b4e17002fe3af
6
+ metadata.gz: defb4760407b2645e202042072a7e5ef70a931d9226405d6e455594a58b9d737a3f05ad5f8c36447be774a7c2afdfde9e95ea601ac2d1b5b2858637c2c1a2f1a
7
+ data.tar.gz: ba81dad3036adf7487e85c369338b606c9e19c304483eafae29d04203353b686be70b85ca01260f65623c45b2dd593b469af1388394c19befaf22357569c5e0b
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/ubl.svg)](https://badge.fury.io/rb/ubl)
2
+
1
3
  # Ubl
2
4
 
3
5
  Generate UBL invoices and credit notes for Peppol
@@ -16,9 +18,42 @@ if bundler is not being used to manage dependencies, install the gem by executin
16
18
  gem install ubl
17
19
  ```
18
20
 
19
- ## usage
21
+ ## Example
22
+
23
+ ```
24
+ require "ubl"
25
+
26
+ invoice = Ubl::Invoice.new
27
+ invoice.invoice_nr = "INV-2025-001"
28
+ invoice.issue_date = Date.new(2025, 6, 28)
29
+ invoice.due_date = Date.new(2025, 7, 28)
30
+ invoice.currency = "EUR"
31
+ invoice.pdffile = __dir__ + "/invoice_test.pdf"
32
+
33
+ invoice.add_supplier(
34
+ name: "ACME Corp",
35
+ country: "BE",
36
+ vat_id: "BE0123456749",
37
+ address: "Main Street 123",
38
+ city: "Brussels",
39
+ postal_code: "1000"
40
+ )
41
+
42
+ invoice.add_customer(
43
+ name: "Customer Ltd",
44
+ country: "BE",
45
+ vat_id: "BE0123456749",
46
+ address: "Customer Lane 456",
47
+ city: "Antwerpen",
48
+ postal_code: "1012"
49
+ )
50
+
51
+ invoice.add_line(name: "Consulting Services", quantity: 10, unit_price: 100.0, tax_rate: 21.0)
52
+ invoice.add_line(name: "Software License", quantity: 1, unit_price: 500.0, tax_rate: 21.0)
53
+
54
+ invoice.build
55
+ ```
20
56
 
21
- todo: write usage instructions here
22
57
 
23
58
  ## development
24
59
 
data/lib/ubl/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ubl
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
@@ -1,8 +1,34 @@
1
1
  require_relative "ubl/builder"
2
2
 
3
3
  module Ubl
4
+ class Invoice < UblBuilder
5
+ def initialize(ubl_be = false)
6
+ super
7
+ end
8
+
9
+ def build
10
+ builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
11
+ xml.Invoice(namespaces) do
12
+ build_header(xml) do |xml|
13
+ xml["cbc"].InvoiceTypeCode "380"
14
+ end
15
+
16
+ build_document_reference(xml, "CommercialInvoice")
17
+
18
+ build_party(xml, @supplier, "AccountingSupplierParty")
19
+ build_party(xml, @customer, "AccountingCustomerParty")
20
+
21
+ build_tax_total(xml)
22
+ build_monetary_total(xml)
23
+ build_invoice_lines(xml)
24
+ end
25
+ end
26
+ builder.to_xml
27
+ end
28
+ end
29
+
4
30
  class CreditNote < UblBuilder
5
- def initialize(ubl_be)
31
+ def initialize(ubl_be = false)
6
32
  super
7
33
  end
8
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - roel4d
@@ -48,8 +48,7 @@ files:
48
48
  - LICENSE.txt
49
49
  - README.md
50
50
  - Rakefile
51
- - lib/credit_note.rb
52
- - lib/invoice.rb
51
+ - lib/ubl.rb
53
52
  - lib/ubl/builder.rb
54
53
  - lib/ubl/version.rb
55
54
  - sig/ubl.rbs
data/lib/invoice.rb DELETED
@@ -1,29 +0,0 @@
1
- require_relative "ubl/builder"
2
-
3
- module Ubl
4
- class Invoice < UblBuilder
5
- def initialize(ubl_be)
6
- super
7
- end
8
-
9
- def build
10
- builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
11
- xml.Invoice(namespaces) do
12
- build_header(xml) do |xml|
13
- xml["cbc"].InvoiceTypeCode "380"
14
- end
15
-
16
- build_document_reference(xml, "CommercialInvoice")
17
-
18
- build_party(xml, @supplier, "AccountingSupplierParty")
19
- build_party(xml, @customer, "AccountingCustomerParty")
20
-
21
- build_tax_total(xml)
22
- build_monetary_total(xml)
23
- build_invoice_lines(xml)
24
- end
25
- end
26
- builder.to_xml
27
- end
28
- end
29
- end