gobl 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/extensions.rb +1 -1
- data/lib/gobl/bill/advances.rb +1 -1
- data/lib/gobl/bill/charge.rb +3 -3
- data/lib/gobl/bill/delivery.rb +1 -1
- data/lib/gobl/bill/discount.rb +3 -3
- data/lib/gobl/bill/exchange_rates.rb +1 -1
- data/lib/gobl/bill/invoice.rb +5 -5
- data/lib/gobl/bill/invoice_type.rb +1 -1
- data/lib/gobl/bill/line.rb +3 -3
- data/lib/gobl/bill/line_charge.rb +1 -1
- data/lib/gobl/bill/line_discount.rb +1 -1
- data/lib/gobl/bill/ordering.rb +1 -1
- data/lib/gobl/bill/outlay.rb +1 -1
- data/lib/gobl/bill/payment.rb +1 -1
- data/lib/gobl/bill/preceding.rb +5 -5
- data/lib/gobl/bill/scheme_keys.rb +2 -2
- data/lib/gobl/bill/tax.rb +5 -5
- data/lib/gobl/bill/totals.rb +1 -1
- data/lib/gobl/cal/date.rb +1 -1
- data/lib/gobl/cal/period.rb +1 -1
- data/lib/gobl/{org → cbc}/code.rb +3 -3
- data/lib/gobl/{org → cbc}/key.rb +3 -3
- data/lib/gobl/{org → cbc}/meta.rb +2 -2
- data/lib/gobl/{org → cbc}/note.rb +3 -3
- data/lib/gobl/{org → cbc}/note_key.rb +3 -3
- data/lib/gobl/{org → cbc}/stamp.rb +5 -5
- data/lib/gobl/currency/code.rb +1 -1
- data/lib/gobl/currency/exchange_rate.rb +1 -1
- data/lib/gobl/document.rb +1 -1
- data/lib/gobl/dsig/digest.rb +1 -1
- data/lib/gobl/dsig/signature.rb +1 -1
- data/lib/gobl/envelope.rb +1 -1
- data/lib/gobl/header.rb +5 -5
- data/lib/gobl/i18n/string.rb +1 -1
- data/lib/gobl/l10n/code.rb +1 -1
- data/lib/gobl/l10n/country_code.rb +1 -1
- data/lib/gobl/map.rb +5 -1
- data/lib/gobl/note/message.rb +3 -3
- data/lib/gobl/org/address.rb +5 -6
- data/lib/gobl/org/coordinates.rb +1 -1
- data/lib/gobl/org/email.rb +3 -3
- data/lib/gobl/org/inbox.rb +5 -5
- data/lib/gobl/org/item.rb +3 -3
- data/lib/gobl/org/item_code.rb +1 -1
- data/lib/gobl/org/name.rb +3 -3
- data/lib/gobl/org/party.rb +5 -5
- data/lib/gobl/org/person.rb +3 -3
- data/lib/gobl/org/registration.rb +1 -1
- data/lib/gobl/org/telephone.rb +1 -1
- data/lib/gobl/org/unit.rb +1 -1
- data/lib/gobl/pay/advance.rb +1 -1
- data/lib/gobl/pay/card.rb +1 -1
- data/lib/gobl/pay/credit_transfer.rb +1 -1
- data/lib/gobl/pay/direct_debit.rb +1 -1
- data/lib/gobl/pay/due_date.rb +1 -1
- data/lib/gobl/pay/instructions.rb +3 -3
- data/lib/gobl/pay/method_key.rb +1 -1
- data/lib/gobl/pay/online.rb +1 -1
- data/lib/gobl/pay/term_key.rb +1 -1
- data/lib/gobl/pay/terms.rb +1 -1
- data/lib/gobl/tax/category.rb +4 -4
- data/lib/gobl/tax/category_total.rb +3 -3
- data/lib/gobl/tax/combo.rb +5 -5
- data/lib/gobl/{org/tax_identity.rb → tax/identity.rb} +11 -11
- data/lib/gobl/tax/rate.rb +4 -4
- data/lib/gobl/tax/rate_total.rb +3 -3
- data/lib/gobl/tax/rate_total_surcharge.rb +1 -1
- data/lib/gobl/tax/rate_value.rb +2 -2
- data/lib/gobl/tax/{region.rb → regime.rb} +14 -14
- data/lib/gobl/tax/scheme.rb +8 -8
- data/lib/gobl/tax/schemes.rb +1 -1
- data/lib/gobl/tax/set.rb +1 -1
- data/lib/gobl/{org → tax}/source_key.rb +3 -3
- data/lib/gobl/tax/total.rb +1 -1
- data/lib/gobl/tax/zone.rb +43 -0
- data/lib/gobl/uuid/uuid.rb +1 -1
- data/lib/gobl/value.rb +19 -0
- data/lib/gobl/version.rb +1 -1
- data/lib/gobl.rb +2 -1
- data/lib/gobl_extensions/tax/regime_helper.rb +35 -0
- metadata +14 -20
- data/data/tax/CO.json +0 -10212
- data/data/tax/ES.json +0 -902
- data/data/tax/FR.json +0 -47
- data/data/tax/GB.json +0 -56
- data/data/tax/NL.json +0 -60
- data/lib/gobl/tax/localities.rb +0 -14
- data/lib/gobl/tax/locality.rb +0 -34
- data/lib/gobl_extensions/tax/region_helper.rb +0 -35
data/lib/gobl/uuid/uuid.rb
CHANGED
data/lib/gobl/value.rb
CHANGED
@@ -46,6 +46,25 @@ module GOBL
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Returns whether the current value is equal to a given one, unlike `#==`, without
|
50
|
+
# doing any coercion. That is, the other object must be of the same class to return
|
51
|
+
# true.
|
52
|
+
#
|
53
|
+
# @param other [Object] the other value to compare with
|
54
|
+
#
|
55
|
+
# @return [Boolean] `true` if the values are equal, `false` otherwise
|
56
|
+
def eql?(other)
|
57
|
+
self.class == other.class && _value.eql?(other._value)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns a integer hash code of the current value that respects the following
|
61
|
+
# property: Given objects `a` and `b`. If `a.eql?(b)`, then `a.hash == b.hash`.
|
62
|
+
#
|
63
|
+
# @return [Integer] hash code of the current value
|
64
|
+
def hash
|
65
|
+
[self.class.name, _value].hash
|
66
|
+
end
|
67
|
+
|
49
68
|
# @api private
|
50
69
|
def as_json(...)
|
51
70
|
_value.as_json(...)
|
data/lib/gobl/version.rb
CHANGED
data/lib/gobl.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GOBLExtensions
|
4
|
+
module Tax
|
5
|
+
# Additional methods for the generated {GOBL::Tax::Regime} class
|
6
|
+
module RegimeHelper
|
7
|
+
module ClassMethods
|
8
|
+
# Loads a {GOBL::Tax::Regime} object identified by the given code with all its data
|
9
|
+
#
|
10
|
+
# @param code [String] the code of the regime to load
|
11
|
+
#
|
12
|
+
# @return [Regime] the requested regime
|
13
|
+
def fetch(code)
|
14
|
+
regimes[code] ||= load_regime(code)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
# map of regime ID to regime instance
|
20
|
+
def regimes
|
21
|
+
@regimes ||= {}
|
22
|
+
end
|
23
|
+
|
24
|
+
def load_regime(code)
|
25
|
+
path = File.join("#{__dir__}/../../../data/regimes", "#{code.to_s.downcase}.json")
|
26
|
+
msg = "regime definition for #{code} does not exist at #{path}"
|
27
|
+
raise StandardError, msg unless File.exist?(path)
|
28
|
+
|
29
|
+
data = File.read(path)
|
30
|
+
from_json!(data)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
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.5.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:
|
13
|
+
date: 2023-01-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -74,11 +74,6 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- data/tax/CO.json
|
78
|
-
- data/tax/ES.json
|
79
|
-
- data/tax/FR.json
|
80
|
-
- data/tax/GB.json
|
81
|
-
- data/tax/NL.json
|
82
77
|
- lib/ext/hashme.rb
|
83
78
|
- lib/extensions.rb
|
84
79
|
- lib/gobl.rb
|
@@ -101,6 +96,12 @@ files:
|
|
101
96
|
- lib/gobl/bill/totals.rb
|
102
97
|
- lib/gobl/cal/date.rb
|
103
98
|
- lib/gobl/cal/period.rb
|
99
|
+
- lib/gobl/cbc/code.rb
|
100
|
+
- lib/gobl/cbc/key.rb
|
101
|
+
- lib/gobl/cbc/meta.rb
|
102
|
+
- lib/gobl/cbc/note.rb
|
103
|
+
- lib/gobl/cbc/note_key.rb
|
104
|
+
- lib/gobl/cbc/stamp.rb
|
104
105
|
- lib/gobl/config.rb
|
105
106
|
- lib/gobl/currency/code.rb
|
106
107
|
- lib/gobl/currency/exchange_rate.rb
|
@@ -123,23 +124,15 @@ files:
|
|
123
124
|
- lib/gobl/operations/service_error.rb
|
124
125
|
- lib/gobl/operations/validation_result.rb
|
125
126
|
- lib/gobl/org/address.rb
|
126
|
-
- lib/gobl/org/code.rb
|
127
127
|
- lib/gobl/org/coordinates.rb
|
128
128
|
- lib/gobl/org/email.rb
|
129
129
|
- lib/gobl/org/inbox.rb
|
130
130
|
- lib/gobl/org/item.rb
|
131
131
|
- lib/gobl/org/item_code.rb
|
132
|
-
- lib/gobl/org/key.rb
|
133
|
-
- lib/gobl/org/meta.rb
|
134
132
|
- lib/gobl/org/name.rb
|
135
|
-
- lib/gobl/org/note.rb
|
136
|
-
- lib/gobl/org/note_key.rb
|
137
133
|
- lib/gobl/org/party.rb
|
138
134
|
- lib/gobl/org/person.rb
|
139
135
|
- lib/gobl/org/registration.rb
|
140
|
-
- lib/gobl/org/source_key.rb
|
141
|
-
- lib/gobl/org/stamp.rb
|
142
|
-
- lib/gobl/org/tax_identity.rb
|
143
136
|
- lib/gobl/org/telephone.rb
|
144
137
|
- lib/gobl/org/unit.rb
|
145
138
|
- lib/gobl/pay/advance.rb
|
@@ -156,24 +149,25 @@ files:
|
|
156
149
|
- lib/gobl/tax/category.rb
|
157
150
|
- lib/gobl/tax/category_total.rb
|
158
151
|
- lib/gobl/tax/combo.rb
|
159
|
-
- lib/gobl/tax/
|
160
|
-
- lib/gobl/tax/locality.rb
|
152
|
+
- lib/gobl/tax/identity.rb
|
161
153
|
- lib/gobl/tax/rate.rb
|
162
154
|
- lib/gobl/tax/rate_total.rb
|
163
155
|
- lib/gobl/tax/rate_total_surcharge.rb
|
164
156
|
- lib/gobl/tax/rate_value.rb
|
165
|
-
- lib/gobl/tax/
|
157
|
+
- lib/gobl/tax/regime.rb
|
166
158
|
- lib/gobl/tax/scheme.rb
|
167
159
|
- lib/gobl/tax/schemes.rb
|
168
160
|
- lib/gobl/tax/set.rb
|
161
|
+
- lib/gobl/tax/source_key.rb
|
169
162
|
- lib/gobl/tax/total.rb
|
163
|
+
- lib/gobl/tax/zone.rb
|
170
164
|
- lib/gobl/uuid/uuid.rb
|
171
165
|
- lib/gobl/value.rb
|
172
166
|
- lib/gobl/version.rb
|
173
167
|
- lib/gobl_extensions/document_helper.rb
|
174
168
|
- lib/gobl_extensions/envelope_helper.rb
|
175
169
|
- lib/gobl_extensions/i18n/value_keys_helper.rb
|
176
|
-
- lib/gobl_extensions/tax/
|
170
|
+
- lib/gobl_extensions/tax/regime_helper.rb
|
177
171
|
homepage: https://github.com/invopop/gobl.ruby
|
178
172
|
licenses:
|
179
173
|
- Apache-2.0
|
@@ -194,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
188
|
- !ruby/object:Gem::Version
|
195
189
|
version: 3.1.4
|
196
190
|
requirements: []
|
197
|
-
rubygems_version: 3.3.
|
191
|
+
rubygems_version: 3.3.26
|
198
192
|
signing_key:
|
199
193
|
specification_version: 4
|
200
194
|
summary: Minimalist ruby version of the GOBL library
|