Class: Mailbox

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

Overview

container for mail methods

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Mailbox

Returns a new instance of Mailbox.



3
4
5
6
# File 'lib/mailchekka/mailbox.rb', line 3

def initialize(info)
  @info = info
  @box  = nil
end

Instance Method Details

#getnumObject



23
24
25
26
27
28
29
# File 'lib/mailchekka/mailbox.rb', line 23

def getnum
  if @info.pop
    num_pop
  else
    num_imap
  end
end

#prepareObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mailchekka/mailbox.rb', line 8

def prepare
  host = @info.host
  port = @info.port
  ssl  = @info.ssl
  user = [@info., @info.password]
  if @info.pop
    @box = Net::POP3.new(host, port)
    @box.use_ssl if ssl
    @box.start(*user)
  else
    @box = Net::IMAP.new(host, port, ssl: ssl)
    @box.(*user)
  end
end