gobl 0.8.0 → 0.10.0

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/data/regimes/co.json +55 -1
  3. data/data/regimes/es.json +570 -64
  4. data/data/regimes/it.json +1182 -0
  5. data/lib/gobl/bill/charge.rb +1 -1
  6. data/lib/gobl/bill/delivery.rb +1 -1
  7. data/lib/gobl/bill/discount.rb +1 -1
  8. data/lib/gobl/bill/document_reference.rb +1 -1
  9. data/lib/gobl/bill/invoice.rb +19 -8
  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 +3 -3
  15. data/lib/gobl/bill/payment.rb +1 -1
  16. data/lib/gobl/bill/preceding.rb +23 -23
  17. data/lib/gobl/bill/tax.rb +4 -4
  18. data/lib/gobl/bill/totals.rb +5 -5
  19. data/lib/gobl/cal/date.rb +2 -2
  20. data/lib/gobl/cal/period.rb +3 -3
  21. data/lib/gobl/cbc/code.rb +3 -3
  22. data/lib/gobl/cbc/key.rb +2 -2
  23. data/lib/gobl/cbc/meta.rb +1 -1
  24. data/lib/gobl/cbc/note.rb +6 -6
  25. data/lib/gobl/cbc/stamp.rb +3 -3
  26. data/lib/gobl/currency/code.rb +4 -3
  27. data/lib/gobl/currency/exchange_rate.rb +3 -3
  28. data/lib/gobl/document.rb +5 -2
  29. data/lib/gobl/dsig/digest.rb +3 -3
  30. data/lib/gobl/dsig/signature.rb +2 -2
  31. data/lib/gobl/enum.rb +9 -67
  32. data/lib/gobl/envelope.rb +5 -5
  33. data/lib/gobl/header.rb +4 -4
  34. data/lib/gobl/i18n/string.rb +1 -1
  35. data/lib/gobl/l10n/code.rb +2 -2
  36. data/lib/gobl/l10n/country_code.rb +4 -3
  37. data/lib/gobl/note/message.rb +4 -4
  38. data/lib/gobl/org/address.rb +2 -2
  39. data/lib/gobl/org/coordinates.rb +1 -1
  40. data/lib/gobl/org/email.rb +2 -2
  41. data/lib/gobl/org/identity.rb +38 -0
  42. data/lib/gobl/org/image.rb +1 -1
  43. data/lib/gobl/org/inbox.rb +3 -3
  44. data/lib/gobl/org/item.rb +10 -10
  45. data/lib/gobl/org/name.rb +3 -3
  46. data/lib/gobl/org/party.rb +7 -7
  47. data/lib/gobl/org/person.rb +2 -7
  48. data/lib/gobl/org/registration.rb +1 -1
  49. data/lib/gobl/org/telephone.rb +2 -2
  50. data/lib/gobl/org/unit.rb +8 -3
  51. data/lib/gobl/org/website.rb +2 -2
  52. data/lib/gobl/pay/advance.rb +3 -3
  53. data/lib/gobl/pay/card.rb +3 -3
  54. data/lib/gobl/pay/credit_transfer.rb +1 -1
  55. data/lib/gobl/pay/direct_debit.rb +1 -1
  56. data/lib/gobl/pay/due_date.rb +3 -3
  57. data/lib/gobl/pay/instructions.rb +19 -4
  58. data/lib/gobl/pay/online.rb +2 -2
  59. data/lib/gobl/pay/terms.rb +19 -4
  60. data/lib/gobl/tax/category.rb +14 -4
  61. data/lib/gobl/tax/category_total.rb +5 -5
  62. data/lib/gobl/tax/combo.rb +7 -2
  63. data/lib/gobl/tax/identity.rb +16 -6
  64. data/lib/gobl/tax/key_definition.rb +38 -0
  65. data/lib/gobl/tax/preceding_definitions.rb +27 -0
  66. data/lib/gobl/tax/rate.rb +11 -4
  67. data/lib/gobl/tax/rate_total.rb +4 -4
  68. data/lib/gobl/tax/rate_total_surcharge.rb +3 -3
  69. data/lib/gobl/tax/rate_value.rb +2 -2
  70. data/lib/gobl/tax/regime.rb +19 -9
  71. data/lib/gobl/tax/scenario.rb +37 -0
  72. data/lib/gobl/tax/scenario_set.rb +29 -0
  73. data/lib/gobl/tax/set.rb +1 -1
  74. data/lib/gobl/tax/tag.rb +33 -0
  75. data/lib/gobl/tax/total.rb +2 -2
  76. data/lib/gobl/tax/zone.rb +2 -2
  77. data/lib/gobl/uuid/uuid.rb +2 -2
  78. data/lib/gobl/version.rb +1 -1
  79. metadata +10 -11
  80. data/lib/gobl/bill/invoice_type.rb +0 -32
  81. data/lib/gobl/cbc/note_key.rb +0 -50
  82. data/lib/gobl/org/item_code.rb +0 -28
  83. data/lib/gobl/pay/method_key.rb +0 -32
  84. data/lib/gobl/pay/term_key.rb +0 -35
  85. data/lib/gobl/tax/scheme.rb +0 -44
  86. data/lib/gobl/tax/source_key.rb +0 -30
  87. data/lib/gobl/value.rb +0 -77
@@ -3,13 +3,13 @@
3
3
  ##
4
4
  ## DO NOT EDIT - This file was generated automatically.
5
5
  ##
6
- ## Generated with GOBL v0.36.0
6
+ ## Generated with GOBL v0.38.0
7
7
  ##
8
8
 
9
9
  module GOBL
10
10
  module UUID
11
11
  # Universally Unique Identifier. We only recommend using versions 1 and 4 within GOBL.
12
- class UUID < GOBL::Value
12
+ class UUID < String
13
13
  # The Schema ID of the GOBL UUID structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/uuid/uuid'
15
15
  end
data/lib/gobl/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GOBL
4
- VERSION = '0.8.0'
4
+ VERSION = '0.10.0'
5
5
  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.8.0
4
+ version: 0.10.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: 2023-02-10 00:00:00.000000000 Z
13
+ date: 2023-03-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -65,6 +65,7 @@ files:
65
65
  - data/regimes/es.json
66
66
  - data/regimes/fr.json
67
67
  - data/regimes/gb.json
68
+ - data/regimes/it.json
68
69
  - data/regimes/nl.json
69
70
  - data/regimes/pt.json
70
71
  - lib/gobl.rb
@@ -73,7 +74,6 @@ files:
73
74
  - lib/gobl/bill/discount.rb
74
75
  - lib/gobl/bill/document_reference.rb
75
76
  - lib/gobl/bill/invoice.rb
76
- - lib/gobl/bill/invoice_type.rb
77
77
  - lib/gobl/bill/line.rb
78
78
  - lib/gobl/bill/line_charge.rb
79
79
  - lib/gobl/bill/line_discount.rb
@@ -89,7 +89,6 @@ files:
89
89
  - lib/gobl/cbc/key.rb
90
90
  - lib/gobl/cbc/meta.rb
91
91
  - lib/gobl/cbc/note.rb
92
- - lib/gobl/cbc/note_key.rb
93
92
  - lib/gobl/cbc/stamp.rb
94
93
  - lib/gobl/config.rb
95
94
  - lib/gobl/currency/code.rb
@@ -119,10 +118,10 @@ files:
119
118
  - lib/gobl/org/address.rb
120
119
  - lib/gobl/org/coordinates.rb
121
120
  - lib/gobl/org/email.rb
121
+ - lib/gobl/org/identity.rb
122
122
  - lib/gobl/org/image.rb
123
123
  - lib/gobl/org/inbox.rb
124
124
  - lib/gobl/org/item.rb
125
- - lib/gobl/org/item_code.rb
126
125
  - lib/gobl/org/name.rb
127
126
  - lib/gobl/org/party.rb
128
127
  - lib/gobl/org/person.rb
@@ -136,27 +135,27 @@ files:
136
135
  - lib/gobl/pay/direct_debit.rb
137
136
  - lib/gobl/pay/due_date.rb
138
137
  - lib/gobl/pay/instructions.rb
139
- - lib/gobl/pay/method_key.rb
140
138
  - lib/gobl/pay/online.rb
141
- - lib/gobl/pay/term_key.rb
142
139
  - lib/gobl/pay/terms.rb
143
140
  - lib/gobl/struct.rb
144
141
  - lib/gobl/tax/category.rb
145
142
  - lib/gobl/tax/category_total.rb
146
143
  - lib/gobl/tax/combo.rb
147
144
  - lib/gobl/tax/identity.rb
145
+ - lib/gobl/tax/key_definition.rb
146
+ - lib/gobl/tax/preceding_definitions.rb
148
147
  - lib/gobl/tax/rate.rb
149
148
  - lib/gobl/tax/rate_total.rb
150
149
  - lib/gobl/tax/rate_total_surcharge.rb
151
150
  - lib/gobl/tax/rate_value.rb
152
151
  - lib/gobl/tax/regime.rb
153
- - lib/gobl/tax/scheme.rb
152
+ - lib/gobl/tax/scenario.rb
153
+ - lib/gobl/tax/scenario_set.rb
154
154
  - lib/gobl/tax/set.rb
155
- - lib/gobl/tax/source_key.rb
155
+ - lib/gobl/tax/tag.rb
156
156
  - lib/gobl/tax/total.rb
157
157
  - lib/gobl/tax/zone.rb
158
158
  - lib/gobl/uuid/uuid.rb
159
- - lib/gobl/value.rb
160
159
  - lib/gobl/version.rb
161
160
  homepage: https://github.com/invopop/gobl.ruby
162
161
  licenses:
@@ -178,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
177
  - !ruby/object:Gem::Version
179
178
  version: 3.1.4
180
179
  requirements: []
181
- rubygems_version: 3.4.1
180
+ rubygems_version: 3.4.6
182
181
  signing_key:
183
182
  specification_version: 4
184
183
  summary: Minimalist ruby version of the GOBL library
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module Bill
11
- # Defines an invoice type according to a subset of the UNTDID 1001 standard list.
12
- class InvoiceType < GOBL::Enum
13
- # The Schema ID of the GOBL InvoiceType structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/bill/invoice#/$defs/InvoiceType'
15
-
16
- # The enumeration of values of the object and their descriptions (Values different to these are not allowed)
17
- ENUM = {
18
- 'proforma' => 'Proforma invoice, for a clients validation before sending a final invoice.',
19
- 'simplified' => 'Simplified invoice or receipt typically used for small transactions that dont require customer details.t require customer details.',
20
- 'partial' => 'Partial invoice',
21
- 'commercial' => 'Commercial invoice, usually cross-border transactions requiring an invoice for customs.',
22
- 'corrected' => 'Corrected invoice',
23
- 'credit-note' => 'Credit note',
24
- 'self-billed' => 'Self billed invoice'
25
- }.freeze
26
-
27
- def strict_enum?
28
- true
29
- end
30
- end
31
- end
32
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module CBC
11
- # NoteKey identifies the type of note being edited
12
- class NoteKey < GOBL::Enum
13
- # The Schema ID of the GOBL NoteKey structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/cbc/note#/$defs/NoteKey'
15
-
16
- # The enumeration of values of the object and their descriptions (Values different to these are not allowed)
17
- ENUM = {
18
- 'goods' => 'Goods Description',
19
- 'payment' => 'Terms of Payment',
20
- 'legal' => 'Legal or regulatory information',
21
- 'dangerous-goods' => 'Dangerous goods additional information',
22
- 'ack' => 'Acknowledgement Description',
23
- 'rate' => 'Rate additional information',
24
- 'reason' => 'Reason',
25
- 'dispute' => 'Dispute',
26
- 'customer' => 'Customer remarks',
27
- 'glossary' => 'Glossary',
28
- 'customs' => 'Customs declaration information',
29
- 'general' => 'General information',
30
- 'handling' => 'Handling instructions',
31
- 'packaging' => 'Packaging information',
32
- 'loading' => 'Loading instructions',
33
- 'price' => 'Price conditions',
34
- 'priority' => 'Priority information',
35
- 'regulatory' => 'Regulatory information',
36
- 'safety' => 'Safety instructions',
37
- 'ship-line' => 'Ship line',
38
- 'supplier' => 'Supplier remarks',
39
- 'transport' => 'Transportation information',
40
- 'delivery' => 'Delivery information',
41
- 'quarantine' => 'Quarantine information',
42
- 'tax' => 'Tax declaration'
43
- }.freeze
44
-
45
- def strict_enum?
46
- true
47
- end
48
- end
49
- end
50
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module Org
11
- # ItemCode contains a value and optional label property that means additional codes can be added to an item.
12
- class ItemCode < GOBL::Object
13
- # The Schema ID of the GOBL ItemCode structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/org/item#/$defs/ItemCode'
15
-
16
- # @!attribute [r] label
17
- # Local or human reference for the type of code the value represents.
18
- # @return [String]
19
- property :label, String
20
-
21
- # @!attribute [r] value
22
- # The item code's value.
23
- # @return [String]
24
- property :value, String
25
- validates :value, presence: true
26
- end
27
- end
28
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module Pay
11
- # Method Key describes how a payment should be made
12
- class MethodKey < GOBL::Enum
13
- # The Schema ID of the GOBL MethodKey structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/pay/instructions#/$defs/MethodKey'
15
-
16
- # The enumeration of values of the object and their descriptions (Values different to these are not allowed)
17
- ENUM = {
18
- 'any' => 'Any method available, no preference',
19
- 'card' => 'Credit or debit card',
20
- 'credit-transfer' => 'Sender initiated bank or wire transfer',
21
- 'debit-transfer' => 'Receiver initiated bank or wire transfer',
22
- 'cash' => 'Cash',
23
- 'direct-debit' => 'Direct debit',
24
- 'online' => 'Online or web payment'
25
- }.freeze
26
-
27
- def strict_enum?
28
- true
29
- end
30
- end
31
- end
32
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module Pay
11
- # Payment terms key
12
- class TermKey < GOBL::Enum
13
- # The Schema ID of the GOBL TermKey structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/pay/terms#/$defs/TermKey'
15
-
16
- # The enumeration of values of the object and their descriptions (Values different to these are not allowed)
17
- ENUM = {
18
- '' => 'Not yet defined',
19
- 'end-of-month' => 'End of month',
20
- 'due-date' => 'Due on a specific date',
21
- 'deferred' => 'Deferred until after the due date',
22
- 'proximo' => 'Month after the present',
23
- 'instant' => 'On receipt of invoice',
24
- 'elective' => 'Chosen by the buyer',
25
- 'pending' => 'Seller to advise buyer in separate transaction',
26
- 'advance' => 'Payment made in advance',
27
- 'delivery' => 'Payment on Delivery'
28
- }.freeze
29
-
30
- def strict_enum?
31
- true
32
- end
33
- end
34
- end
35
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module Tax
11
- # Scheme contains the definition of a scheme that belongs to a region and can be used to simplify validation processes for document contents.
12
- class Scheme < GOBL::Object
13
- # The Schema ID of the GOBL Scheme structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/tax/regime#/$defs/Scheme'
15
-
16
- # @!attribute [r] key
17
- # Key used to identify this scheme
18
- # @return [GOBL::CBC::Key]
19
- property :key, GOBL::CBC::Key
20
- validates :key, presence: true
21
-
22
- # @!attribute [r] name
23
- # Name of this scheme.
24
- # @return [GOBL::I18n::String]
25
- property :name, GOBL::I18n::String
26
- validates :name, presence: true
27
-
28
- # @!attribute [r] description
29
- # Human details describing what this scheme is used for.
30
- # @return [GOBL::I18n::String]
31
- property :description, GOBL::I18n::String
32
-
33
- # @!attribute [r] categories
34
- # List of tax category codes that can be used when this scheme is applied.
35
- # @return [Array<GOBL::CBC::Code>]
36
- property :categories, [GOBL::CBC::Code]
37
-
38
- # @!attribute [r] note
39
- # Note defines a message that should be added to a document when this scheme is used.
40
- # @return [GOBL::CBC::Note]
41
- property :note, GOBL::CBC::Note
42
- end
43
- end
44
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- ## DO NOT EDIT - This file was generated automatically.
5
- ##
6
- ## Generated with GOBL v0.36.0
7
- ##
8
-
9
- module GOBL
10
- module Tax
11
- # SourceKey identifies the source of a tax identity
12
- class SourceKey < GOBL::Enum
13
- # The Schema ID of the GOBL SourceKey structure
14
- SCHEMA_ID = 'https://gobl.org/draft-0/tax/identity#/$defs/SourceKey'
15
-
16
- # The enumeration of values of the object and their descriptions (Values different to these are not allowed)
17
- ENUM = {
18
- 'tax-agency' => 'Sourced directly from a tax agency',
19
- 'passport' => 'A passport document',
20
- 'national' => 'National ID Card or similar',
21
- 'permit' => 'Residential or similar permit',
22
- 'other' => 'An other type of source not listed'
23
- }.freeze
24
-
25
- def strict_enum?
26
- true
27
- end
28
- end
29
- end
30
- end
data/lib/gobl/value.rb DELETED
@@ -1,77 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GOBL
4
- # Base class for single value structs in the GOBL Schema
5
- class Value < Struct
6
- # Initializes a new value object that corresponds to a given value. The value can be a
7
- # `Symbol`, a `String` or anything coercible into one (via `#to_s`).
8
- #
9
- # @param value [Symbol, String, #to_s] the value of the object.
10
- #
11
- # @return [Value] the value object corresponding to the given value.
12
- def initialize(value)
13
- super()
14
- self._value = value.to_s
15
- end
16
-
17
- # Returns the string representation of the current object
18
- #
19
- # @return [String] the string representation of the current object
20
- def to_s
21
- _value.to_s
22
- end
23
-
24
- # Returns the symbol representation of the current object
25
- #
26
- # @return [Symbol] the symbol representation of the current object
27
- def to_sym
28
- to_s.parameterize.underscore.to_sym
29
- end
30
-
31
- # Returns whether the current value is equal to a given one. In addition to
32
- # objects of the same type, the current object can be compared to a `Symbol`, a
33
- # `String` or anything coercible into one (via `#to_s`)
34
- #
35
- # @param other [Value, Symbol, String, #to_s] the other value to compare with
36
- #
37
- # @return [Boolean] `true` if the values are equal, `false` otherwise
38
- def ==(other)
39
- case other
40
- when self.class
41
- _value == other._value
42
- when Symbol
43
- to_sym == other
44
- else
45
- to_s == other.to_s
46
- end
47
- end
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
-
68
- # @api private
69
- def as_json(...)
70
- _value.as_json(...)
71
- end
72
-
73
- protected
74
-
75
- attr_accessor :_value
76
- end
77
- end