Class: BounceEmail::Mail
- Inherits:
-
Object
show all
- Defined in:
- lib/bounce_email.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(mail) ⇒ Mail
Returns a new instance of Mail.
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bounce_email.rb', line 26
def initialize(mail)
@mail = mail.is_a?(String) ? ::Mail.new(mail) : mail
begin
if mail.bounced? @bounced = true
@diagnostic_code = mail.diagnostic_code
@error_status = mail.error_status
end
rescue
@bounced = @diagnostic_code = @error_status = nil
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
75
76
77
|
# File 'lib/bounce_email.rb', line 75
def method_missing(m, *args, &block)
@mail.send(m, *args, &block)
end
|
Class Method Details
.read(filename) ⇒ Object
22
23
24
|
# File 'lib/bounce_email.rb', line 22
def self.read(filename)
Mail.new( ::Mail.read(filename) )
end
|
Instance Method Details
#bounced? ⇒ Boolean
Also known as:
is_bounce?
39
40
41
|
# File 'lib/bounce_email.rb', line 39
def bounced?
@bounced ||= check_if_bounce(@mail) || (diagnostic_code != "unknown") || (error_status != "unknown")
end
|
#diagnostic_code ⇒ Object
Also known as:
reason
43
44
45
|
# File 'lib/bounce_email.rb', line 43
def diagnostic_code
@diagnostic_code ||= get_reason_from_status_code(code)
end
|
#error_status ⇒ Object
Also known as:
code
47
48
49
|
# File 'lib/bounce_email.rb', line 47
def error_status
@error_status ||= get_code(@mail)
end
|
#original_mail ⇒ Object
71
72
73
|
# File 'lib/bounce_email.rb', line 71
def original_mail
@original_mail ||= get_original_mail(@mail)
end
|
#type ⇒ Object
def final_recipien?
end
def action
end
def retryable?
end
67
68
69
|
# File 'lib/bounce_email.rb', line 67
def type
@type ||= get_type_from_status_code(code)
end
|