gobl 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/extensions.rb +1 -1
  3. data/lib/gobl/bill/advances.rb +1 -1
  4. data/lib/gobl/bill/charge.rb +3 -3
  5. data/lib/gobl/bill/delivery.rb +1 -1
  6. data/lib/gobl/bill/discount.rb +3 -3
  7. data/lib/gobl/bill/exchange_rates.rb +1 -1
  8. data/lib/gobl/bill/invoice.rb +5 -5
  9. data/lib/gobl/bill/invoice_type.rb +1 -1
  10. data/lib/gobl/bill/line.rb +3 -3
  11. data/lib/gobl/bill/line_charge.rb +1 -1
  12. data/lib/gobl/bill/line_discount.rb +1 -1
  13. data/lib/gobl/bill/ordering.rb +1 -1
  14. data/lib/gobl/bill/outlay.rb +1 -1
  15. data/lib/gobl/bill/payment.rb +1 -1
  16. data/lib/gobl/bill/preceding.rb +5 -5
  17. data/lib/gobl/bill/scheme_keys.rb +2 -2
  18. data/lib/gobl/bill/tax.rb +5 -5
  19. data/lib/gobl/bill/totals.rb +1 -1
  20. data/lib/gobl/cal/date.rb +1 -1
  21. data/lib/gobl/cal/period.rb +1 -1
  22. data/lib/gobl/{org → cbc}/code.rb +3 -3
  23. data/lib/gobl/{org → cbc}/key.rb +3 -3
  24. data/lib/gobl/{org → cbc}/meta.rb +2 -2
  25. data/lib/gobl/{org → cbc}/note.rb +3 -3
  26. data/lib/gobl/{org → cbc}/note_key.rb +3 -3
  27. data/lib/gobl/{org → cbc}/stamp.rb +5 -5
  28. data/lib/gobl/currency/code.rb +1 -1
  29. data/lib/gobl/currency/exchange_rate.rb +1 -1
  30. data/lib/gobl/document.rb +1 -1
  31. data/lib/gobl/dsig/digest.rb +1 -1
  32. data/lib/gobl/dsig/signature.rb +1 -1
  33. data/lib/gobl/envelope.rb +1 -1
  34. data/lib/gobl/header.rb +5 -5
  35. data/lib/gobl/i18n/string.rb +1 -1
  36. data/lib/gobl/l10n/code.rb +1 -1
  37. data/lib/gobl/l10n/country_code.rb +1 -1
  38. data/lib/gobl/note/message.rb +3 -3
  39. data/lib/gobl/org/address.rb +5 -6
  40. data/lib/gobl/org/coordinates.rb +1 -1
  41. data/lib/gobl/org/email.rb +3 -3
  42. data/lib/gobl/org/inbox.rb +5 -5
  43. data/lib/gobl/org/item.rb +3 -3
  44. data/lib/gobl/org/item_code.rb +1 -1
  45. data/lib/gobl/org/name.rb +3 -3
  46. data/lib/gobl/org/party.rb +5 -5
  47. data/lib/gobl/org/person.rb +3 -3
  48. data/lib/gobl/org/registration.rb +1 -1
  49. data/lib/gobl/org/telephone.rb +1 -1
  50. data/lib/gobl/org/unit.rb +1 -1
  51. data/lib/gobl/pay/advance.rb +1 -1
  52. data/lib/gobl/pay/card.rb +1 -1
  53. data/lib/gobl/pay/credit_transfer.rb +1 -1
  54. data/lib/gobl/pay/direct_debit.rb +1 -1
  55. data/lib/gobl/pay/due_date.rb +1 -1
  56. data/lib/gobl/pay/instructions.rb +3 -3
  57. data/lib/gobl/pay/method_key.rb +1 -1
  58. data/lib/gobl/pay/online.rb +1 -1
  59. data/lib/gobl/pay/term_key.rb +1 -1
  60. data/lib/gobl/pay/terms.rb +1 -1
  61. data/lib/gobl/tax/category.rb +4 -4
  62. data/lib/gobl/tax/category_total.rb +3 -3
  63. data/lib/gobl/tax/combo.rb +5 -5
  64. data/lib/gobl/{org/tax_identity.rb → tax/identity.rb} +11 -11
  65. data/lib/gobl/tax/rate.rb +4 -4
  66. data/lib/gobl/tax/rate_total.rb +3 -3
  67. data/lib/gobl/tax/rate_total_surcharge.rb +1 -1
  68. data/lib/gobl/tax/rate_value.rb +2 -2
  69. data/lib/gobl/tax/{region.rb → regime.rb} +14 -14
  70. data/lib/gobl/tax/scheme.rb +8 -8
  71. data/lib/gobl/tax/schemes.rb +1 -1
  72. data/lib/gobl/tax/set.rb +1 -1
  73. data/lib/gobl/{org → tax}/source_key.rb +3 -3
  74. data/lib/gobl/tax/total.rb +1 -1
  75. data/lib/gobl/tax/zone.rb +43 -0
  76. data/lib/gobl/uuid/uuid.rb +1 -1
  77. data/lib/gobl/version.rb +1 -1
  78. data/lib/gobl.rb +2 -1
  79. data/lib/gobl_extensions/tax/regime_helper.rb +35 -0
  80. metadata +13 -19
  81. data/data/tax/CO.json +0 -10212
  82. data/data/tax/ES.json +0 -902
  83. data/data/tax/FR.json +0 -47
  84. data/data/tax/GB.json +0 -56
  85. data/data/tax/NL.json +0 -60
  86. data/lib/gobl/tax/localities.rb +0 -14
  87. data/lib/gobl/tax/locality.rb +0 -34
  88. data/lib/gobl_extensions/tax/region_helper.rb +0 -35
data/data/tax/FR.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- "$schema": "https://gobl.org/draft-0/tax/region",
3
- "name": {
4
- "en": "France",
5
- "fr": "La France"
6
- },
7
- "country": "FR",
8
- "currency": "EUR",
9
- "categories": [
10
- {
11
- "code": "VAT",
12
- "name": {
13
- "en": "VAT",
14
- "fr": "TVA"
15
- },
16
- "desc": {
17
- "en": "Value Added Tax",
18
- "fr": "Taxe sur la Valeur Ajoutée"
19
- },
20
- "rates": [
21
- {
22
- "key": "zero",
23
- "name": {
24
- "en": "Zero Rate"
25
- },
26
- "values": [
27
- {
28
- "percent": "0.0%"
29
- }
30
- ]
31
- },
32
- {
33
- "key": "standard",
34
- "name": {
35
- "en": "Standard Rate"
36
- },
37
- "values": [
38
- {
39
- "since": "2011-01-04",
40
- "percent": "20.0%"
41
- }
42
- ]
43
- }
44
- ]
45
- }
46
- ]
47
- }
data/data/tax/GB.json DELETED
@@ -1,56 +0,0 @@
1
- {
2
- "$schema": "https://gobl.org/draft-0/tax/region",
3
- "name": {
4
- "en": "United Kingdom"
5
- },
6
- "country": "GB",
7
- "currency": "GBP",
8
- "categories": [
9
- {
10
- "code": "VAT",
11
- "name": {
12
- "en": "VAT"
13
- },
14
- "desc": {
15
- "en": "Value Added Tax"
16
- },
17
- "rates": [
18
- {
19
- "key": "zero",
20
- "name": {
21
- "en": "Zero Rate"
22
- },
23
- "values": [
24
- {
25
- "percent": "0.0%"
26
- }
27
- ]
28
- },
29
- {
30
- "key": "standard",
31
- "name": {
32
- "en": "Standard Rate"
33
- },
34
- "values": [
35
- {
36
- "since": "2011-01-04",
37
- "percent": "20.0%"
38
- }
39
- ]
40
- },
41
- {
42
- "key": "reduced",
43
- "name": {
44
- "en": "Reduced Rate"
45
- },
46
- "values": [
47
- {
48
- "since": "2011-01-04",
49
- "percent": "5.0%"
50
- }
51
- ]
52
- }
53
- ]
54
- }
55
- ]
56
- }
data/data/tax/NL.json DELETED
@@ -1,60 +0,0 @@
1
- {
2
- "$schema": "https://gobl.org/draft-0/tax/region",
3
- "name": {
4
- "en": "The Netherlands",
5
- "nl": "Nederland"
6
- },
7
- "country": "NL",
8
- "currency": "EUR",
9
- "categories": [
10
- {
11
- "code": "VAT",
12
- "name": {
13
- "en": "VAT",
14
- "nl": "BTW"
15
- },
16
- "desc": {
17
- "en": "Value Added Tax",
18
- "nl": "Belasting Toegevoegde Waarde"
19
- },
20
- "rates": [
21
- {
22
- "key": "zero",
23
- "name": {
24
- "en": "Zero Rate",
25
- "nl": "0%-tarief"
26
- },
27
- "values": [
28
- {
29
- "percent": "0.0%"
30
- }
31
- ]
32
- },
33
- {
34
- "key": "standard",
35
- "name": {
36
- "en": "Standard Rate",
37
- "nl": "Standaardtarief"
38
- },
39
- "values": [
40
- {
41
- "percent": "21.0%"
42
- }
43
- ]
44
- },
45
- {
46
- "key": "reduced",
47
- "name": {
48
- "en": "Reduced Rate",
49
- "nl": "Gereduceerd Tarief"
50
- },
51
- "values": [
52
- {
53
- "percent": "9.0%"
54
- }
55
- ]
56
- }
57
- ]
58
- }
59
- ]
60
- }
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.32.0
7
- ##
8
-
9
- module GOBL
10
- module Tax
11
- # Localities stores an array of locality objects used to describe areas sub-divisions inside a region.
12
- Localities = [Locality] # rubocop:disable Naming/ConstantName, Style/MutableConstant
13
- end
14
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.32.0
7
- ##
8
-
9
- module GOBL
10
- module Tax
11
- # Locality represents an area inside a region, like a province or a state, which shares the basic definitions of the region, but may vary in some validation rules.
12
- class Locality < GOBL::Object
13
- # The Schema ID of the GOBL Locality structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/tax/region#/$defs/Locality'
15
-
16
- # @!attribute [r] code
17
- # Code
18
- # @return [GOBL::L10n::Code]
19
- property :code, GOBL::L10n::Code
20
- validates :code, presence: true
21
-
22
- # @!attribute [r] name
23
- # Name of the locality with local and hopefully international translations.
24
- # @return [GOBL::I18n::String]
25
- property :name, GOBL::I18n::String
26
- validates :name, presence: true
27
-
28
- # @!attribute [r] meta
29
- # Any additional information
30
- # @return [GOBL::Org::Meta]
31
- property :meta, GOBL::Org::Meta
32
- end
33
- end
34
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GOBLExtensions
4
- module Tax
5
- # Additional methods for the generated {GOBL::Tax::Region} class
6
- module RegionHelper
7
- module ClassMethods
8
- # Loads a {GOBL::Tax::Region} object identified by the given code with all its data
9
- #
10
- # @param code [String] the code of the region to load
11
- #
12
- # @return [Region] the requested region
13
- def fetch(code)
14
- regions[code] ||= load_region(code)
15
- end
16
-
17
- protected
18
-
19
- # map of region ID to region instance
20
- def regions
21
- @regions ||= {}
22
- end
23
-
24
- def load_region(code)
25
- path = File.join("#{__dir__}/../../../data/tax", "#{code}.json")
26
- msg = "region 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