easol-canvas 4.5.0 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 911b347907ab864cd0085474330872158ab55f7e8f4d1020d78117baa0971dc8
|
4
|
+
data.tar.gz: 240fda7ca6be7973d0efe612c0370a7a0bb7e909f9de4a71a94995a2c00fde58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a751a8981721663870977291795e6c26d3eb57a44cd8d862ee1faf73eace43d70b2f275ef97c1ec7e786827b1110286527f265dc30f33dfac4a21aac339d130
|
7
|
+
data.tar.gz: 4d7c4c032595162c34f4a9845dd3e5897d0f844a9e28ec6270dc53d7196e425080191f038cd00da20bde57efa0a46b01a6181e3e583903f9ff25ce991600bf61
|
data/lib/canvas/constants.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Canvas
|
4
|
+
module Validator
|
5
|
+
class SchemaAttribute
|
6
|
+
# :documented:
|
7
|
+
# Attribute validations specific to the experience_slot variables.
|
8
|
+
class ExperienceSlot < Base
|
9
|
+
ALLOWED_DEFAULT_VALUES = %w[next_upcoming].freeze
|
10
|
+
|
11
|
+
def validate
|
12
|
+
super && ensure_default_values_are_valid
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def permitted_values_for_default_key
|
18
|
+
if attribute["array"]
|
19
|
+
Array
|
20
|
+
else
|
21
|
+
String
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def ensure_default_values_are_valid
|
26
|
+
return true unless attribute.key?("default")
|
27
|
+
|
28
|
+
if attribute["array"]
|
29
|
+
attribute["default"].all? { |value| default_value_is_valid?(value) }
|
30
|
+
else
|
31
|
+
default_value_is_valid?(attribute["default"])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def default_value_is_valid?(value)
|
36
|
+
value = value.downcase
|
37
|
+
if !ALLOWED_DEFAULT_VALUES.include?(value)
|
38
|
+
@errors << %["default" for experience_slot variables must be one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}]
|
39
|
+
false
|
40
|
+
else
|
41
|
+
true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
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: 4.
|
4
|
+
version: 4.7.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-
|
12
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/canvas/validators/schema_attributes/color.rb
|
142
142
|
- lib/canvas/validators/schema_attributes/date.rb
|
143
143
|
- lib/canvas/validators/schema_attributes/experience_date.rb
|
144
|
+
- lib/canvas/validators/schema_attributes/experience_slot.rb
|
144
145
|
- lib/canvas/validators/schema_attributes/image.rb
|
145
146
|
- lib/canvas/validators/schema_attributes/link.rb
|
146
147
|
- lib/canvas/validators/schema_attributes/number.rb
|