Skip to content

Instantly share code, notes, and snippets.

@sarahhodne
Created January 14, 2012 14:11
Show Gist options
  • Save sarahhodne/1611611 to your computer and use it in GitHub Desktop.
Save sarahhodne/1611611 to your computer and use it in GitHub Desktop.
require 'context-io/resource'
module ContextIO
# Public: A file found as an email attachment.
class File < Resource
# Public: Get all files for a given account.
#
# query - Optional query Hash (all fields are optional):
# file_name - A String or Regexp matching the filename to
# search for. The String can contain shell
# globs.
# email - An email address String of the contact for
# whom you want the latest files exchanged
# with. By "exchanged with contaxt X", we
# mean any email received from contact X,
# sent to contact X or sent by anyone to both
# contact X and the source owner.
# to - An email address String of a contact files
# have been sent to.
# from - An email address String of a contact files
# have been sent from.
# cc - An email address String of a contact CC'ed
# on the messages.
# bcc - An email address String of a contact BCC'ed
# on the messages.
# date_before - Only include files attached to messages sent
# before this Time or Integer timestamp. The
# value of this filter is applied to the Date
# header of the message, which refers to the
# time the message is sent from the origin.
# date_after - Only include files attached to messages sent
# after this Time or Integer timestamp. The
# value of this filter is applied to the Date
# header of the message, which refers to the
# time the message is sent from the origin.
# indexed_before - Only include files attached to messages
# indexed before this Time or Integer
# timestamp. This is not the same as the date
# of the email, it is the time Context.IO
# indexed this message.
# indexed_after - Only include files attached to messages
# indexed after this Time or Integer
# timestamp. This is not the same as the date
# of the email, it is the time Context.IO
# indexed this message.
# group_by_revisions - If this Boolean is set to true, the method
# will return an array of Hashes, where each
# Hash represents a group of revisions of the
# same file. The Hash has an :occurences
# field, which is an Array of File objects,
# an :file_name field, which is the name of
# the file, and a :latest_date field, which
# is a Time object representing the last time
# a message with this file was sent.
# limit - An Integer max count of results to return.
# offset - An Integer offset (starts at 0).
#
# Returns an Array of File objects (except if the :group_by_revisions flag
# is set, see the documentation for that above).
def self.all(query={})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment