easol-canvas 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canvas/validators/schema_attributes/variant.rb +24 -3
- data/lib/canvas/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e5275a64698399c6ccd64afd11014f878d10e8807bf74e64c0d48e85a3d8bb9
|
4
|
+
data.tar.gz: ceee5b6ac86486dbc5c359efe9a25bbe50f798180c6b64eb4b926c51bba45b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c83c2f825f1564e12d208098a0af2f926352d27e4e7c4b6aa6002d5983d06153bab1650edb7a02b52fcd9f2fb79302653ee58c9d481e8e86ef50d11d80a46c8
|
7
|
+
data.tar.gz: 6e28e6f1839eb050eecc0ca9ecaff1f8c13b0a0ab19a4d979a7aa4714c3423148f8de97f6aee0957eeaa789773f5b43ffc48b477f4e94d32caad51a7c928562d
|
@@ -10,7 +10,8 @@ module Canvas
|
|
10
10
|
|
11
11
|
def validate
|
12
12
|
super &&
|
13
|
-
ensure_default_values_are_valid
|
13
|
+
ensure_default_values_are_valid &&
|
14
|
+
ensure_only_from_values_are_valid
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
@@ -23,6 +24,10 @@ module Canvas
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
27
|
+
def optional_keys
|
28
|
+
super.merge("only_from" => Array)
|
29
|
+
end
|
30
|
+
|
26
31
|
def ensure_default_values_are_valid
|
27
32
|
return true unless attribute.key?("default")
|
28
33
|
|
@@ -36,13 +41,29 @@ module Canvas
|
|
36
41
|
def default_value_is_valid?(value)
|
37
42
|
value = value.downcase
|
38
43
|
if !ALLOWED_DEFAULT_VALUES.include?(value)
|
39
|
-
@errors << "
|
40
|
-
"one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}"
|
44
|
+
@errors << %["default" for variant-type variables must be one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}]
|
41
45
|
false
|
42
46
|
else
|
43
47
|
true
|
44
48
|
end
|
45
49
|
end
|
50
|
+
|
51
|
+
def ensure_only_from_values_are_valid
|
52
|
+
return true unless attribute.key?("only_from")
|
53
|
+
|
54
|
+
if attribute["only_from"].empty?
|
55
|
+
@errors << %["only_from" cannot be empty]
|
56
|
+
return false
|
57
|
+
end
|
58
|
+
|
59
|
+
unsupported_entries = attribute["only_from"] - Product::ALLOWED_RESTRICTIONS
|
60
|
+
if unsupported_entries.any?
|
61
|
+
@errors << %["only_from" for variant-type variables must be one of: #{Product::ALLOWED_RESTRICTIONS.join(', ')}]
|
62
|
+
return false
|
63
|
+
end
|
64
|
+
|
65
|
+
true
|
66
|
+
end
|
46
67
|
end
|
47
68
|
end
|
48
69
|
end
|
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.4.0
|
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-03-
|
12
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|