Class: Eco::API::Common::Loaders::Workflow::Mailer
Constant Summary
collapse
- ORG =
'your organization'.freeze
- TRACE_COUNT =
3
Class Attribute Summary collapse
Class Method Summary
collapse
workflow
Methods inherited from Config
active_enviro, cli, config, config_block
#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant
#delegate_missing_to, #method_missing, #respond_to_missing?
Class Attribute Details
Returns the value of attribute error.
43
44
45
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 43
def error
@error
end
|
Class Method Details
.base_subject ⇒ Object
49
50
51
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 49
def base_subject
"#{org_name} (#{active_enviro}) at #{Time.now.iso8601}"
end
|
.error? ⇒ Boolean
65
66
67
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 65
def error?
!!error
end
|
.error_message ⇒ Object
79
80
81
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 79
def error_message
error&.patch_full_message(trace_count: 3)
end
|
.errors_n_warnings(io) ⇒ Object
69
70
71
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 69
def errors_n_warnings(io)
[error_message, log_err_n_warn(io)].join("\n")
end
|
.log_err_n_warn(io) ⇒ Object
73
74
75
76
77
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 73
def log_err_n_warn(io)
warn_errors = io.logger.cache.logs(level: %i[error warn])
return if warn_errors.empty?
"ALL WARNINGS & ERRORS:\n#{warn_errors.join}\n"
end
|
45
46
47
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 45
def org_name
self::ORG
end
|
.other_case?(io) ⇒ Boolean
59
60
61
62
63
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 59
def other_case?(io)
cli.config.usecases.active(io: io).any? do |usecase, _data|
%i[other].any? { |type| usecase.type == type }
end
end
|
.some_update?(io) ⇒ Boolean
53
54
55
56
57
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 53
def some_update?(io)
cli.config.usecases.active(io: io).any? do |usecase, _data|
%i[transform sync].any? { |type| usecase.type == type }
end
end
|
.trace_count ⇒ Object
83
84
85
|
# File 'lib/eco/api/common/loaders/config/workflow/mailer.rb', line 83
def trace_count
self::TRACE_COUNT
end
|