Class: MailCatcher::API::Mailbox::Message

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mailcatcher/api/mailbox/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg) ⇒ Message

Returns a new instance of Message.



16
17
18
19
20
21
# File 'lib/mailcatcher/api/mailbox/message.rb', line 16

def initialize(msg)
  @id = msg['id'].to_i
  @raw = msg['source']

  @mail = Mail.new(@raw)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/mailcatcher/api/mailbox/message.rb', line 14

def id
  @id
end

#rawObject (readonly)

Returns the value of attribute raw.



14
15
16
# File 'lib/mailcatcher/api/mailbox/message.rb', line 14

def raw
  @raw
end

Instance Method Details

#delete!Object



27
28
29
# File 'lib/mailcatcher/api/mailbox/message.rb', line 27

def delete!
  MailCatcher::API::Client.delete_message(id)
end


23
24
25
# File 'lib/mailcatcher/api/mailbox/message.rb', line 23

def links
  @links ||= URI.extract(decode_body).select { |s| s.start_with?('http') || s.start_with?('https') }
end