Sha256: 9d0a810eb8712f7e23bcb6ef9365ef861c38f0f17b05fc5cb8e29e6f1357709a

Contents?: true

Size: 686 Bytes

Versions: 3

Compression:

Stored size: 686 Bytes

Contents

require 'gmail'

module Howitzer
  module GmailApi
    # A GmailApi::Client object is used to communicate with the Gmail API.
    class Client
      def initialize
        @client = Gmail.connect(Howitzer.gmail_login, Howitzer.gmail_password)
      end

      # 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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
howitzer-2.2.0 lib/howitzer/gmail_api/client.rb
howitzer-2.1.1 lib/howitzer/gmail_api/client.rb
howitzer-2.1.0 lib/howitzer/gmail_api/client.rb