easol-canvas 4.17.0 → 4.18.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2396c564e638650f1f50b0f81e6b79bc9cc3020304f559f1b050034721056d58
4
- data.tar.gz: ebfb662861d72d0e7c9777343ee8aee6330f348dc132575d4ca4081c0f7249d4
3
+ metadata.gz: 012fee086d69a166e3b2e062e0e8d9f658db0749bed1dad6e5a30c25ea4c8678
4
+ data.tar.gz: fb1a4df7f2aa7961c16e85b26472dd35e728b4c5519ef7f7a99c41a14c25e82a
5
5
  SHA512:
6
- metadata.gz: a64ab47a1802570ed45ff6a524cd1648a9025b7082a290814049aaec927c363a952299d4e15a311b826735301d95c79cfcb036ff5a1c1cf635f5a989d99e878e
7
- data.tar.gz: 365bb2ee7c14ff920f6a15558a01c25cc492814616299ab8159f88a9effd36f645a92566e4a5ad0f10ddf0ff3a4880c56c198e251906f47775bced5a13614b9f
6
+ metadata.gz: 56ced44aa44c09a09f254c459dc35962b9114e5a747c5d257df0cef32d2bdd94739dd46c779344ecd4fb7df58c54a9614179bda162405ae889c9fb70fc33cc1a
7
+ data.tar.gz: 23128bde9e9f69d7faf52e121f8bc077ec68a9407cad32b7ff15b4863fa8dadb3f0bf92cff5e1a2a1b1b27f88ac833a934d6636825178a80eadde036d5e8d65b
@@ -16,6 +16,7 @@ module Canvas
16
16
  color
17
17
  image
18
18
  link
19
+ modifier
19
20
  number
20
21
  page
21
22
  post
@@ -20,6 +20,7 @@ module Canvas
20
20
  class SchemaAttribute
21
21
  VALIDATORS = {
22
22
  "image" => SchemaAttribute::Image,
23
+ "modifier" => SchemaAttribute::Modifier,
23
24
  "product" => SchemaAttribute::Product,
24
25
  "post" => SchemaAttribute::Post,
25
26
  "page" => SchemaAttribute::Page,
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Canvas
4
+ module Validator
5
+ class SchemaAttribute
6
+ # :documented:
7
+ # Attribute validations specific to modifier-type variables.
8
+ # Modifier drops expose name and id properties for use in site builder schemas.
9
+ class Modifier < Base
10
+ ALLOWED_DEFAULT_VALUES = %w[random].freeze
11
+
12
+ def validate
13
+ super &&
14
+ ensure_default_values_are_valid
15
+ end
16
+
17
+ private
18
+
19
+ def permitted_values_for_default_key
20
+ if attribute["array"]
21
+ Array
22
+ else
23
+ String
24
+ end
25
+ end
26
+
27
+ def ensure_default_values_are_valid
28
+ return true unless attribute.key?("default")
29
+
30
+ if attribute["array"]
31
+ attribute["default"].all? { |value| default_value_is_valid?(value) }
32
+ else
33
+ default_value_is_valid?(attribute["default"])
34
+ end
35
+ end
36
+
37
+ def default_value_is_valid?(value)
38
+ value = value.downcase
39
+ if !ALLOWED_DEFAULT_VALUES.include?(value)
40
+ @errors << %["default" for modifier-type variables must be one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}]
41
+ false
42
+ else
43
+ true
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canvas
4
- VERSION = "4.17.0"
4
+ VERSION = "4.18.0"
5
5
  end
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: 4.17.0
4
+ version: 4.18.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: 2025-04-25 00:00:00.000000000 Z
12
+ date: 2025-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -145,6 +145,7 @@ files:
145
145
  - lib/canvas/validators/schema_attributes/experience_slot.rb
146
146
  - lib/canvas/validators/schema_attributes/image.rb
147
147
  - lib/canvas/validators/schema_attributes/link.rb
148
+ - lib/canvas/validators/schema_attributes/modifier.rb
148
149
  - lib/canvas/validators/schema_attributes/number.rb
149
150
  - lib/canvas/validators/schema_attributes/package.rb
150
151
  - lib/canvas/validators/schema_attributes/page.rb