easol-canvas 3.2.1 → 3.3.1
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.
- checksums.yaml +4 -4
- data/lib/canvas/validators/schema_attributes/product.rb +25 -3
- data/lib/canvas/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76b5e740ec1e4c86868924b010cbd13101ebd86b46a49bb719ed289bce268e8c
|
4
|
+
data.tar.gz: 5d79fe71368fb9bdd0f76c85803957291f34c9fd66c68904c68a7cbfede36680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbde53fa9c5acbc400c899573b823913e39b732693122925eaa553f6e045bbeba3ad67eac2b20cfec69c9b767259fa3a9b7d947f97e62bf9b34d42ea13d4c8bd
|
7
|
+
data.tar.gz: c7d11808b5dc2b9eb70f8b22b2a89058bd38cb3cde27389a258cc9abcc27c5e3197a1eb2e58d92fc370683b590e59ba79ab5cbc835427b3112f23288b63fe526
|
@@ -7,10 +7,12 @@ module Canvas
|
|
7
7
|
# Attribute validations specific to product-type variables.
|
8
8
|
class Product < Base
|
9
9
|
ALLOWED_DEFAULT_VALUES = %w[random].freeze
|
10
|
+
ALLOWED_RESTRICTIONS = %w[experiences accommodations].freeze
|
10
11
|
|
11
12
|
def validate
|
12
13
|
super &&
|
13
|
-
ensure_default_values_are_valid
|
14
|
+
ensure_default_values_are_valid &&
|
15
|
+
ensure_only_values_are_valid
|
14
16
|
end
|
15
17
|
|
16
18
|
private
|
@@ -23,6 +25,10 @@ module Canvas
|
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
28
|
+
def optional_keys
|
29
|
+
super.merge("only" => Array)
|
30
|
+
end
|
31
|
+
|
26
32
|
def ensure_default_values_are_valid
|
27
33
|
return true unless attribute.key?("default")
|
28
34
|
|
@@ -33,11 +39,27 @@ module Canvas
|
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
42
|
+
def ensure_only_values_are_valid
|
43
|
+
return true unless attribute.key?("only")
|
44
|
+
|
45
|
+
if attribute["only"].empty?
|
46
|
+
@errors << %["only" cannot be empty]
|
47
|
+
return false
|
48
|
+
end
|
49
|
+
|
50
|
+
unsupported_entries = attribute["only"] - ALLOWED_RESTRICTIONS
|
51
|
+
if unsupported_entries.any?
|
52
|
+
@errors << %["only" for product-type variables must be one of: #{ALLOWED_RESTRICTIONS.join(', ')}]
|
53
|
+
return false
|
54
|
+
end
|
55
|
+
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
36
59
|
def default_value_is_valid?(value)
|
37
60
|
value = value.downcase
|
38
61
|
if !ALLOWED_DEFAULT_VALUES.include?(value)
|
39
|
-
@errors << "
|
40
|
-
"one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}"
|
62
|
+
@errors << %["default" for product-type variables must be one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}]
|
41
63
|
false
|
42
64
|
else
|
43
65
|
true
|
data/lib/canvas/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easol-canvas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Byrne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
description: |
|
99
99
|
Canvas is a command line tool to help with building themes for Easol.
|
100
100
|
It provides tooling to check theme directories for errors and to make sure
|
101
|
-
they
|
101
|
+
they conform with the Easol theme spec.
|
102
102
|
email: developers@easol.com
|
103
103
|
executables:
|
104
104
|
- canvas
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.3.
|
174
|
+
rubygems_version: 3.3.26
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: CLI to help with building themes for Easol
|