easol-canvas 4.4.1 → 4.5.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: 67b140da10e959afbd458b84db1186a6ccada9cb8b3b2a7b4982378fb4b4558f
4
- data.tar.gz: 3d529689c6ef059a47316c89c581510412e21a4225d3fe3e66f048ff0f8cb2a1
3
+ metadata.gz: 8114b8f10ebd645b4a19f008e65998e216aba4e186819b78eb95a32cf4ac91cf
4
+ data.tar.gz: a1fe81acc3f96942708428f579318fa2fe4374be105aab7d5570f59d947f2d00
5
5
  SHA512:
6
- metadata.gz: 4f2df37752988e5a7d20213ebd5b9eaea3de9af3bedeefb3c35b60a9f05267031d28728e721e0efcd9fe53d7104afc5ecc9c3c8a39c4917c6a898a37559e370b
7
- data.tar.gz: 1287cdba10a96a8fe36d004637c34c484977aefd4078a56bbc1271baada0fe29cf9ee3530769c256181e22c47d22999bf60f8b3c98338d5b05a0d6c231196eb9
6
+ metadata.gz: ff2129922b1bb21d1d5f9052c251359c76e15c8520dfd6946f1af2b09062c6eedd2ae9a9649c5d1da10e483f7833918d65b775d8544273f728237b79b6084060
7
+ data.tar.gz: 9f93f40a6d0bf87d8dc0024173039d80f1797a1d142414218e737568efd5e90fc05906d53bb69138f008aee665669b4f5c45b8ae1bb33534ff715ef394eca011
@@ -28,6 +28,7 @@ module Canvas
28
28
  variant
29
29
  package
30
30
  date
31
+ experience_date
31
32
  ].freeze
32
33
 
33
34
  # These are types where the value is stored as a primitive type, e.g. string, integer.
@@ -35,6 +35,7 @@ module Canvas
35
35
  "variant" => SchemaAttribute::Variant,
36
36
  "package" => SchemaAttribute::Package,
37
37
  "date" => SchemaAttribute::Date,
38
+ "experience_date" => SchemaAttribute::ExperienceDate,
38
39
  }.freeze
39
40
  RESERVED_NAMES = %w[
40
41
  page
@@ -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_date variables.
8
+ class ExperienceDate < 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_date 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canvas
4
- VERSION = "4.4.1"
4
+ VERSION = "4.5.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.4.1
4
+ version: 4.5.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-08-28 00:00:00.000000000 Z
12
+ date: 2023-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 0.4.0
76
+ version: '0.4'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 0.4.0
83
+ version: '0.4'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: json-schema
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -140,6 +140,7 @@ files:
140
140
  - lib/canvas/validators/schema_attributes/base.rb
141
141
  - lib/canvas/validators/schema_attributes/color.rb
142
142
  - lib/canvas/validators/schema_attributes/date.rb
143
+ - lib/canvas/validators/schema_attributes/experience_date.rb
143
144
  - lib/canvas/validators/schema_attributes/image.rb
144
145
  - lib/canvas/validators/schema_attributes/link.rb
145
146
  - lib/canvas/validators/schema_attributes/number.rb