panda_pal 5.3.12 → 5.3.13
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: c8eb58ee2c4df4d91c08b20c3ea717a1227ebbc212500b6f5a0abad01855fd8c
|
4
|
+
data.tar.gz: ba0b60f6ee46634a554ac779b6cadf671edb922bc33201ac762de4fa9263ec45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1337a89241f5a12bc0f5d202197f17f6ea4478be3e44786e68cd2b2161fc8df0cc2338418c4cdacbaa99cb1ec9e07a06446bac3a9a9a965285f35b4cbdce91cb
|
7
|
+
data.tar.gz: 83c6c892aad41adc5fd7ec2709dd8f5b5a70c238764b9caad989f5a2021ee92d81c64ac05e6ce7a3e72d321d2abfa8b1aba3b1298b2225fff4d476b57d4bd3c6
|
@@ -8,8 +8,16 @@ module PandaPal
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class_methods do
|
11
|
+
def define_setting(*args, &blk)
|
12
|
+
@_injected_settings_definitions ||= []
|
13
|
+
@_injected_settings_definitions << {
|
14
|
+
args: args,
|
15
|
+
block: blk,
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
11
19
|
def settings_structure
|
12
|
-
if PandaPal.lti_options&.[](:settings_structure).present?
|
20
|
+
struc = if PandaPal.lti_options&.[](:settings_structure).present?
|
13
21
|
normalize_settings_structure(PandaPal.lti_options[:settings_structure])
|
14
22
|
else
|
15
23
|
{
|
@@ -18,6 +26,32 @@ module PandaPal
|
|
18
26
|
properties: {},
|
19
27
|
}
|
20
28
|
end
|
29
|
+
|
30
|
+
(@_injected_settings_definitions || []).each do |sub|
|
31
|
+
args = [*sub[:args]]
|
32
|
+
path = args.shift || []
|
33
|
+
path = path.split('.') if path.is_a?(String)
|
34
|
+
path = Array(path)
|
35
|
+
|
36
|
+
if path.present?
|
37
|
+
key = path.pop
|
38
|
+
|
39
|
+
root = struc
|
40
|
+
path.each do |p|
|
41
|
+
root = root[:properties][p.to_sym]
|
42
|
+
end
|
43
|
+
|
44
|
+
if sub[:block]
|
45
|
+
root[:properties][key.to_sym] = sub[:block].call
|
46
|
+
else
|
47
|
+
root[:properties][key.to_sym] = args.shift
|
48
|
+
end
|
49
|
+
else
|
50
|
+
sub[:block].call(struc)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
struc
|
21
55
|
end
|
22
56
|
|
23
57
|
def normalize_settings_structure(struc)
|
@@ -69,7 +103,7 @@ module PandaPal
|
|
69
103
|
any_match = norm_types.any? do |t|
|
70
104
|
if t == 'Boolean'
|
71
105
|
settings == true || settings == false
|
72
|
-
|
106
|
+
elsif t.is_a?(Class)
|
73
107
|
settings.is_a?(t)
|
74
108
|
end
|
75
109
|
end
|
@@ -11,6 +11,31 @@ module PandaPal
|
|
11
11
|
included do
|
12
12
|
after_commit :sync_schedule, on: [:create, :update]
|
13
13
|
after_commit :unschedule_tasks, on: :destroy
|
14
|
+
|
15
|
+
define_setting do |struc|
|
16
|
+
next unless _schedule_descriptors.present?
|
17
|
+
|
18
|
+
struc[:properties][:timezone] ||= {
|
19
|
+
type: 'String',
|
20
|
+
required: false,
|
21
|
+
validate: ->(timezone, *args) {
|
22
|
+
ActiveSupport::TimeZone[timezone].present? ? nil : "<path> Invalid Timezone '#{timezone}'"
|
23
|
+
},
|
24
|
+
}
|
25
|
+
|
26
|
+
struc[:properties][:task_schedules] = {
|
27
|
+
type: 'Hash',
|
28
|
+
required: false,
|
29
|
+
properties: _schedule_descriptors.keys.reduce({}) do |hash, k|
|
30
|
+
desc = _schedule_descriptors[k]
|
31
|
+
|
32
|
+
hash.tap do |hash|
|
33
|
+
kl = ' ' * (k.to_s.length - 4)
|
34
|
+
hash[k.to_sym] = hash[k.to_s] = PandaPal::OrganizationConcerns::TaskScheduling.build_settings_entry(desc)
|
35
|
+
end
|
36
|
+
end,
|
37
|
+
}
|
38
|
+
end
|
14
39
|
end
|
15
40
|
|
16
41
|
class_methods do
|
@@ -18,35 +43,6 @@ module PandaPal
|
|
18
43
|
@_schedule_descriptors ||= {}
|
19
44
|
end
|
20
45
|
|
21
|
-
def settings_structure
|
22
|
-
return super unless _schedule_descriptors.present?
|
23
|
-
|
24
|
-
super.tap do |struc|
|
25
|
-
struc[:properties] ||= {}
|
26
|
-
|
27
|
-
struc[:properties][:timezone] ||= {
|
28
|
-
type: 'String',
|
29
|
-
required: false,
|
30
|
-
validate: ->(timezone, *args) {
|
31
|
-
ActiveSupport::TimeZone[timezone].present? ? nil : "<path> Invalid Timezone '#{timezone}'"
|
32
|
-
},
|
33
|
-
}
|
34
|
-
|
35
|
-
struc[:properties][:task_schedules] = {
|
36
|
-
type: 'Hash',
|
37
|
-
required: false,
|
38
|
-
properties: _schedule_descriptors.keys.reduce({}) do |hash, k|
|
39
|
-
desc = _schedule_descriptors[k]
|
40
|
-
|
41
|
-
hash.tap do |hash|
|
42
|
-
kl = ' ' * (k.to_s.length - 4)
|
43
|
-
hash[k.to_sym] = hash[k.to_s] = PandaPal::OrganizationConcerns::TaskScheduling.build_settings_entry(desc)
|
44
|
-
end
|
45
|
-
end,
|
46
|
-
}
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
46
|
def scheduled_task(cron_time, name_or_method = nil, worker: nil, queue: nil, &block)
|
51
47
|
task_key = (name_or_method.presence || "scheduled_task_#{caller_locations[0].lineno}").to_s
|
52
48
|
raise "Task key '#{task_key}' already taken!" if _schedule_descriptors.key?(task_key)
|
data/lib/panda_pal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panda_pal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.3.
|
4
|
+
version: 5.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure ProServe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|