Class: Maildrop::Models::Mailbox

Inherits:
Object
  • Object
show all
Defined in:
lib/maildrop/models/mailbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Mailbox

Returns a new instance of Mailbox.



5
6
7
# File 'lib/maildrop/models/mailbox.rb', line 5

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/maildrop/models/mailbox.rb', line 3

def name
  @name
end

Instance Method Details

#addressObject



9
10
11
# File 'lib/maildrop/models/mailbox.rb', line 9

def address
  "#{name}@maildrop.cc"
end

#emailsObject



13
14
15
16
17
18
19
# File 'lib/maildrop/models/mailbox.rb', line 13

def emails
  emails = JSON.parse(mailbox_data)
  emails.map do |email|
    data = download_email(email['id'])
    Maildrop::Models::Email.new(data)
  end
end