Class: Rmsgen::IMAPClient

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rmsgen/imap_client.rb

Constant Summary collapse

INBOX =
'INBOX'
RMS_EMAIL =
'[email protected]'
RFC822 =
'RFC822'

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ IMAPClient

Returns a new instance of IMAPClient.



13
14
15
16
17
18
# File 'lib/rmsgen/imap_client.rb', line 13

def initialize(options)
  @server = options['imap_server']
  @login = options['imap_login']
  @password = options['imap_password']
  @imap_client = Net::IMAP.new(@server)
end

Instance Method Details

#authenticateObject



22
23
24
# File 'lib/rmsgen/imap_client.rb', line 22

def authenticate
  @imap_client.authenticate('LOGIN', @login, @password)
end

#fetch_polnote_messages_from_inbox(&block) ⇒ Object



26
27
28
29
30
# File 'lib/rmsgen/imap_client.rb', line 26

def fetch_polnote_messages_from_inbox(&block)
  authenticate
  select INBOX
  find_all_from_rms(&block)
end

#find_by_id(id) ⇒ Object



32
33
34
35
# File 'lib/rmsgen/imap_client.rb', line 32

def find_by_id(id)
  select INBOX
  fetch_message_body(id)
end