Class: GoogleApps::Atom::Export

Inherits:
Document
  • Object
show all
Defined in:
lib/google_apps/atom/export.rb

Constant Summary collapse

HEADER =
'HEADER_ONLY'
FULL =
'FULL_MESSAGE'

Instance Method Summary collapse

Methods inherited from Document

add_type, #attrs_from_props, #build_root, #delete_node, #determine_namespaces, #find_and_update, #find_values, inherited, #make_document, #new_empty_doc, #parse, #set_instances, sub_to_meth, #type_to_s, #type_to_sym, types

Methods included from Node

#add_attributes, #add_namespaces, #add_prop_node, #check_value, #create_node, #get_content, #get_values, #node_match?

Constructor Details

#initialize(xml = nil) ⇒ Export

Returns a new instance of Export.



7
8
9
10
# File 'lib/google_apps/atom/export.rb', line 7

def initialize(xml = nil)
  super(xml)
  @doc.root = build_root(:export) unless xml
end

Instance Method Details

#content(type) ⇒ Object

content specifies the data to be returned in the mailbox export. There are two valid arguments: ‘FULL_MESSAGE’ or ‘HEADER_ONLY’

content ‘HEADER_ONLY’

content returns @doc.root



81
82
83
# File 'lib/google_apps/atom/export.rb', line 81

def content(type)
  add_prop('packageContent', type)
end

#end_date(date) ⇒ Object

end_date specifies an end date for the extract. Matching results that occurred past this date will not be included in the result set. end_date takes a string as an argument, the format is as follows:

‘yyyy-MM-dd HH:mm’ where yyyy is the four digit year, MM is the two digit month, dd is the two digit day, HH is the hour of the day 0-23 and mm is the minute 0-59

end_date ‘2012-01-01 08:30’

end_date returns @doc.root



47
48
49
# File 'lib/google_apps/atom/export.rb', line 47

def end_date(date)
  add_prop('endDate', date)
end

#include_deletedObject

include_deleted will specify that matches which have been deleted should be returned as well. The default is to omit deleted matches.

include_deleted

include_deleted returns @doc.root



58
59
60
# File 'lib/google_apps/atom/export.rb', line 58

def include_deleted
  add_prop('includeDeleted', 'true')
end

#query(query_string) ⇒ Object

query specifies a query string to be used when filtering the messages to be returned. You can use any string that you could use in Google’s Advanced Search interface.

query ‘from: Bob’

query returns @doc.root



70
71
72
# File 'lib/google_apps/atom/export.rb', line 70

def query(query_string)
  add_prop('searchQuery', query_string)
end

#start_date(date) ⇒ Object

start_date specifies a start date for the extract. Matching results that occurred before this date will not be included in the result set. start_date takes a string as an argument, the format is as follows:

‘yyyy-MM-dd HH:mm’ where yyyy is the four digit year, MM is the two digit month, dd is the two digit day, HH is the hour of the day 0-23 and mm is the minute 0-59

start_date ‘2012-01-01 00:00’

start_date returns @doc.root



30
31
32
# File 'lib/google_apps/atom/export.rb', line 30

def start_date(date)
  add_prop('beginDate', date)
end

#to_sObject

to_s returns @doc as a string.



13
14
15
# File 'lib/google_apps/atom/export.rb', line 13

def to_s
  @doc.to_s
end