Class: Viewpoint::EWS::CalendarFolder

Inherits:
GenericFolder show all
Defined in:
lib/model/calendar_folder.rb

Instance Attribute Summary

Attributes inherited from GenericFolder

#change_key, #folder_id, #parent_id, #subscription_id, #sync_state, #watermark

Attributes included from Model

#ews_methods, #ews_methods_undef

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GenericFolder

#add_subfolder, #clear_sync_state!, #delete!, #find_items, folder_names, #get_events, get_folder, get_folder_by_name, get_folder_by_path, #get_item, #get_items, #search_by_subject, #subscribe, #subscribed?, #sync_items!, #sync_items_since!, #unsubscribe

Constructor Details

#initialize(folder) ⇒ CalendarFolder

initialize with an item of CalendarFolderType



37
38
39
40
41
42
# File 'lib/model/calendar_folder.rb', line 37

def initialize(folder)
  super(folder)

  # @todo Handle:
  #   <SharingEffectiveRights/>
end

Class Method Details

.find_folders(root = :msgfolderroot, traversal = 'Deep', shape = 'Default', folder_type = 'IPF.Appointment') ⇒ Array

Find folders of type Task

Parameters:

  • root (String, Symbol) (defaults to: :msgfolderroot)

    An folder id, either a DistinguishedFolderId (must me a Symbol) or a FolderId (String)

  • traversal (String) (defaults to: 'Deep')

    Shallow/Deep/SoftDeleted

  • shape (String) (defaults to: 'Default')

    the shape to return IdOnly/Default/AllProperties

  • folder_type (optional, String) (defaults to: 'IPF.Appointment')

    an optional folder type to limit the search to like ‘IPF.Task’

Returns:

  • (Array)

    Returns an Array of Folder or subclasses of Folder

See Also:



31
32
33
# File 'lib/model/calendar_folder.rb', line 31

def self.find_folders(root = :msgfolderroot, traversal = 'Deep', shape = 'Default', folder_type = 'IPF.Appointment')
  super(root, traversal, shape, folder_type)
end

Instance Method Details

#items_between(start_date, end_date, opts = {}) ⇒ Object

Find Calendar Items between two dates

Parameters:

  • start_date (DateTime)

    the date to start the search from

  • end_date (DateTime)

    the date to end the search at

  • opts (Hash) (defaults to: {})

    misc opts like restrictions, etc



60
61
62
63
# File 'lib/model/calendar_folder.rb', line 60

def items_between(start_date, end_date, opts = {})
  opts[:calendar_view] = {:max_entries_returned => 256, :start_date => start_date, :end_date => end_date}
  find_items(opts)
end

#items_since(start_date_time, opts = {}) ⇒ Object

Fetch items since a give DateTime

Parameters:

  • start_date_time (DateTime)

    the time to fetch Items since.



52
53
54
# File 'lib/model/calendar_folder.rb', line 52

def items_since(start_date_time, opts = {})
  items_between(start_date_time, DateTime.now, opts)
end

#todays_items(opts = {}) ⇒ Object

Fetch only items from today (since midnight)



45
46
47
48
# File 'lib/model/calendar_folder.rb', line 45

def todays_items(opts = {})
  #This is a bit convoluted for pre-1.9.x ruby versions that don't support to_datetime
  items_between(DateTime.parse(Date.today.to_s), DateTime.parse((Date.today + 1).to_s), opts)
end