Module: Maileva

Defined in:
lib/maileva.rb

Constant Summary collapse

BATCHES_IN_PROCESS_MUTEX =
Mutex.new
@@config =
OpenStruct.new({
  files_root:   nil,
  ftp_login:    nil,
  ftp_password: nil,
  client_id:    nil,
  confirmation_threshold: 100
})
@@confirmation_callbacks =
[]
@@processing_callbacks =
[]
@@done_callbacks =
[]
@@failure_callbacks =
[]
@@rules =
{}
@@batches_in_process =
[]

Class Method Summary collapse

Class Method Details

.add_rule(name, opts) ⇒ Object

Raises:

  • (ArgumentError)


43
44
45
46
47
48
# File 'lib/maileva.rb', line 43

def self.add_rule(name, opts)
  raise ArgumentError, "name: expecting string" if !name.is_a?(Symbol)
  raise ArgumentError, "Expecting option 'id'" if !opts.key?(:id)

  @@rules[name] = opts
end

.batches_in_processObject



39
40
41
# File 'lib/maileva.rb', line 39

def self.batches_in_process
  @@batches_in_process
end

.configObject



31
32
33
# File 'lib/maileva.rb', line 31

def self.config
  @@config
end

.on_batch_failure(&block) ⇒ Object



62
63
64
# File 'lib/maileva.rb', line 62

def self.on_batch_failure(&block)
  @@failure_callbacks << block
end

.on_batch_processing(&block) ⇒ Object



54
55
56
# File 'lib/maileva.rb', line 54

def self.on_batch_processing(&block)
  @@processing_callbacks << block
end

.on_batch_sent(&block) ⇒ Object



58
59
60
# File 'lib/maileva.rb', line 58

def self.on_batch_sent(&block)
  @@done_callbacks << block
end

.on_confirmation_needed(&block) ⇒ Object



50
51
52
# File 'lib/maileva.rb', line 50

def self.on_confirmation_needed(&block)
  @@confirmation_callbacks << block
end

.rulesObject



35
36
37
# File 'lib/maileva.rb', line 35

def self.rules
  @@rules
end