gobl 0.9.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -13
  3. data/data/regimes/co.json +55 -1
  4. data/data/regimes/es.json +570 -64
  5. data/data/regimes/it.json +1182 -0
  6. data/lib/{gobl → generated/gobl}/bill/charge.rb +1 -1
  7. data/lib/{gobl → generated/gobl}/bill/delivery.rb +1 -1
  8. data/lib/{gobl → generated/gobl}/bill/discount.rb +1 -1
  9. data/lib/{gobl → generated/gobl}/bill/document_reference.rb +1 -1
  10. data/lib/{gobl → generated/gobl}/bill/invoice.rb +19 -8
  11. data/lib/{gobl → generated/gobl}/bill/line.rb +3 -3
  12. data/lib/{gobl → generated/gobl}/bill/line_charge.rb +1 -1
  13. data/lib/{gobl → generated/gobl}/bill/line_discount.rb +1 -1
  14. data/lib/{gobl → generated/gobl}/bill/ordering.rb +1 -1
  15. data/lib/{gobl → generated/gobl}/bill/outlay.rb +3 -3
  16. data/lib/{gobl → generated/gobl}/bill/payment.rb +1 -1
  17. data/lib/{gobl → generated/gobl}/bill/preceding.rb +23 -23
  18. data/lib/{gobl → generated/gobl}/bill/tax.rb +4 -4
  19. data/lib/{gobl → generated/gobl}/bill/totals.rb +5 -5
  20. data/lib/{gobl → generated/gobl}/cal/date.rb +2 -2
  21. data/lib/{gobl → generated/gobl}/cal/period.rb +3 -3
  22. data/lib/{gobl → generated/gobl}/cbc/code.rb +3 -3
  23. data/lib/{gobl → generated/gobl}/cbc/key.rb +2 -2
  24. data/lib/{gobl → generated/gobl}/cbc/meta.rb +1 -1
  25. data/lib/{gobl → generated/gobl}/cbc/note.rb +6 -6
  26. data/lib/{gobl → generated/gobl}/cbc/stamp.rb +3 -3
  27. data/lib/{gobl → generated/gobl}/currency/code.rb +7 -4
  28. data/lib/{gobl → generated/gobl}/currency/exchange_rate.rb +3 -3
  29. data/lib/generated/gobl/document.rb +16 -0
  30. data/lib/{gobl → generated/gobl}/dsig/digest.rb +3 -3
  31. data/lib/{gobl → generated/gobl}/dsig/signature.rb +2 -2
  32. data/lib/{gobl → generated/gobl}/envelope.rb +5 -5
  33. data/lib/{gobl → generated/gobl}/header.rb +4 -4
  34. data/lib/{gobl → generated/gobl}/i18n/string.rb +1 -1
  35. data/lib/{gobl → generated/gobl}/l10n/code.rb +2 -2
  36. data/lib/{gobl → generated/gobl}/l10n/country_code.rb +7 -4
  37. data/lib/{gobl → generated/gobl}/note/message.rb +4 -4
  38. data/lib/{gobl → generated/gobl}/org/address.rb +2 -2
  39. data/lib/{gobl → generated/gobl}/org/coordinates.rb +1 -1
  40. data/lib/{gobl → generated/gobl}/org/email.rb +2 -2
  41. data/lib/generated/gobl/org/identity.rb +38 -0
  42. data/lib/{gobl → generated/gobl}/org/image.rb +1 -1
  43. data/lib/{gobl → generated/gobl}/org/inbox.rb +3 -3
  44. data/lib/{gobl → generated/gobl}/org/item.rb +10 -10
  45. data/lib/{gobl → generated/gobl}/org/name.rb +3 -3
  46. data/lib/{gobl → generated/gobl}/org/party.rb +7 -7
  47. data/lib/{gobl → generated/gobl}/org/person.rb +2 -7
  48. data/lib/{gobl → generated/gobl}/org/registration.rb +1 -1
  49. data/lib/{gobl → generated/gobl}/org/telephone.rb +2 -2
  50. data/lib/{gobl → generated/gobl}/org/unit.rb +8 -3
  51. data/lib/{gobl → generated/gobl}/org/website.rb +2 -2
  52. data/lib/{gobl → generated/gobl}/pay/advance.rb +3 -3
  53. data/lib/{gobl → generated/gobl}/pay/card.rb +3 -3
  54. data/lib/{gobl → generated/gobl}/pay/credit_transfer.rb +1 -1
  55. data/lib/{gobl → generated/gobl}/pay/direct_debit.rb +1 -1
  56. data/lib/{gobl → generated/gobl}/pay/due_date.rb +3 -3
  57. data/lib/{gobl → generated/gobl}/pay/instructions.rb +19 -4
  58. data/lib/{gobl → generated/gobl}/pay/online.rb +2 -2
  59. data/lib/{gobl → generated/gobl}/pay/terms.rb +19 -4
  60. data/lib/{gobl → generated/gobl}/tax/category.rb +14 -4
  61. data/lib/{gobl → generated/gobl}/tax/category_total.rb +5 -5
  62. data/lib/{gobl → generated/gobl}/tax/combo.rb +7 -2
  63. data/lib/{gobl → generated/gobl}/tax/identity.rb +16 -6
  64. data/lib/generated/gobl/tax/key_definition.rb +38 -0
  65. data/lib/generated/gobl/tax/preceding_definitions.rb +27 -0
  66. data/lib/{gobl → generated/gobl}/tax/rate.rb +11 -4
  67. data/lib/{gobl → generated/gobl}/tax/rate_total.rb +4 -4
  68. data/lib/{gobl → generated/gobl}/tax/rate_total_surcharge.rb +3 -3
  69. data/lib/{gobl → generated/gobl}/tax/rate_value.rb +2 -2
  70. data/lib/{gobl → generated/gobl}/tax/regime.rb +19 -9
  71. data/lib/generated/gobl/tax/scenario.rb +37 -0
  72. data/lib/generated/gobl/tax/scenario_set.rb +29 -0
  73. data/lib/{gobl → generated/gobl}/tax/set.rb +1 -1
  74. data/lib/generated/gobl/tax/tag.rb +33 -0
  75. data/lib/{gobl → generated/gobl}/tax/total.rb +2 -2
  76. data/lib/{gobl → generated/gobl}/tax/zone.rb +2 -2
  77. data/lib/{gobl → generated/gobl}/uuid/uuid.rb +2 -2
  78. data/lib/gobl/enum.rb +8 -56
  79. data/lib/gobl/version.rb +1 -1
  80. data/lib/gobl.rb +1 -0
  81. metadata +75 -76
  82. data/lib/gobl/bill/invoice_type.rb +0 -30
  83. data/lib/gobl/cbc/note_key.rb +0 -48
  84. data/lib/gobl/document.rb +0 -13
  85. data/lib/gobl/org/item_code.rb +0 -28
  86. data/lib/gobl/pay/method_key.rb +0 -30
  87. data/lib/gobl/pay/term_key.rb +0 -33
  88. data/lib/gobl/tax/scheme.rb +0 -44
  89. data/lib/gobl/tax/source_key.rb +0 -28
  90. data/lib/gobl/value.rb +0 -77
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.9.0
4
+ version: 0.10.1
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-03-07 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,98 +65,97 @@ 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
71
+ - lib/generated/gobl/bill/charge.rb
72
+ - lib/generated/gobl/bill/delivery.rb
73
+ - lib/generated/gobl/bill/discount.rb
74
+ - lib/generated/gobl/bill/document_reference.rb
75
+ - lib/generated/gobl/bill/invoice.rb
76
+ - lib/generated/gobl/bill/line.rb
77
+ - lib/generated/gobl/bill/line_charge.rb
78
+ - lib/generated/gobl/bill/line_discount.rb
79
+ - lib/generated/gobl/bill/ordering.rb
80
+ - lib/generated/gobl/bill/outlay.rb
81
+ - lib/generated/gobl/bill/payment.rb
82
+ - lib/generated/gobl/bill/preceding.rb
83
+ - lib/generated/gobl/bill/tax.rb
84
+ - lib/generated/gobl/bill/totals.rb
85
+ - lib/generated/gobl/cal/date.rb
86
+ - lib/generated/gobl/cal/period.rb
87
+ - lib/generated/gobl/cbc/code.rb
88
+ - lib/generated/gobl/cbc/key.rb
89
+ - lib/generated/gobl/cbc/meta.rb
90
+ - lib/generated/gobl/cbc/note.rb
91
+ - lib/generated/gobl/cbc/stamp.rb
92
+ - lib/generated/gobl/currency/code.rb
93
+ - lib/generated/gobl/currency/exchange_rate.rb
94
+ - lib/generated/gobl/document.rb
95
+ - lib/generated/gobl/dsig/digest.rb
96
+ - lib/generated/gobl/dsig/signature.rb
97
+ - lib/generated/gobl/envelope.rb
98
+ - lib/generated/gobl/header.rb
99
+ - lib/generated/gobl/i18n/string.rb
100
+ - lib/generated/gobl/l10n/code.rb
101
+ - lib/generated/gobl/l10n/country_code.rb
102
+ - lib/generated/gobl/note/message.rb
103
+ - lib/generated/gobl/org/address.rb
104
+ - lib/generated/gobl/org/coordinates.rb
105
+ - lib/generated/gobl/org/email.rb
106
+ - lib/generated/gobl/org/identity.rb
107
+ - lib/generated/gobl/org/image.rb
108
+ - lib/generated/gobl/org/inbox.rb
109
+ - lib/generated/gobl/org/item.rb
110
+ - lib/generated/gobl/org/name.rb
111
+ - lib/generated/gobl/org/party.rb
112
+ - lib/generated/gobl/org/person.rb
113
+ - lib/generated/gobl/org/registration.rb
114
+ - lib/generated/gobl/org/telephone.rb
115
+ - lib/generated/gobl/org/unit.rb
116
+ - lib/generated/gobl/org/website.rb
117
+ - lib/generated/gobl/pay/advance.rb
118
+ - lib/generated/gobl/pay/card.rb
119
+ - lib/generated/gobl/pay/credit_transfer.rb
120
+ - lib/generated/gobl/pay/direct_debit.rb
121
+ - lib/generated/gobl/pay/due_date.rb
122
+ - lib/generated/gobl/pay/instructions.rb
123
+ - lib/generated/gobl/pay/online.rb
124
+ - lib/generated/gobl/pay/terms.rb
125
+ - lib/generated/gobl/tax/category.rb
126
+ - lib/generated/gobl/tax/category_total.rb
127
+ - lib/generated/gobl/tax/combo.rb
128
+ - lib/generated/gobl/tax/identity.rb
129
+ - lib/generated/gobl/tax/key_definition.rb
130
+ - lib/generated/gobl/tax/preceding_definitions.rb
131
+ - lib/generated/gobl/tax/rate.rb
132
+ - lib/generated/gobl/tax/rate_total.rb
133
+ - lib/generated/gobl/tax/rate_total_surcharge.rb
134
+ - lib/generated/gobl/tax/rate_value.rb
135
+ - lib/generated/gobl/tax/regime.rb
136
+ - lib/generated/gobl/tax/scenario.rb
137
+ - lib/generated/gobl/tax/scenario_set.rb
138
+ - lib/generated/gobl/tax/set.rb
139
+ - lib/generated/gobl/tax/tag.rb
140
+ - lib/generated/gobl/tax/total.rb
141
+ - lib/generated/gobl/tax/zone.rb
142
+ - lib/generated/gobl/uuid/uuid.rb
70
143
  - lib/gobl.rb
71
- - lib/gobl/bill/charge.rb
72
- - lib/gobl/bill/delivery.rb
73
- - lib/gobl/bill/discount.rb
74
- - lib/gobl/bill/document_reference.rb
75
- - lib/gobl/bill/invoice.rb
76
- - lib/gobl/bill/invoice_type.rb
77
- - lib/gobl/bill/line.rb
78
- - lib/gobl/bill/line_charge.rb
79
- - lib/gobl/bill/line_discount.rb
80
- - lib/gobl/bill/ordering.rb
81
- - lib/gobl/bill/outlay.rb
82
- - lib/gobl/bill/payment.rb
83
- - lib/gobl/bill/preceding.rb
84
- - lib/gobl/bill/tax.rb
85
- - lib/gobl/bill/totals.rb
86
- - lib/gobl/cal/date.rb
87
- - lib/gobl/cal/period.rb
88
- - lib/gobl/cbc/code.rb
89
- - lib/gobl/cbc/key.rb
90
- - lib/gobl/cbc/meta.rb
91
- - lib/gobl/cbc/note.rb
92
- - lib/gobl/cbc/note_key.rb
93
- - lib/gobl/cbc/stamp.rb
94
144
  - lib/gobl/config.rb
95
- - lib/gobl/currency/code.rb
96
- - lib/gobl/currency/exchange_rate.rb
97
- - lib/gobl/document.rb
98
- - lib/gobl/dsig/digest.rb
99
- - lib/gobl/dsig/signature.rb
100
145
  - lib/gobl/enum.rb
101
- - lib/gobl/envelope.rb
102
146
  - lib/gobl/extensions/document_helper.rb
103
147
  - lib/gobl/extensions/envelope_helper.rb
104
148
  - lib/gobl/extensions/i18n/value_keys_helper.rb
105
149
  - lib/gobl/extensions/tax/regime_helper.rb
106
- - lib/gobl/header.rb
107
- - lib/gobl/i18n/string.rb
108
150
  - lib/gobl/id.rb
109
- - lib/gobl/l10n/code.rb
110
- - lib/gobl/l10n/country_code.rb
111
151
  - lib/gobl/map.rb
112
- - lib/gobl/note/message.rb
113
152
  - lib/gobl/num/amount.rb
114
153
  - lib/gobl/num/percentage.rb
115
154
  - lib/gobl/object.rb
116
155
  - lib/gobl/operations.rb
117
156
  - lib/gobl/operations/service_error.rb
118
157
  - lib/gobl/operations/validation_result.rb
119
- - lib/gobl/org/address.rb
120
- - lib/gobl/org/coordinates.rb
121
- - lib/gobl/org/email.rb
122
- - lib/gobl/org/image.rb
123
- - lib/gobl/org/inbox.rb
124
- - lib/gobl/org/item.rb
125
- - lib/gobl/org/item_code.rb
126
- - lib/gobl/org/name.rb
127
- - lib/gobl/org/party.rb
128
- - lib/gobl/org/person.rb
129
- - lib/gobl/org/registration.rb
130
- - lib/gobl/org/telephone.rb
131
- - lib/gobl/org/unit.rb
132
- - lib/gobl/org/website.rb
133
- - lib/gobl/pay/advance.rb
134
- - lib/gobl/pay/card.rb
135
- - lib/gobl/pay/credit_transfer.rb
136
- - lib/gobl/pay/direct_debit.rb
137
- - lib/gobl/pay/due_date.rb
138
- - lib/gobl/pay/instructions.rb
139
- - lib/gobl/pay/method_key.rb
140
- - lib/gobl/pay/online.rb
141
- - lib/gobl/pay/term_key.rb
142
- - lib/gobl/pay/terms.rb
143
158
  - lib/gobl/struct.rb
144
- - lib/gobl/tax/category.rb
145
- - lib/gobl/tax/category_total.rb
146
- - lib/gobl/tax/combo.rb
147
- - lib/gobl/tax/identity.rb
148
- - lib/gobl/tax/rate.rb
149
- - lib/gobl/tax/rate_total.rb
150
- - lib/gobl/tax/rate_total_surcharge.rb
151
- - lib/gobl/tax/rate_value.rb
152
- - lib/gobl/tax/regime.rb
153
- - lib/gobl/tax/scheme.rb
154
- - lib/gobl/tax/set.rb
155
- - lib/gobl/tax/source_key.rb
156
- - lib/gobl/tax/total.rb
157
- - lib/gobl/tax/zone.rb
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:
@@ -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 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
- validates_inclusion_of :_value, in: ENUM.keys, message: '"%{value}" is not within the allowed values of the enumeration'
28
- end
29
- end
30
- end
@@ -1,48 +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
- validates_inclusion_of :_value, in: ENUM.keys, message: '"%{value}" is not within the allowed values of the enumeration'
46
- end
47
- end
48
- end
data/lib/gobl/document.rb DELETED
@@ -1,13 +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
- # Contents of the envelope that must contain a $schema.
11
- class Document < GOBL::Map
12
- end
13
- 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,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 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
- validates_inclusion_of :_value, in: ENUM.keys, message: '"%{value}" is not within the allowed values of the enumeration'
28
- end
29
- end
30
- end
@@ -1,33 +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
- validates_inclusion_of :_value, in: ENUM.keys, message: '"%{value}" is not within the allowed values of the enumeration'
31
- end
32
- end
33
- 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,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 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
- validates_inclusion_of :_value, in: ENUM.keys, message: '"%{value}" is not within the allowed values of the enumeration'
26
- end
27
- end
28
- 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