class Howitzer::GmailApi::Client
A GmailApi::Client
object is used to communicate with the Gmail API.
Attributes
client[RW]
Public Class Methods
load_gmail_gem!()
click to toggle source
# File lib/howitzer/gmail_api/client.rb, line 5 def self.load_gmail_gem! require 'gmail' rescue LoadError raise LoadError, "Unable to load `gmail` library, please add following code to your Gemfile:\n\ngem 'gmail'" end
new()
click to toggle source
# File lib/howitzer/gmail_api/client.rb, line 12 def initialize self.client = Gmail.connect(Howitzer.gmail_login, Howitzer.gmail_password) end
Public Instance Methods
find_message(recipient, subject)
click to toggle source
Finds message according to given parameters
@param recipient [String] this is recipient mail address for message filtering @param subject [String] this is subject of the message to filter particular message @return [Gmail::Message] gmail message object
# File lib/howitzer/gmail_api/client.rb, line 22 def find_message(recipient, subject) client.inbox.emails(to: recipient, subject: subject).last end