gobl 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gobl/bill/invoice_type.rb +1 -3
- data/lib/gobl/cbc/note_key.rb +1 -3
- data/lib/gobl/currency/code.rb +1 -3
- data/lib/gobl/enum.rb +2 -12
- data/lib/gobl/l10n/country_code.rb +1 -3
- data/lib/gobl/pay/method_key.rb +1 -3
- data/lib/gobl/pay/term_key.rb +1 -3
- data/lib/gobl/tax/source_key.rb +1 -3
- data/lib/gobl/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e14eb326a6bbca1237cdc6782714e9dbcacbe53e3bcb0028e52acefbb83ea5b
|
4
|
+
data.tar.gz: fb366c4ba614d652d14938a7d99f85522db3dc2845b32b611fc78d8bb9761ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2109bb654d767070f4261cd45b85d97bd7e7ebbb9d03ea83b8af5fd61f73434d0e5ebd2d13f35aa368d154d68fef3742116d8b405eec1611bd7799c410bce124
|
7
|
+
data.tar.gz: 63d05794780f7e4a200490b56f1477fb4fb14dc11e4aab0ce2e81358ff58d2f02175318e16f13ea46098edd1f8a045ceefe51de9a5b384913450a09103b5796f
|
data/lib/gobl/cbc/note_key.rb
CHANGED
data/lib/gobl/currency/code.rb
CHANGED
data/lib/gobl/enum.rb
CHANGED
@@ -4,6 +4,8 @@ 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
6
|
class Enum < Value
|
7
|
+
include ActiveModel::Validations
|
8
|
+
|
7
9
|
# Returns an enum value object that corresponds to a given value. The value can be a
|
8
10
|
# `Symbol`, a `String` or anything coercible into one (via `#to_s`)
|
9
11
|
#
|
@@ -62,18 +64,6 @@ module GOBL
|
|
62
64
|
|
63
65
|
private
|
64
66
|
|
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
|
-
end
|
72
|
-
|
73
|
-
def strict_enum?
|
74
|
-
false
|
75
|
-
end
|
76
|
-
|
77
67
|
def value_from_sym(sym)
|
78
68
|
self.class.find_by_sym(sym)&.to_s
|
79
69
|
end
|
data/lib/gobl/pay/method_key.rb
CHANGED
data/lib/gobl/pay/term_key.rb
CHANGED
data/lib/gobl/tax/source_key.rb
CHANGED
@@ -22,9 +22,7 @@ module GOBL
|
|
22
22
|
'other' => 'An other type of source not listed'
|
23
23
|
}.freeze
|
24
24
|
|
25
|
-
|
26
|
-
true
|
27
|
-
end
|
25
|
+
validates_inclusion_of :_value, in: ENUM.keys, message: '"%{value}" is not within the allowed values of the enumeration'
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
data/lib/gobl/version.rb
CHANGED
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.9.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-
|
13
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: 3.1.4
|
180
180
|
requirements: []
|
181
|
-
rubygems_version: 3.4.
|
181
|
+
rubygems_version: 3.4.6
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Minimalist ruby version of the GOBL library
|