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
data/lib/gobl/enum.rb CHANGED
@@ -3,79 +3,21 @@
3
3
  module GOBL
4
4
  # Base class for single value structures in the GOBL schema that have a controlled set
5
5
  # of values associated to them (i.e., an enumeration) that may constrain them
6
- class Enum < Value
7
- # Returns an enum value object that corresponds to a given value. The value can be a
8
- # `Symbol`, a `String` or anything coercible into one (via `#to_s`)
9
- #
10
- # @param value [Symbol, String, #to_s] the value of the object
11
- #
12
- # @return [Enum] the enum value instance corresponding to the given value
13
- def initialize(value)
14
- if value.is_a? Symbol
15
- self._value = value_from_sym(value) || value.to_s
16
- else
17
- super
18
- end
19
- end
20
-
21
- # Returns the description of the current enum value
22
- #
23
- # @return [String] the description of the current enum value
24
- def description
25
- self.class::ENUM.fetch(_value, _value)
26
- end
27
-
28
- # Enables dynamic value inquirers for each of the declared enum values. Each inquirer
29
- # returns a `Boolean` denoting whether the value equals the enquired value (`true`) or
30
- # not (`false`)
31
- def method_missing(method_name, *args, &block)
32
- if (value = self.class.find_by_inquirer(method_name))
33
- self == value
34
- else
35
- super
36
- end
37
- end
38
-
39
- # @api private
40
- def respond_to_missing?(method_name, include_private = false)
41
- self.class.find_by_inquirer(method_name) || super
42
- end
6
+ module Enum
7
+ def self.included(base)
8
+ base.include ActiveModel::Validations
43
9
 
44
- class << self
45
- # Returns an array with all the enumerated objects of this type
46
- #
47
- # @return [Array<#{name}>] the array of enumerated objects
48
- def all
49
- self::ENUM.keys.map { |key| new(key) }
10
+ base.class_eval do
11
+ validate :valid_enum_value, if: :strict_enum?
50
12
  end
51
-
52
- # @api private
53
- def find_by_sym(sym)
54
- all.find { |object| object.to_sym == sym }
55
- end
56
-
57
- # @api private
58
- def find_by_inquirer(method_name)
59
- method_name =~ /(.+)\?$/ && find_by_sym(Regexp.last_match(1).to_sym)
60
- end
61
- end
62
-
63
- private
64
-
65
- def _value=(value)
66
- if strict_enum? && !self.class::ENUM.key?(value)
67
- raise TypeError, "\"#{value}\" is not within the valid values of the enumeration"
68
- end
69
-
70
- super
71
13
  end
72
14
 
73
- def strict_enum?
74
- false
15
+ def description
16
+ self.class::ENUM.fetch(self, self)
75
17
  end
76
18
 
77
- def value_from_sym(sym)
78
- self.class.find_by_sym(sym)&.to_s
19
+ def valid_enum_value
20
+ errors.add(:base, "Value \"#{self}\" is not within the allowed values of the enumeration") unless self.class::ENUM.key?(self)
79
21
  end
80
22
  end
81
23
  end
data/lib/gobl/envelope.rb CHANGED
@@ -3,11 +3,11 @@
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
- # Envelope wraps around a gobl document and provides support for digest creation and digital signatures.
10
+ # Envelope wraps around a document adding headers and digital signatures.
11
11
  class Envelope < GOBL::Object
12
12
  # The Schema ID of the GOBL Envelope structure
13
13
  SCHEMA_ID = 'https://gobl.org/draft-0/envelope'
@@ -16,19 +16,19 @@ module GOBL
16
16
  # Schema identifies the schema that should be used to understand this document
17
17
  # @return [String]
18
18
  property :$schema, String
19
- validates :$schema, presence: true
19
+ validates_presence_of :$schema
20
20
 
21
21
  # @!attribute [r] head
22
22
  # Details on what the contents are
23
23
  # @return [Header]
24
24
  property :head, Header
25
- validates :head, presence: true
25
+ validates_presence_of :head
26
26
 
27
27
  # @!attribute [r] doc
28
28
  # The data inside the envelope
29
29
  # @return [Document]
30
30
  property :doc, Document
31
- validates :doc, presence: true
31
+ validates_presence_of :doc
32
32
 
33
33
  # @!attribute [r] sigs
34
34
  # JSON Web Signatures of the header
data/lib/gobl/header.rb CHANGED
@@ -3,11 +3,11 @@
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
- # Header defines the meta data of the body.
10
+ # Header defines the metadata of the body.
11
11
  class Header < GOBL::Object
12
12
  # The Schema ID of the GOBL Header structure
13
13
  SCHEMA_ID = 'https://gobl.org/draft-0/envelope#/$defs/Header'
@@ -16,13 +16,13 @@ module GOBL
16
16
  # Unique UUIDv1 identifier for the envelope.
17
17
  # @return [GOBL::UUID::UUID]
18
18
  property :uuid, GOBL::UUID::UUID
19
- validates :uuid, presence: true
19
+ validates_presence_of :uuid
20
20
 
21
21
  # @!attribute [r] dig
22
22
  # Digest of the canonical JSON body.
23
23
  # @return [GOBL::DSig::Digest]
24
24
  property :dig, GOBL::DSig::Digest
25
- validates :dig, presence: true
25
+ validates_presence_of :dig
26
26
 
27
27
  # @!attribute [r] stamps
28
28
  # Seals of approval from other organisations.
@@ -3,7 +3,7 @@
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
@@ -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 L10n
11
11
  # Code is used for short identifies like country or state codes.
12
- class Code < GOBL::Value
12
+ class Code < String
13
13
  # The Schema ID of the GOBL Code structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/l10n/code'
15
15
  end
@@ -3,17 +3,18 @@
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 L10n
11
11
  # Defines an ISO 3166-2 country code
12
- class CountryCode < GOBL::Enum
12
+ class CountryCode < String
13
13
  # The Schema ID of the GOBL CountryCode structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/l10n/country-code'
15
15
 
16
- # The enumeration of values of the object and their descriptions (Values different to these are not allowed)
16
+ include GOBL::Enum
17
+
17
18
  ENUM = {
18
19
  'AF' => 'Afghanistan',
19
20
  'AX' => 'Åland Islands',
@@ -3,12 +3,12 @@
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 Note
11
- # Message represents the minimum possible contents for a GoBL document type.
11
+ # Message represents a simple message object with a title and some content meant.
12
12
  class Message < GOBL::Object
13
13
  # The Schema ID of the GOBL Message structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/note/message'
@@ -19,10 +19,10 @@ module GOBL
19
19
  property :title, String
20
20
 
21
21
  # @!attribute [r] content
22
- # Details of what exactly this message wants to communicate
22
+ # Details of what exactly this message wants to communicate.
23
23
  # @return [String]
24
24
  property :content, String
25
- validates :content, presence: true
25
+ validates_presence_of :content
26
26
 
27
27
  # @!attribute [r] meta
28
28
  # Any additional semi-structured data that might be useful.
@@ -3,7 +3,7 @@
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
@@ -62,7 +62,7 @@ module GOBL
62
62
  # Village, town, district, or city, typically inside a region.
63
63
  # @return [String]
64
64
  property :locality, String
65
- validates :locality, presence: true
65
+ validates_presence_of :locality
66
66
 
67
67
  # @!attribute [r] region
68
68
  # Province, county, or state, inside a country.
@@ -3,7 +3,7 @@
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
@@ -3,7 +3,7 @@
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
@@ -27,7 +27,7 @@ module GOBL
27
27
  # Electronic mailing address.
28
28
  # @return [String]
29
29
  property :addr, String
30
- validates :addr, presence: true
30
+ validates_presence_of :addr
31
31
 
32
32
  # @!attribute [r] meta
33
33
  # Additional fields.
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## DO NOT EDIT - This file was generated automatically.
5
+ ##
6
+ ## Generated with GOBL v0.38.0
7
+ ##
8
+
9
+ module GOBL
10
+ module Org
11
+ # Identity is used to define a code for a specific context.
12
+ class Identity < GOBL::Object
13
+ # The Schema ID of the GOBL Identity structure
14
+ SCHEMA_ID = 'https://gobl.org/draft-0/org/identity'
15
+
16
+ # @!attribute [r] uuid
17
+ # Unique identity for this identity object.
18
+ # @return [GOBL::UUID::UUID]
19
+ property :uuid, GOBL::UUID::UUID
20
+
21
+ # @!attribute [r] label
22
+ # Optional label useful for non-standard identities to give a bit more context.
23
+ # @return [String]
24
+ property :label, String
25
+
26
+ # @!attribute [r] type
27
+ # The type of Code being represented and usually specific for a particular context, country, or tax regime.
28
+ # @return [GOBL::CBC::Code]
29
+ property :type, GOBL::CBC::Code
30
+
31
+ # @!attribute [r] code
32
+ # The actual value of the identity code.
33
+ # @return [GOBL::CBC::Code]
34
+ property :code, GOBL::CBC::Code
35
+ validates_presence_of :code
36
+ end
37
+ end
38
+ end
@@ -3,7 +3,7 @@
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
@@ -3,7 +3,7 @@
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
@@ -22,7 +22,7 @@ module GOBL
22
22
  # Type of inbox being defined.
23
23
  # @return [GOBL::CBC::Key]
24
24
  property :key, GOBL::CBC::Key
25
- validates :key, presence: true
25
+ validates_presence_of :key
26
26
 
27
27
  # @!attribute [r] role
28
28
  # Role assigned to this inbox that may be relevant for the consumer.
@@ -38,7 +38,7 @@ module GOBL
38
38
  # Actual Code or ID that identifies the Inbox.
39
39
  # @return [String]
40
40
  property :code, String
41
- validates :code, presence: true
41
+ validates_presence_of :code
42
42
  end
43
43
  end
44
44
  end
data/lib/gobl/org/item.rb CHANGED
@@ -3,7 +3,7 @@
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
@@ -14,12 +14,12 @@ module GOBL
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/org/item'
15
15
 
16
16
  # @!attribute [r] uuid
17
- # Unique identify of this item independent of the Supplier IDs
17
+ # Unique identity of this item
18
18
  # @return [GOBL::UUID::UUID]
19
19
  property :uuid, GOBL::UUID::UUID
20
20
 
21
21
  # @!attribute [r] ref
22
- # Primary reference code that identifies this item. Additional codes can be provided in the 'codes' field.
22
+ # Primary reference code that identifies this item. Additional codes can be provided in the 'identities' property.
23
23
  # @return [String]
24
24
  property :ref, String
25
25
 
@@ -27,7 +27,12 @@ module GOBL
27
27
  # Brief name of the item
28
28
  # @return [String]
29
29
  property :name, String
30
- validates :name, presence: true
30
+ validates_presence_of :name
31
+
32
+ # @!attribute [r] identities
33
+ # List of additional codes, IDs, or SKUs which can be used to identify the item. They should be agreed upon between supplier and customer.
34
+ # @return [Array<GOBL::Org::Identity>]
35
+ property :identities, [GOBL::Org::Identity]
31
36
 
32
37
  # @!attribute [r] desc
33
38
  # Detailed description
@@ -43,18 +48,13 @@ module GOBL
43
48
  # Base price of a single unit to be sold.
44
49
  # @return [GOBL::Num::Amount]
45
50
  property :price, GOBL::Num::Amount
46
- validates :price, presence: true
51
+ validates_presence_of :price
47
52
 
48
53
  # @!attribute [r] unit
49
54
  # Unit of measure.
50
55
  # @return [GOBL::Org::Unit]
51
56
  property :unit, GOBL::Org::Unit
52
57
 
53
- # @!attribute [r] codes
54
- # List of additional codes, IDs, or SKUs which can be used to identify the item. The should be agreed upon between supplier and customer.
55
- # @return [Array<ItemCode>]
56
- property :codes, [ItemCode]
57
-
58
58
  # @!attribute [r] origin
59
59
  # Country code of where this item was from originally.
60
60
  # @return [GOBL::L10n::CountryCode]
data/lib/gobl/org/name.rb CHANGED
@@ -3,7 +3,7 @@
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
@@ -32,7 +32,7 @@ module GOBL
32
32
  # Person's given or first name
33
33
  # @return [String]
34
34
  property :given, String
35
- validates :given, presence: true
35
+ validates_presence_of :given
36
36
 
37
37
  # @!attribute [r] middle
38
38
  # Middle names or initials
@@ -43,7 +43,7 @@ module GOBL
43
43
  # Second or Family name.
44
44
  # @return [String]
45
45
  property :surname, String
46
- validates :surname, presence: true
46
+ validates_presence_of :surname
47
47
 
48
48
  # @!attribute [r] surname2
49
49
  # Additional second of family name.
@@ -3,7 +3,7 @@
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
@@ -13,11 +13,6 @@ module GOBL
13
13
  # The Schema ID of the GOBL Party structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/org/party'
15
15
 
16
- # @!attribute [r] id
17
- # Internal ID used to identify the party inside a document.
18
- # @return [String]
19
- property :id, String
20
-
21
16
  # @!attribute [r] uuid
22
17
  # Unique identity code
23
18
  # @return [GOBL::UUID::UUID]
@@ -28,11 +23,16 @@ module GOBL
28
23
  # @return [GOBL::Tax::Identity]
29
24
  property :tax_id, GOBL::Tax::Identity
30
25
 
26
+ # @!attribute [r] identities
27
+ # Set of codes used to identify the party in other systems.
28
+ # @return [Array<GOBL::Org::Identity>]
29
+ property :identities, [GOBL::Org::Identity]
30
+
31
31
  # @!attribute [r] name
32
32
  # Legal name or representation of the organization.
33
33
  # @return [String]
34
34
  property :name, String
35
- validates :name, presence: true
35
+ validates_presence_of :name
36
36
 
37
37
  # @!attribute [r] alias
38
38
  # Alternate short name.
@@ -3,7 +3,7 @@
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
@@ -13,11 +13,6 @@ module GOBL
13
13
  # The Schema ID of the GOBL Person structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/org/person'
15
15
 
16
- # @!attribute [r] id
17
- # Internal ID used to identify the person inside a document.
18
- # @return [String]
19
- property :id, String
20
-
21
16
  # @!attribute [r] uuid
22
17
  # Unique identity code
23
18
  # @return [GOBL::UUID::UUID]
@@ -27,7 +22,7 @@ module GOBL
27
22
  # Complete details on the name of the person
28
23
  # @return [GOBL::Org::Name]
29
24
  property :name, GOBL::Org::Name
30
- validates :name, presence: true
25
+ validates_presence_of :name
31
26
 
32
27
  # @!attribute [r] role
33
28
  # What they do within an organization
@@ -3,7 +3,7 @@
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
@@ -3,7 +3,7 @@
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
@@ -27,7 +27,7 @@ module GOBL
27
27
  # The number to be dialed in ITU E.164 international format.
28
28
  # @return [String]
29
29
  property :num, String
30
- validates :num, presence: true
30
+ validates_presence_of :num
31
31
  end
32
32
  end
33
33
  end
data/lib/gobl/org/unit.rb CHANGED
@@ -3,17 +3,18 @@
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 Org
11
11
  # Unit describes how the quantity of the product should be interpreted.
12
- class Unit < GOBL::Enum
12
+ class Unit < String
13
13
  # The Schema ID of the GOBL Unit structure
14
14
  SCHEMA_ID = 'https://gobl.org/draft-0/org/unit'
15
15
 
16
- # The enumeration of values of the object and their descriptions (Values different to these are also allowed)
16
+ include GOBL::Enum
17
+
17
18
  ENUM = {
18
19
  'g' => 'Metric grams',
19
20
  'kg' => 'Metric kilograms',
@@ -64,6 +65,10 @@ module GOBL
64
65
  'sheet' => 'Sheets',
65
66
  'envelope' => 'Envelopes'
66
67
  }.freeze
68
+
69
+ def strict_enum?
70
+ false
71
+ end
67
72
  end
68
73
  end
69
74
  end
@@ -3,7 +3,7 @@
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
@@ -32,7 +32,7 @@ module GOBL
32
32
  # URL for the website.
33
33
  # @return [String]
34
34
  property :url, String
35
- validates :url, presence: true
35
+ validates_presence_of :url
36
36
  end
37
37
  end
38
38
  end
@@ -3,7 +3,7 @@
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
@@ -37,7 +37,7 @@ module GOBL
37
37
  # Details about the advance.
38
38
  # @return [String]
39
39
  property :desc, String
40
- validates :desc, presence: true
40
+ validates_presence_of :desc
41
41
 
42
42
  # @!attribute [r] percent
43
43
  # How much as a percentage of the total with tax was paid
@@ -48,7 +48,7 @@ module GOBL
48
48
  # How much was paid.
49
49
  # @return [GOBL::Num::Amount]
50
50
  property :amount, GOBL::Num::Amount
51
- validates :amount, presence: true
51
+ validates_presence_of :amount
52
52
 
53
53
  # @!attribute [r] currency
54
54
  # If different from the parent document's base currency.
data/lib/gobl/pay/card.rb CHANGED
@@ -3,7 +3,7 @@
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
@@ -17,13 +17,13 @@ module GOBL
17
17
  # Last 4 digits of the card's Primary Account Number (PAN).
18
18
  # @return [String]
19
19
  property :last4, String
20
- validates :last4, presence: true
20
+ validates_presence_of :last4
21
21
 
22
22
  # @!attribute [r] holder
23
23
  # Name of the person whom the card belongs to.
24
24
  # @return [String]
25
25
  property :holder, String
26
- validates :holder, presence: true
26
+ validates_presence_of :holder
27
27
  end
28
28
  end
29
29
  end
@@ -3,7 +3,7 @@
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
@@ -3,7 +3,7 @@
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