gobl 0.1.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/tax/CO.json +420 -0
- data/data/tax/ES.json +61 -0
- 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 +12 -35
- 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.3.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-25 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,10 +74,12 @@ executables: []
|
|
102
74
|
extensions: []
|
103
75
|
extra_rdoc_files: []
|
104
76
|
files:
|
77
|
+
- data/tax/CO.json
|
105
78
|
- data/tax/ES.json
|
106
79
|
- data/tax/FR.json
|
107
80
|
- data/tax/GB.json
|
108
81
|
- data/tax/NL.json
|
82
|
+
- lib/ext/hashme.rb
|
109
83
|
- lib/extensions.rb
|
110
84
|
- lib/gobl.rb
|
111
85
|
- lib/gobl/bill/advances.rb
|
@@ -133,15 +107,18 @@ files:
|
|
133
107
|
- lib/gobl/document.rb
|
134
108
|
- lib/gobl/dsig/digest.rb
|
135
109
|
- lib/gobl/dsig/signature.rb
|
110
|
+
- lib/gobl/enum.rb
|
136
111
|
- lib/gobl/envelope.rb
|
137
112
|
- lib/gobl/header.rb
|
138
113
|
- lib/gobl/i18n/string.rb
|
139
114
|
- lib/gobl/id.rb
|
140
115
|
- lib/gobl/l10n/code.rb
|
141
116
|
- lib/gobl/l10n/country_code.rb
|
117
|
+
- lib/gobl/map.rb
|
142
118
|
- lib/gobl/note/message.rb
|
143
119
|
- lib/gobl/num/amount.rb
|
144
120
|
- lib/gobl/num/percentage.rb
|
121
|
+
- lib/gobl/object.rb
|
145
122
|
- lib/gobl/operations.rb
|
146
123
|
- lib/gobl/operations/service_error.rb
|
147
124
|
- lib/gobl/operations/validation_result.rb
|
@@ -190,8 +167,8 @@ files:
|
|
190
167
|
- lib/gobl/tax/schemes.rb
|
191
168
|
- lib/gobl/tax/set.rb
|
192
169
|
- lib/gobl/tax/total.rb
|
193
|
-
- lib/gobl/types.rb
|
194
170
|
- lib/gobl/uuid/uuid.rb
|
171
|
+
- lib/gobl/value.rb
|
195
172
|
- lib/gobl/version.rb
|
196
173
|
- lib/gobl_extensions/document_helper.rb
|
197
174
|
- lib/gobl_extensions/envelope_helper.rb
|
@@ -217,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
194
|
- !ruby/object:Gem::Version
|
218
195
|
version: 3.1.4
|
219
196
|
requirements: []
|
220
|
-
rubygems_version: 3.
|
197
|
+
rubygems_version: 3.1.4
|
221
198
|
signing_key:
|
222
199
|
specification_version: 4
|
223
200
|
summary: Minimalist ruby version of the GOBL library
|
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
|