ubl 0.0.1 → 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: 1778b4c23b585bf9a2bb5b783aee65d9104d1f9ade0ba7a20fdab7c18aced7de
4
- data.tar.gz: 7d6c635cc5a0e6fe6e64c9f103705611d6edf9bc7cbebb04222c0c7c37176f02
3
+ metadata.gz: 1f37938a0758a7354e8fa16557aeadbb9733e8c249a649b17eb9095f2ba5fd97
4
+ data.tar.gz: 58b6ae9d4e7ed3701e01bfb05a0fe2b958d2f5adbd8f006912fe95a1ce8f9924
5
5
  SHA512:
6
- metadata.gz: f6a1306eddf09c6a7003f10c394e8702b95e28af953c4a826ae33dbaac0a33492d07033881898e5b1d9f59577db158802bf466b494c9e4e5bd5bbd82a8ac4ae6
7
- data.tar.gz: 5b5dcb7717fbacc50e2e1101c786a1d270c1358af163c4ebb694336c0ca3cf05496c49134bbdc88b975f91f738f476477715e0ca792f867955f222f603d7e251
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.1"
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.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - roel4d
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '1.18'
26
+ - !ruby/object:Gem::Dependency
27
+ name: base64
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.3.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.3.0
26
40
  description: Generate UBL documents for Peppol
27
41
  email:
28
42
  - roel4d@webding.org
@@ -34,8 +48,7 @@ files:
34
48
  - LICENSE.txt
35
49
  - README.md
36
50
  - Rakefile
37
- - lib/credit_note.rb
38
- - lib/invoice.rb
51
+ - lib/ubl.rb
39
52
  - lib/ubl/builder.rb
40
53
  - lib/ubl/version.rb
41
54
  - sig/ubl.rbs
@@ -44,7 +57,7 @@ licenses:
44
57
  - MIT
45
58
  metadata:
46
59
  homepage_uri: https://github.com/roel4d/ubl
47
- source_code_uri: https://github.com/roel4d/invoice
60
+ source_code_uri: https://github.com/roel4d/ubl
48
61
  rdoc_options: []
49
62
  require_paths:
50
63
  - lib
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