Class: Postpeek::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/postpeek/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mail:, metadata:, html_body: nil, text_body: nil, attachments: []) ⇒ Message

Returns a new instance of Message.

Parameters:

  • mail (Mail::Message)
  • metadata (Hash)

    from Builder#build

  • html_body (String, nil) (defaults to: nil)

    decoded HTML part

  • text_body (String, nil) (defaults to: nil)

    decoded plain-text part

  • attachments (Array<Hash>) (defaults to: [])

    [content_type:, data: , ...]



10
11
12
13
14
15
16
# File 'lib/postpeek/message.rb', line 10

def initialize(mail:, metadata:, html_body: nil, text_body: nil, attachments: [])
  @mail        = mail
  @metadata    = 
  @html_body   = html_body
  @text_body   = text_body
  @attachments = attachments
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



18
19
20
# File 'lib/postpeek/message.rb', line 18

def attachments
  @attachments
end

#html_bodyObject (readonly)

Returns the value of attribute html_body.



18
19
20
# File 'lib/postpeek/message.rb', line 18

def html_body
  @html_body
end

#mailObject (readonly)

Returns the value of attribute mail.



18
19
20
# File 'lib/postpeek/message.rb', line 18

def mail
  @mail
end

#metadataObject (readonly)

Returns the value of attribute metadata.



18
19
20
# File 'lib/postpeek/message.rb', line 18

def 
  @metadata
end

#text_bodyObject (readonly)

Returns the value of attribute text_body.



18
19
20
# File 'lib/postpeek/message.rb', line 18

def text_body
  @text_body
end

Instance Method Details

#fromObject



28
29
30
# File 'lib/postpeek/message.rb', line 28

def from
  [:from]
end

#idObject



20
21
22
# File 'lib/postpeek/message.rb', line 20

def id
  [:id]
end

#mailer_actionObject



40
41
42
# File 'lib/postpeek/message.rb', line 40

def mailer_action
  [:mailer_action]
end

#mailer_classObject



36
37
38
# File 'lib/postpeek/message.rb', line 36

def mailer_class
  [:mailer_class]
end

#raw_sourceObject



44
45
46
# File 'lib/postpeek/message.rb', line 44

def raw_source
  mail.to_s
end

#subjectObject



24
25
26
# File 'lib/postpeek/message.rb', line 24

def subject
  [:subject]
end

#toObject



32
33
34
# File 'lib/postpeek/message.rb', line 32

def to
  [:to]
end