Class: Mailbox
- Inherits:
-
Object
- Object
- Mailbox
- Defined in:
- lib/mailchekka/mailbox.rb
Overview
container for mail methods
Instance Method Summary collapse
- #getnum ⇒ Object
-
#initialize(info) ⇒ Mailbox
constructor
A new instance of Mailbox.
- #prepare ⇒ Object
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
#getnum ⇒ Object
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 |
#prepare ⇒ Object
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.login, @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.login(*user) end end |