47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'app/serializers/tasker/handler_serializer.rb', line 47
def step_templates
return [] unless handler_instance
begin
templates = handler_instance.step_templates
return [] unless templates.respond_to?(:map)
templates.map do |template|
template_hash = {}
template_hash[:name] = template.name.to_s if template.respond_to?(:name)
template_hash[:description] = template.description if template.respond_to?(:description)
template_hash[:dependent_system] = template.dependent_system.to_s if template.respond_to?(:dependent_system)
if template.respond_to?(:depends_on_step) && template.depends_on_step
template_hash[:depends_on_step] =
template.depends_on_step.to_s
end
template_hash[:depends_on_steps] = template.depends_on_steps if template.respond_to?(:depends_on_steps)
if template.respond_to?(:handler_class)
template_hash[:handler_class] =
template.handler_class.is_a?(Class) ? template.handler_class.name : template.handler_class.to_s
end
template_hash[:configuration] = template.handler_config if template.respond_to?(:handler_config)
template_hash[:default_retryable] = template.default_retryable if template.respond_to?(:default_retryable)
if template.respond_to?(:default_retry_limit)
template_hash[:default_retry_limit] =
template.default_retry_limit
end
template_hash[:skippable] = template.skippable if template.respond_to?(:skippable)
template_hash[:custom_events] = template.custom_events if template.respond_to?(:custom_events)
template_hash
end
rescue StandardError => e
Rails.logger.warn "Failed to introspect step templates for #{class_name}: #{e.message}"
[]
end
end
|