Class: Chronicle::Email::IMAPExtractor
- Inherits:
-
Chronicle::ETL::Extractor
- Object
- Chronicle::ETL::Extractor
- Chronicle::Email::IMAPExtractor
- Defined in:
- lib/chronicle/email/imap_extractor.rb
Instance Method Summary collapse
Instance Method Details
#extract ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chronicle/email/imap_extractor.rb', line 30 def extract @message_ids.each do || = () email = Mail.new(.attr['BODY[]']) data = { raw: email, time: email.date&.to_time, subject: email.subject, from: email&.from&.join(', '), to: email&.to&.join(', ') } yield build_extraction(data:) end end |
#prepare ⇒ Object
21 22 23 24 |
# File 'lib/chronicle/email/imap_extractor.rb', line 21 def prepare @connection = create_connection @message_ids = end |
#results_count ⇒ Object
26 27 28 |
# File 'lib/chronicle/email/imap_extractor.rb', line 26 def results_count @message_ids.count end |