gobl 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ext/hashme.rb +28 -0
- data/lib/gobl/bill/advances.rb +1 -77
- data/lib/gobl/bill/charge.rb +11 -65
- data/lib/gobl/bill/delivery.rb +5 -47
- data/lib/gobl/bill/discount.rb +11 -65
- data/lib/gobl/bill/exchange_rates.rb +1 -77
- data/lib/gobl/bill/invoice.rb +28 -104
- data/lib/gobl/bill/invoice_type.rb +3 -134
- data/lib/gobl/bill/line.rb +13 -65
- data/lib/gobl/bill/line_charge.rb +5 -47
- data/lib/gobl/bill/line_discount.rb +5 -47
- data/lib/gobl/bill/ordering.rb +2 -38
- data/lib/gobl/bill/outlay.rb +11 -59
- data/lib/gobl/bill/payment.rb +5 -47
- data/lib/gobl/bill/preceding.rb +12 -62
- data/lib/gobl/bill/scheme_keys.rb +1 -77
- data/lib/gobl/bill/tax.rb +4 -44
- data/lib/gobl/bill/totals.rb +17 -71
- data/lib/gobl/cal/date.rb +1 -90
- data/lib/gobl/cal/period.rb +5 -41
- data/lib/gobl/currency/code.rb +3 -134
- data/lib/gobl/currency/exchange_rate.rb +5 -41
- data/lib/gobl/document.rb +1 -58
- data/lib/gobl/dsig/digest.rb +5 -41
- data/lib/gobl/dsig/signature.rb +1 -90
- data/lib/gobl/enum.rb +81 -0
- data/lib/gobl/envelope.rb +9 -48
- data/lib/gobl/header.rb +10 -56
- data/lib/gobl/i18n/string.rb +1 -58
- data/lib/gobl/l10n/code.rb +1 -90
- data/lib/gobl/l10n/country_code.rb +3 -134
- data/lib/gobl/map.rb +62 -0
- data/lib/gobl/note/message.rb +5 -44
- data/lib/gobl/num/amount.rb +6 -35
- data/lib/gobl/object.rb +21 -0
- data/lib/gobl/operations.rb +3 -3
- data/lib/gobl/org/address.rb +18 -80
- data/lib/gobl/org/code.rb +1 -90
- data/lib/gobl/org/coordinates.rb +5 -47
- data/lib/gobl/org/email.rb +6 -47
- data/lib/gobl/org/inbox.rb +8 -50
- data/lib/gobl/org/item.rb +13 -65
- data/lib/gobl/org/item_code.rb +4 -41
- data/lib/gobl/org/key.rb +1 -90
- data/lib/gobl/org/meta.rb +1 -58
- data/lib/gobl/org/name.rb +12 -62
- data/lib/gobl/org/note.rb +6 -47
- data/lib/gobl/org/note_key.rb +3 -134
- data/lib/gobl/org/party.rb +14 -71
- data/lib/gobl/org/person.rb +9 -56
- data/lib/gobl/org/registration.rb +9 -59
- data/lib/gobl/org/source_key.rb +3 -134
- data/lib/gobl/org/tax_identity.rb +8 -53
- data/lib/gobl/org/telephone.rb +5 -44
- data/lib/gobl/org/unit.rb +1 -136
- data/lib/gobl/pay/advance.rb +11 -59
- data/lib/gobl/pay/card.rb +5 -41
- data/lib/gobl/pay/credit_transfer.rb +6 -50
- data/lib/gobl/pay/direct_debit.rb +4 -44
- data/lib/gobl/pay/due_date.rb +8 -50
- data/lib/gobl/pay/instructions.rb +11 -62
- data/lib/gobl/pay/method_key.rb +3 -134
- data/lib/gobl/pay/online.rb +4 -41
- data/lib/gobl/pay/term_key.rb +3 -134
- data/lib/gobl/pay/terms.rb +6 -47
- data/lib/gobl/stamp.rb +5 -41
- data/lib/gobl/struct.rb +15 -15
- data/lib/gobl/tax/category.rb +9 -50
- data/lib/gobl/tax/category_total.rb +11 -53
- data/lib/gobl/tax/combo.rb +6 -47
- data/lib/gobl/tax/localities.rb +1 -77
- data/lib/gobl/tax/locality.rb +6 -44
- data/lib/gobl/tax/rate.rb +8 -47
- data/lib/gobl/tax/rate_total.rb +9 -50
- data/lib/gobl/tax/rate_total_surcharge.rb +5 -41
- data/lib/gobl/tax/rate_value.rb +6 -47
- data/lib/gobl/tax/region.rb +12 -56
- data/lib/gobl/tax/scheme.rb +8 -50
- data/lib/gobl/tax/schemes.rb +1 -77
- data/lib/gobl/tax/set.rb +1 -77
- data/lib/gobl/tax/total.rb +4 -41
- data/lib/gobl/uuid/uuid.rb +1 -90
- data/lib/gobl/value.rb +58 -0
- data/lib/gobl/version.rb +1 -1
- data/lib/gobl.rb +3 -1
- data/lib/gobl_extensions/document_helper.rb +3 -3
- data/lib/gobl_extensions/envelope_helper.rb +5 -0
- data/lib/gobl_extensions/i18n/value_keys_helper.rb +3 -3
- data/lib/gobl_extensions/tax/region_helper.rb +3 -9
- metadata +11 -36
- data/home/cavalle/workspace/invopop/gobl.ruby/gobl.gemspec +0 -30
- data/lib/gobl/types.rb +0 -17
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'dry/files'
|
4
|
-
|
5
3
|
module GOBLExtensions
|
6
4
|
module Tax
|
7
5
|
# Additional methods for the generated {GOBL::Tax::Region} class
|
@@ -18,21 +16,17 @@ module GOBLExtensions
|
|
18
16
|
|
19
17
|
protected
|
20
18
|
|
21
|
-
def files
|
22
|
-
@files ||= Dry::Files.new
|
23
|
-
end
|
24
|
-
|
25
19
|
# map of region ID to region instance
|
26
20
|
def regions
|
27
21
|
@regions ||= {}
|
28
22
|
end
|
29
23
|
|
30
24
|
def load_region(code)
|
31
|
-
path =
|
25
|
+
path = File.join("#{__dir__}/../../../data/tax", "#{code}.json")
|
32
26
|
msg = "region definition for #{code} does not exist at #{path}"
|
33
|
-
raise StandardError, msg unless
|
27
|
+
raise StandardError, msg unless File.exist?(path)
|
34
28
|
|
35
|
-
data =
|
29
|
+
data = File.read(path)
|
36
30
|
from_json!(data)
|
37
31
|
end
|
38
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gobl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lilue
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-10-
|
13
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -27,47 +27,19 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '6.1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: hashme
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.2.6
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: dry-struct
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 1.4.0
|
50
|
-
type: :runtime
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 1.4.0
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: dry-types
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 1.5.1
|
64
|
-
type: :runtime
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 1.5.1
|
42
|
+
version: 0.2.6
|
71
43
|
- !ruby/object:Gem::Dependency
|
72
44
|
name: json
|
73
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,11 +74,11 @@ executables: []
|
|
102
74
|
extensions: []
|
103
75
|
extra_rdoc_files: []
|
104
76
|
files:
|
105
|
-
- "/home/cavalle/workspace/invopop/gobl.ruby/gobl.gemspec"
|
106
77
|
- data/tax/ES.json
|
107
78
|
- data/tax/FR.json
|
108
79
|
- data/tax/GB.json
|
109
80
|
- data/tax/NL.json
|
81
|
+
- lib/ext/hashme.rb
|
110
82
|
- lib/extensions.rb
|
111
83
|
- lib/gobl.rb
|
112
84
|
- lib/gobl/bill/advances.rb
|
@@ -134,15 +106,18 @@ files:
|
|
134
106
|
- lib/gobl/document.rb
|
135
107
|
- lib/gobl/dsig/digest.rb
|
136
108
|
- lib/gobl/dsig/signature.rb
|
109
|
+
- lib/gobl/enum.rb
|
137
110
|
- lib/gobl/envelope.rb
|
138
111
|
- lib/gobl/header.rb
|
139
112
|
- lib/gobl/i18n/string.rb
|
140
113
|
- lib/gobl/id.rb
|
141
114
|
- lib/gobl/l10n/code.rb
|
142
115
|
- lib/gobl/l10n/country_code.rb
|
116
|
+
- lib/gobl/map.rb
|
143
117
|
- lib/gobl/note/message.rb
|
144
118
|
- lib/gobl/num/amount.rb
|
145
119
|
- lib/gobl/num/percentage.rb
|
120
|
+
- lib/gobl/object.rb
|
146
121
|
- lib/gobl/operations.rb
|
147
122
|
- lib/gobl/operations/service_error.rb
|
148
123
|
- lib/gobl/operations/validation_result.rb
|
@@ -191,8 +166,8 @@ files:
|
|
191
166
|
- lib/gobl/tax/schemes.rb
|
192
167
|
- lib/gobl/tax/set.rb
|
193
168
|
- lib/gobl/tax/total.rb
|
194
|
-
- lib/gobl/types.rb
|
195
169
|
- lib/gobl/uuid/uuid.rb
|
170
|
+
- lib/gobl/value.rb
|
196
171
|
- lib/gobl/version.rb
|
197
172
|
- lib/gobl_extensions/document_helper.rb
|
198
173
|
- lib/gobl_extensions/envelope_helper.rb
|
@@ -218,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
193
|
- !ruby/object:Gem::Version
|
219
194
|
version: 3.1.4
|
220
195
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
196
|
+
rubygems_version: 3.1.4
|
222
197
|
signing_key:
|
223
198
|
specification_version: 4
|
224
199
|
summary: Minimalist ruby version of the GOBL library
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'lib/gobl/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'gobl'
|
7
|
-
spec.version = GOBL::VERSION
|
8
|
-
spec.platform = Gem::Platform::RUBY
|
9
|
-
spec.summary = 'Minimalist ruby version of the GOBL library'
|
10
|
-
spec.homepage = 'https://github.com/invopop/gobl.ruby'
|
11
|
-
spec.license = 'Apache-2.0'
|
12
|
-
spec.authors = ['David Lilue', 'Sam Lown', 'Juanjo Molinero']
|
13
|
-
|
14
|
-
spec.required_ruby_version = '>= 2.7'
|
15
|
-
spec.required_rubygems_version = '>= 3.1.4'
|
16
|
-
|
17
|
-
spec.files = Dir['lib/**/*', 'data/tax/**/*'] + [__FILE__]
|
18
|
-
spec.require_path = 'lib'
|
19
|
-
|
20
|
-
spec.metadata = {
|
21
|
-
'rubygems_mfa_required' => 'true'
|
22
|
-
}
|
23
|
-
|
24
|
-
spec.add_dependency('activesupport', '~> 6.1')
|
25
|
-
spec.add_dependency('dry-files', '~> 0.1.0')
|
26
|
-
spec.add_dependency('dry-struct', '~> 1.4.0')
|
27
|
-
spec.add_dependency('dry-types', '~> 1.5.1')
|
28
|
-
spec.add_dependency('json', '~> 2.6.1')
|
29
|
-
spec.add_dependency('zeitwerk', '~> 2.5.1')
|
30
|
-
end
|
data/lib/gobl/types.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GOBL
|
4
|
-
# Types used by the generated GOBL code.
|
5
|
-
# @api private
|
6
|
-
module Types
|
7
|
-
include Dry.Types()
|
8
|
-
|
9
|
-
Nil = Strict::Nil
|
10
|
-
Int = Strict::Integer # deprecated, use Integer
|
11
|
-
Integer = Strict::Integer
|
12
|
-
Bool = Strict::Bool
|
13
|
-
Hash = Strict::Hash
|
14
|
-
String = Strict::String
|
15
|
-
Double = Strict::Float | Strict::Integer
|
16
|
-
end
|
17
|
-
end
|