xrechnung 0.6.2 → 0.6.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: db52e7f4c95fb74e8fa1e67ef58f2a6ea15aee0c71c7250af87fb52abbda904c
4
- data.tar.gz: bece63455e79eea2e337e121b53b1869d0df5d1119984499c28e3cd83e2c7d46
3
+ metadata.gz: 06252face0554e39218ad09f6de658da8ceefab529414974c3cbea5066c03f94
4
+ data.tar.gz: 37fdbaf09d8b6506f9c49bbb9951aba92fb0d640a11a235b2c4838ca9c6f7ec8
5
5
  SHA512:
6
- metadata.gz: 0176ca573a94674208cc55ab85646cdb2cd7095ec7f99ba34f0e3617dda7c1d4aa4940180f8de0c37d5765bf9bbf885e481034ee31dc62f8d64169f2ef5b9fbc
7
- data.tar.gz: 6b61a8cb70408c747e1e48d0aff5fc9e5f3756ef0d90258083fe7df07081e83cd1933722c295e1d46cf8dfbfcff5083695302eb32f8dba41de61b8643c5e83fe
6
+ metadata.gz: c039758300cab1eb0bfabd785a3c4efc9eba14f0c94f6f72741c0fbb922e3bc0eeab612b3a9842f66244666f230d918a226fc41741eba86005347bff8c4b1c73
7
+ data.tar.gz: '038c45111d8b65bc6290b78048a30aae81ff04283784efd335c73a34eede869dd9aa5adb33a9a736763065bed4345054cb614e1e23b662510d34edeb9ee3ac24'
@@ -11,7 +11,7 @@ jobs:
11
11
  ruby: ['3.2', '3.3', '3.4']
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v4
14
+ - uses: actions/checkout@v6
15
15
 
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
@@ -7,12 +7,12 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
 
9
9
  steps:
10
- - uses: actions/checkout@v4
10
+ - uses: actions/checkout@v6
11
11
 
12
- - uses: actions/setup-java@v2
12
+ - uses: actions/setup-java@v5
13
13
  with:
14
14
  distribution: "adopt"
15
- java-version: "11" # LTS
15
+ java-version: "17"
16
16
 
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Run validator
26
26
  run: bundle exec rake validator:run
27
27
 
28
- - uses: actions/upload-artifact@v4
28
+ - uses: actions/upload-artifact@v6
29
29
  if: failure()
30
30
  with:
31
31
  name: validation-results
data/.rubocop ADDED
@@ -0,0 +1 @@
1
+ --safe
data/.rubocop.yml CHANGED
@@ -1,4 +1,6 @@
1
- # REQUIRES RUBOCOP 1.8.X
1
+ plugins:
2
+ - rubocop-rspec
3
+ - rubocop-rake
2
4
 
3
5
  AllCops:
4
6
  Exclude:
@@ -13,6 +15,7 @@ AllCops:
13
15
  DisplayCopNames: true
14
16
  StyleGuideCopsOnly: false
15
17
  TargetRubyVersion: 3.0
18
+ NewCops: enable
16
19
 
17
20
  ## Layout Cops - https://docs.rubocop.org/rubocop/cops_layout.html
18
21
 
@@ -344,9 +347,6 @@ Style/TrailingCommaInArrayLiteral:
344
347
  Style/TrailingCommaInHashLiteral:
345
348
  EnforcedStyleForMultiline: comma
346
349
 
347
- require:
348
- - rubocop-rspec
349
-
350
350
  RSpec/AnyInstance:
351
351
  Enabled: false
352
352
 
data/Gemfile CHANGED
@@ -3,6 +3,9 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in xrechnung.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 13.0"
7
- gem "rspec", "~> 3.0"
8
- gem "rubocop-rspec", "~> 2.1"
6
+ gem "rake"
7
+ gem "rspec"
8
+ gem "rubocop-rspec"
9
+ gem "rubocop-rake"
10
+ gem "httparty"
11
+ gem "rubyzip"
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xrechnung (0.6.2)
4
+ xrechnung (0.6.3)
5
+ activesupport
5
6
  base64
6
7
  bigdecimal
7
8
  builder (~> 3.2)
@@ -9,80 +10,106 @@ PATH
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
- ast (2.4.2)
13
+ activesupport (8.1.2)
14
+ base64
15
+ bigdecimal
16
+ concurrent-ruby (~> 1.0, >= 1.3.1)
17
+ connection_pool (>= 2.2.5)
18
+ drb
19
+ i18n (>= 1.6, < 2)
20
+ json
21
+ logger (>= 1.4.2)
22
+ minitest (>= 5.1)
23
+ securerandom (>= 0.3)
24
+ tzinfo (~> 2.0, >= 2.0.5)
25
+ uri (>= 0.13.1)
26
+ ast (2.4.3)
13
27
  base64 (0.3.0)
14
- bigdecimal (3.2.2)
28
+ bigdecimal (4.0.1)
15
29
  builder (3.3.0)
16
- csv (3.3.0)
17
- diff-lcs (1.5.1)
18
- httparty (0.22.0)
30
+ concurrent-ruby (1.3.6)
31
+ connection_pool (3.0.2)
32
+ csv (3.3.5)
33
+ diff-lcs (1.6.2)
34
+ drb (2.2.3)
35
+ httparty (0.24.2)
19
36
  csv
20
37
  mini_mime (>= 1.0.0)
21
38
  multi_xml (>= 0.5.2)
22
- json (2.9.0)
23
- language_server-protocol (3.17.0.3)
39
+ i18n (1.14.8)
40
+ concurrent-ruby (~> 1.0)
41
+ json (2.18.0)
42
+ language_server-protocol (3.17.0.5)
43
+ lint_roller (1.1.0)
44
+ logger (1.7.0)
24
45
  mini_mime (1.1.5)
25
- multi_xml (0.6.0)
26
- parallel (1.26.3)
27
- parser (3.3.6.0)
46
+ minitest (6.0.1)
47
+ prism (~> 1.5)
48
+ multi_xml (0.8.1)
49
+ bigdecimal (>= 3.1, < 5)
50
+ parallel (1.27.0)
51
+ parser (3.3.10.1)
28
52
  ast (~> 2.4.1)
29
53
  racc
54
+ prism (1.9.0)
30
55
  racc (1.8.1)
31
56
  rainbow (3.1.1)
32
- rake (13.2.1)
33
- regexp_parser (2.9.3)
34
- rspec (3.13.0)
57
+ rake (13.3.1)
58
+ regexp_parser (2.11.3)
59
+ rspec (3.13.2)
35
60
  rspec-core (~> 3.13.0)
36
61
  rspec-expectations (~> 3.13.0)
37
62
  rspec-mocks (~> 3.13.0)
38
- rspec-core (3.13.2)
63
+ rspec-core (3.13.6)
39
64
  rspec-support (~> 3.13.0)
40
- rspec-expectations (3.13.3)
65
+ rspec-expectations (3.13.5)
41
66
  diff-lcs (>= 1.2.0, < 2.0)
42
67
  rspec-support (~> 3.13.0)
43
- rspec-mocks (3.13.2)
68
+ rspec-mocks (3.13.7)
44
69
  diff-lcs (>= 1.2.0, < 2.0)
45
70
  rspec-support (~> 3.13.0)
46
- rspec-support (3.13.2)
47
- rubocop (1.69.1)
71
+ rspec-support (3.13.7)
72
+ rubocop (1.84.0)
48
73
  json (~> 2.3)
49
- language_server-protocol (>= 3.17.0)
74
+ language_server-protocol (~> 3.17.0.2)
75
+ lint_roller (~> 1.1.0)
50
76
  parallel (~> 1.10)
51
77
  parser (>= 3.3.0.2)
52
78
  rainbow (>= 2.2.2, < 4.0)
53
79
  regexp_parser (>= 2.9.3, < 3.0)
54
- rubocop-ast (>= 1.36.2, < 2.0)
80
+ rubocop-ast (>= 1.49.0, < 2.0)
55
81
  ruby-progressbar (~> 1.7)
56
82
  unicode-display_width (>= 2.4.0, < 4.0)
57
- rubocop-ast (1.36.2)
58
- parser (>= 3.3.1.0)
59
- rubocop-capybara (2.21.0)
60
- rubocop (~> 1.41)
61
- rubocop-factory_bot (2.26.1)
62
- rubocop (~> 1.61)
63
- rubocop-rspec (2.31.0)
64
- rubocop (~> 1.40)
65
- rubocop-capybara (~> 2.17)
66
- rubocop-factory_bot (~> 2.22)
67
- rubocop-rspec_rails (~> 2.28)
68
- rubocop-rspec_rails (2.29.1)
69
- rubocop (~> 1.61)
83
+ rubocop-ast (1.49.0)
84
+ parser (>= 3.3.7.2)
85
+ prism (~> 1.7)
86
+ rubocop-rake (0.7.1)
87
+ lint_roller (~> 1.1)
88
+ rubocop (>= 1.72.1)
89
+ rubocop-rspec (3.9.0)
90
+ lint_roller (~> 1.1)
91
+ rubocop (~> 1.81)
70
92
  ruby-progressbar (1.13.0)
71
- rubyzip (2.3.2)
72
- unicode-display_width (3.1.2)
73
- unicode-emoji (~> 4.0, >= 4.0.4)
74
- unicode-emoji (4.0.4)
93
+ rubyzip (3.2.2)
94
+ securerandom (0.4.1)
95
+ tzinfo (2.0.6)
96
+ concurrent-ruby (~> 1.0)
97
+ unicode-display_width (3.2.0)
98
+ unicode-emoji (~> 4.1)
99
+ unicode-emoji (4.2.0)
100
+ uri (1.1.1)
75
101
 
76
102
  PLATFORMS
77
103
  ruby
78
104
 
79
105
  DEPENDENCIES
80
- httparty (~> 0.22)
81
- rake (~> 13.0)
82
- rspec (~> 3.0)
83
- rubocop-rspec (~> 2.1)
84
- rubyzip (~> 2.0)
106
+ httparty
107
+ rake
108
+ rspec
109
+ rubocop-rake
110
+ rubocop-rspec
111
+ rubyzip
85
112
  xrechnung!
86
113
 
87
114
  BUNDLED WITH
88
- 2.7.0
115
+ 4.0.5
data/Rakefile CHANGED
@@ -1,41 +1,40 @@
1
1
  require "pathname"
2
2
  require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
+ require "httparty"
5
+ require "zip"
4
6
 
7
+ Zip.on_exists_proc = true
5
8
  RSpec::Core::RakeTask.new(:spec)
6
9
 
7
10
  task default: :spec
8
11
 
12
+ VALIDATOR_SOURCES = {
13
+ tool: {
14
+ filename: "validator/validator-1.6.0-standalone.jar",
15
+ release_url: "https://github.com/itplr-kosit/validator/releases/download/v1.6.0/validator-1.6.0.zip",
16
+ },
17
+ scenarios: {
18
+ filename: "validator/scenarios.xml",
19
+ release_url: "https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2025-07-10/validator-configuration-xrechnung_3.0.2_2025-07-10.zip",
20
+ },
21
+ }.freeze
22
+
9
23
  namespace :validator do
10
- VALIDATOR_SOURCES = {
11
- tool: {
12
- filename: "validator/validationtool-1.5.0-standalone.jar",
13
- release_url: "https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip",
14
- },
15
- scenarios: {
16
- filename: "validator/scenarios.xml",
17
- release_url: "https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2025-07-10/validator-configuration-xrechnung_3.0.2_2025-07-10.zip",
18
- },
19
- }.freeze
20
-
21
- VALIDATOR_SOURCES.each do |_, v|
24
+ VALIDATOR_SOURCES.each_value do |v|
22
25
  base = Pathname.new(__dir__).join("validator")
23
26
  zipfile = base.join(File.basename(v[:release_url]))
24
27
 
25
28
  file zipfile do
26
- require "httparty"
27
-
28
29
  base.mkpath unless base.exist?
29
30
 
30
31
  res = HTTParty.get(v[:release_url], follow_redirects: true)
31
- File.open(zipfile, "wb") { |f| f.write res.body }
32
+ File.binwrite(zipfile, res.body)
32
33
  end
33
34
 
34
35
  file v[:filename] => zipfile do
35
- require "zip"
36
-
37
36
  Zip::File.foreach(zipfile) do |entry|
38
- entry.extract base.join(entry.name)
37
+ entry.extract destination_directory: base
39
38
  end
40
39
  end
41
40
  end
@@ -18,8 +18,8 @@ module Xrechnung
18
18
  def to_xml(xml)
19
19
  xml.cac :Contact do
20
20
  xml.cbc :Name, name
21
- xml.cbc :Telephone, telephone
22
- xml.cbc :ElectronicMail, electronic_mail
21
+ xml.cbc :Telephone, telephone if telephone.present?
22
+ xml.cbc :ElectronicMail, electronic_mail if electronic_mail.present?
23
23
  end
24
24
  end
25
25
  end
@@ -14,7 +14,7 @@ module Xrechnung
14
14
  def to_xml(xml)
15
15
  xml.cac :PartyLegalEntity do
16
16
  xml.cbc :RegistrationName, registration_name
17
- xml.cbc(:CompanyID, company_id) unless company_id.nil?
17
+ xml.cbc(:CompanyID, company_id) if company_id.present?
18
18
  end
19
19
  end
20
20
  end
@@ -13,7 +13,7 @@ module Xrechnung
13
13
  # noinspection RubyResolve
14
14
  def to_xml(xml)
15
15
  xml.cac :PartyTaxScheme do
16
- xml.cbc :CompanyID, company_id
16
+ xml.cbc(:CompanyID, company_id) if company_id.present?
17
17
  xml.cac :TaxScheme do
18
18
  xml.cbc :ID, tax_scheme_id
19
19
  end
@@ -17,6 +17,11 @@ module Xrechnung
17
17
  # • O (Services outside scope of tax)
18
18
  # • L (Canary Islands general indirect tax)
19
19
  # • M (Tax for production, services and importation in Ceuta and Melilla)
20
+ #
21
+ # Note: S, Z, E, AE, K, G, L and M require either a seller VAT identifier (BT-31),
22
+ # a seller tax registration identifier (BT-32), or a seller tax representative
23
+ # party (BG-11). Xrechnung::Document currently only supports the VAT identifier.
24
+ #
20
25
  # @!attribute id
21
26
  # @return [String]
22
27
  member :id, type: String
@@ -1,3 +1,3 @@
1
1
  module Xrechnung
2
- VERSION = "0.6.2".freeze
2
+ VERSION = "0.6.3".freeze
3
3
  end
data/lib/xrechnung.rb CHANGED
@@ -1,5 +1,9 @@
1
- require "xrechnung/version"
2
1
  require "date"
2
+ require "builder"
3
+
4
+ require "active_support/core_ext/object/blank"
5
+
6
+ require "xrechnung/version"
3
7
  require "xrechnung/currency"
4
8
  require "xrechnung/quantity"
5
9
  require "xrechnung/id"
@@ -25,7 +29,6 @@ require "xrechnung/price"
25
29
  require "xrechnung/invoice_line"
26
30
  require "xrechnung/invoice_document_reference"
27
31
  require "xrechnung/invoice_period"
28
- require "builder"
29
32
 
30
33
  module Xrechnung
31
34
  class Error < StandardError; end
@@ -289,16 +292,19 @@ module Xrechnung
289
292
  # @return [Array]
290
293
  member :allowance_charges, type: Array, default: []
291
294
 
295
+ COMMON_NAMESPACES = {
296
+ "xmlns:ubl" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
297
+ "xmlns:cac" => "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
298
+ "xmlns:cbc" => "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
299
+ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
300
+ "xsi:schemaLocation" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd",
301
+ }.freeze
302
+
292
303
  def to_xml(indent: 2, target: "")
293
304
  xml = Builder::XmlMarkup.new(indent: indent, target: target)
294
305
  xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
295
306
 
296
- xml.ubl :Invoice, \
297
- "xmlns:ubl" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
298
- "xmlns:cac" => "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
299
- "xmlns:cbc" => "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
300
- "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
301
- "xsi:schemaLocation" => "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd" do
307
+ xml.ubl :Invoice, COMMON_NAMESPACES do
302
308
  xml.cbc :CustomizationID, customization_id
303
309
  xml.cbc :ProfileID, profile_id
304
310
  xml.cbc :ID, id
data/xrechnung.gemspec CHANGED
@@ -11,8 +11,9 @@ Gem::Specification.new do |spec|
11
11
  spec.license = "MIT"
12
12
  spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
13
13
 
14
- spec.metadata["homepage_uri"] = spec.homepage
15
- spec.metadata["source_code_uri"] = "https://github.com/digineo/xrechnung"
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = "https://github.com/digineo/xrechnung"
16
+ spec.metadata["rubygems_mfa_required"] = "true"
16
17
 
17
18
  # Specify which files should be added to the gem when it is released.
18
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -22,10 +23,8 @@ Gem::Specification.new do |spec|
22
23
 
23
24
  spec.require_paths = ["lib"]
24
25
 
26
+ spec.add_dependency "activesupport" # for String#blank? and #present?
25
27
  spec.add_dependency "base64"
26
28
  spec.add_dependency "bigdecimal"
27
29
  spec.add_dependency "builder", "~> 3.2"
28
-
29
- spec.add_development_dependency "httparty", "~> 0.22"
30
- spec.add_development_dependency "rubyzip", "~> 2.0"
31
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrechnung
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Kornberger
@@ -10,7 +10,7 @@ cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: base64
13
+ name: activesupport
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -24,7 +24,7 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
26
  - !ruby/object:Gem::Dependency
27
- name: bigdecimal
27
+ name: base64
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
@@ -38,47 +38,33 @@ dependencies:
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  - !ruby/object:Gem::Dependency
41
- name: builder
41
+ name: bigdecimal
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '3.2'
46
+ version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '3.2'
54
- - !ruby/object:Gem::Dependency
55
- name: httparty
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '0.22'
61
- type: :development
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
51
+ - - ">="
66
52
  - !ruby/object:Gem::Version
67
- version: '0.22'
53
+ version: '0'
68
54
  - !ruby/object:Gem::Dependency
69
- name: rubyzip
55
+ name: builder
70
56
  requirement: !ruby/object:Gem::Requirement
71
57
  requirements:
72
58
  - - "~>"
73
59
  - !ruby/object:Gem::Version
74
- version: '2.0'
75
- type: :development
60
+ version: '3.2'
61
+ type: :runtime
76
62
  prerelease: false
77
63
  version_requirements: !ruby/object:Gem::Requirement
78
64
  requirements:
79
65
  - - "~>"
80
66
  - !ruby/object:Gem::Version
81
- version: '2.0'
67
+ version: '3.2'
82
68
  email:
83
69
  - jk+github@digineo.de
84
70
  executables: []
@@ -89,6 +75,7 @@ files:
89
75
  - ".github/workflows/validate-fixtures.yml"
90
76
  - ".gitignore"
91
77
  - ".rspec"
78
+ - ".rubocop"
92
79
  - ".rubocop.yml"
93
80
  - CODE_OF_CONDUCT.md
94
81
  - Gemfile
@@ -133,6 +120,7 @@ licenses:
133
120
  metadata:
134
121
  homepage_uri: https://github.com/digineo/xrechnung
135
122
  source_code_uri: https://github.com/digineo/xrechnung
123
+ rubygems_mfa_required: 'true'
136
124
  rdoc_options: []
137
125
  require_paths:
138
126
  - lib
@@ -147,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
135
  - !ruby/object:Gem::Version
148
136
  version: '0'
149
137
  requirements: []
150
- rubygems_version: 3.6.9
138
+ rubygems_version: 4.0.5
151
139
  specification_version: 4
152
140
  summary: Library to create invoices in the XRechnung format.
153
141
  test_files: []