gmail_client.rb
def collect_messages(email, password, label, criteria, save_attachments)
    messages = []

    gmail = Gmail.connect(email, password)

    begin
      criteria.each do |c|
        messages += fetch_messages(gmail, label, c, save_attachments)
      end
    rescue Exception => e
      puts e.inspect
    ensure
      gmail.logout
    end
    messages
  end
# returns an array with all messages for specified label and all search criteria
returns an array with all messages for specified label and all search criteria
returns an array with all messages for specified label and all search criteria
def collect_messages(email, password, label, criteria, save_attachments)
    messages = []
    gmail = Gmail.connect(email, password)
    begin
      criteria.each do |c|
        messages += fetch_messages(gmail, label, c, save_attachments)
      end
    rescue Exception => e
      puts e.inspect
    ensure
      gmail.logout
    end
    messages
  end
def collect_messages ( email , password , label , criteria , save_attachments ) messages = [ ] gmail = Gmail . connect ( email , password ) begin criteria . each do | c | messages += fetch_messages ( gmail , label , c , save_attachments ) end rescue Exception => e puts e . inspect ensure gmail . logout end messages end
returns an array with all messages for specified label and all search criteria
returns an array with all messages for specified label and all search criteria
email
password
label
criteria
save_attachments