Creating an imap library in ruby