Class: NcsNavigator::Warehouse::Hooks::EtlStatusEmail

Inherits:
Object
  • Object
show all
Defined in:
lib/ncs_navigator/warehouse/hooks/etl_status_email.rb

Overview

A post-ETL hook which sends a message to configured e-mail accounts after each ETL run. The message indicates whether the ETL succeeded or failed and some summary statistics, but no further detail.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ EtlStatusEmail

Returns a new instance of EtlStatusEmail.

Parameters:

  • options (Hash<Symbol, Object>) (defaults to: {})

Options Hash (options):

  • :to (Array<String>)

    the e-mail addresses to whom the notifications will be sent.



16
17
18
# File 'lib/ncs_navigator/warehouse/hooks/etl_status_email.rb', line 16

def initialize(options={})
  @to = options[:to] or 'Need at least one recipient'
end

Instance Method Details

#etl_failed(args)

This method returns an undefined value.

Parameters:

  • args (Hash<Symbol, Object>)

    the arguments received from the ETL process.



34
35
36
37
38
# File 'lib/ncs_navigator/warehouse/hooks/etl_status_email.rb', line 34

def etl_failed(args)
  args[:configuration].set_up_action_mailer

  Mailer.failure_message(@to, args[:transform_statuses]).deliver
end

#etl_succeeded(args)

This method returns an undefined value.

Parameters:

  • args (Hash<Symbol, Object>)

    the arguments received from the ETL process.



24
25
26
27
28
# File 'lib/ncs_navigator/warehouse/hooks/etl_status_email.rb', line 24

def etl_succeeded(args)
  args[:configuration].set_up_action_mailer

  Mailer.success_message(@to, args[:transform_statuses]).deliver
end