Class: Howitzer::MailAdapters::Abstract Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/howitzer/mail_adapters/abstract.rb

Overview

This class is abstract.

This class should not be used directly. Instead, create a subclass that implements: Abstract.find #plain_text_body #html_body #text #mail_from #recipients #received_time #sender_email #mime_part

Abstract is the superclass of all mail adapters.

Direct Known Subclasses

Gmail, Mailgun, Mailtrap, Onesecmail, Testmail

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Abstract

Returns a new instance of Abstract.

Parameters:

  • message (Object)

    original message data


32
33
34
# File 'lib/howitzer/mail_adapters/abstract.rb', line 32

def initialize(message)
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.


17
18
19
# File 'lib/howitzer/mail_adapters/abstract.rb', line 17

def message
  @message
end

Class Method Details

.find(_recipient, _subject, _wait:) ⇒ Object

Finds an email in mailbox

Parameters:

  • _recipient (String)

    an email

  • _subject (String)
  • _wait (Integer)

    how much time is required to wait an email

Raises:

  • (NotImplementedError)

24
25
26
# File 'lib/howitzer/mail_adapters/abstract.rb', line 24

def self.find(_recipient, _subject, _wait:)
  raise NotImplementedError
end

Instance Method Details

#html_bodyObject

Returns a html body of the email message

Raises:

  • (NotImplementedError)

44
45
46
# File 'lib/howitzer/mail_adapters/abstract.rb', line 44

def html_body
  raise NotImplementedError
end

#mail_fromObject

Returns who has sent email data in format: User Name <[email protected]>

Raises:

  • (NotImplementedError)

56
57
58
# File 'lib/howitzer/mail_adapters/abstract.rb', line 56

def mail_from
  raise NotImplementedError
end

#mime_partObject

Allows to get email MIME attachment

Raises:

  • (NotImplementedError)

80
81
82
# File 'lib/howitzer/mail_adapters/abstract.rb', line 80

def mime_part
  raise NotImplementedError
end

#plain_text_bodyObject

Returns a plain text body of the email message

Raises:

  • (NotImplementedError)

38
39
40
# File 'lib/howitzer/mail_adapters/abstract.rb', line 38

def plain_text_body
  raise NotImplementedError
end

#received_timeObject

Returns email received time

Raises:

  • (NotImplementedError)

68
69
70
# File 'lib/howitzer/mail_adapters/abstract.rb', line 68

def received_time
  raise NotImplementedError
end

#recipientsObject

Returns an array of recipients who has received current email

Raises:

  • (NotImplementedError)

62
63
64
# File 'lib/howitzer/mail_adapters/abstract.rb', line 62

def recipients
  raise NotImplementedError
end

#sender_emailObject

Returns sender user email

Raises:

  • (NotImplementedError)

74
75
76
# File 'lib/howitzer/mail_adapters/abstract.rb', line 74

def sender_email
  raise NotImplementedError
end

#textObject

Returns a mail text

Raises:

  • (NotImplementedError)

50
51
52
# File 'lib/howitzer/mail_adapters/abstract.rb', line 50

def text
  raise NotImplementedError
end