Class: Fetcher::Imap::SupportEmails

Inherits:
Base
  • Object
show all
Defined in:
lib/bas/fetcher/imap/use_case/support_emails.rb

Overview

This class is an implementation of the Fetcher::Imap::Base interface, specifically designed for fetching support email from a Google Gmail account.

Constant Summary collapse

TOKEN_URI =
"https://oauth2.googleapis.com/token"
EMAIL_DOMAIN =
"imap.gmail.com"
EMAIL_PORT =
993

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Fetcher::Base

Instance Method Details

#fetchObject

Implements the data fetching filter for support emails from Google Gmail.



18
19
20
21
22
23
# File 'lib/bas/fetcher/imap/use_case/support_emails.rb', line 18

def fetch
  yesterday = (Time.now - (60 * 60 * 24)).strftime("%e-%b-%Y")
  query = ["TO", config[:search_email], "SINCE", yesterday]

  execute(EMAIL_DOMAIN, EMAIL_PORT, TOKEN_URI, query)
end