2017-10-15 05:58:22 +02:00
|
|
|
class CustomWizard::Template
|
|
|
|
|
2017-11-01 05:21:14 +01:00
|
|
|
attr_reader :id,
|
|
|
|
:name,
|
|
|
|
:background,
|
|
|
|
:save_submissions,
|
|
|
|
:multiple_submissions,
|
2017-11-22 10:34:21 +01:00
|
|
|
:prompt_completion,
|
2019-11-15 00:00:02 +01:00
|
|
|
:restart_on_revisit,
|
2017-11-01 05:21:14 +01:00
|
|
|
:after_signup,
|
|
|
|
:after_time,
|
|
|
|
:after_time_scheduled,
|
2017-12-17 05:04:31 +01:00
|
|
|
:required,
|
2020-03-30 08:16:03 +02:00
|
|
|
:theme_id,
|
2020-04-08 09:59:54 +02:00
|
|
|
:permitted,
|
|
|
|
:steps,
|
|
|
|
:actions
|
2017-10-15 05:58:22 +02:00
|
|
|
|
|
|
|
def initialize(data)
|
|
|
|
data = data.is_a?(String) ? ::JSON.parse(data) : data
|
2018-05-11 02:43:00 +02:00
|
|
|
|
|
|
|
return nil if data.blank?
|
|
|
|
|
2017-10-15 05:58:22 +02:00
|
|
|
@id = data['id']
|
|
|
|
@name = data['name']
|
2017-11-01 05:21:14 +01:00
|
|
|
@background = data['background']
|
|
|
|
@save_submissions = data['save_submissions'] || false
|
|
|
|
@multiple_submissions = data['multiple_submissions'] || false
|
2017-11-22 10:34:21 +01:00
|
|
|
@prompt_completion = data['prompt_completion'] || false
|
2019-11-14 23:47:20 +01:00
|
|
|
@restart_on_revisit = data['restart_on_revisit'] || false
|
2017-11-01 05:21:14 +01:00
|
|
|
@after_signup = data['after_signup']
|
|
|
|
@after_time = data['after_time']
|
|
|
|
@after_time_scheduled = data['after_time_scheduled']
|
2017-11-22 10:34:21 +01:00
|
|
|
@required = data['required'] || false
|
2018-07-16 06:28:24 +02:00
|
|
|
@theme_id = data['theme_id']
|
2020-03-30 08:16:03 +02:00
|
|
|
@permitted = data['permitted'] || nil
|
2018-04-06 06:21:11 +02:00
|
|
|
|
|
|
|
if data['theme']
|
|
|
|
theme = Theme.find_by(name: data['theme'])
|
2018-07-16 06:28:24 +02:00
|
|
|
@theme_id = theme.id if theme
|
2018-04-06 06:21:11 +02:00
|
|
|
end
|
2020-04-08 09:59:54 +02:00
|
|
|
|
|
|
|
@steps = data['steps']
|
|
|
|
@actions = data['actions']
|
2017-10-15 05:58:22 +02:00
|
|
|
end
|
|
|
|
end
|