Class: Howitzer::GmailApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/howitzer/gmail_api/client.rb

Overview

A GmailApi::Client object is used to communicate with the Gmail API.

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client



7
8
9
# File 'lib/howitzer/gmail_api/client.rb', line 7

def initialize
  @client = Gmail.connect(Howitzer., Howitzer.gmail_password)
end

Instance Method Details

#find_message(recipient, subject) ⇒ Gmail::Message

Finds message according to given parameters

Parameters:

  • recipient (String)

    this is recipient mail address for message filtering

  • subject (String)

    this is subject of the message to filter particular message

Returns:

  • (Gmail::Message)

    gmail message object



17
18
19
# File 'lib/howitzer/gmail_api/client.rb', line 17

def find_message(recipient, subject)
  @client.inbox.emails(to: recipient, subject: subject).last
end