Class: Viewpoint::EWS::Types::CalendarFolder

Inherits:
Object
  • Object
show all
Includes:
Viewpoint::EWS, Viewpoint::EWS::Types, GenericFolder
Defined in:
lib/ews/types/calendar_folder.rb

Constant Summary

Constants included from GenericFolder

GenericFolder::GFOLDER_KEY_ALIAS, GenericFolder::GFOLDER_KEY_PATHS, GenericFolder::GFOLDER_KEY_TYPES

Constants included from StringUtils

StringUtils::DURATION_RE

Constants included from Viewpoint::EWS

ConnectingSID

Constants included from Viewpoint::EWS::Types

KEY_ALIAS, KEY_PATHS, KEY_TYPES, OOF_KEY_ALIAS, OOF_KEY_PATHS, OOF_KEY_TYPES

Instance Attribute Summary

Attributes included from GenericFolder

#subscription_id, #sync_state, #watermark

Attributes included from Viewpoint::EWS

#logger

Attributes included from Viewpoint::EWS::Types

#ews_item

Instance Method Summary collapse

Methods included from GenericFolder

#available_categories, #delete!, #get_all_properties!, #get_events, #initialize, #items, #items_since, #push_subscribe, #search_by_subject, #subscribe, #subscribed?, #sync_items!, #synced?, #todays_items, #unsubscribe

Methods included from StringUtils

included

Methods included from ItemAccessors

#copy_items, #export_items, #find_items, #get_item, #get_items, #move_items

Methods included from Viewpoint::EWS

#remove_impersonation, root_logger, #set_impersonation

Methods included from Viewpoint::EWS::Types

#auto_deepen?, #deepen!, #ews_methods, #freeze!, #frozen?, #initialize, #mark_deep!, #method_missing, #methods, #respond_to?, #shallow?, #to_s, #unfreeze!

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Viewpoint::EWS::Types

Instance Method Details

#create_item(attributes, to_ews_create_opts = {}) ⇒ CalendarItem

Creates a new appointment

Parameters:

  • attributes (Hash)

    Parameters of the calendar item. Some example attributes are listed below.

Options Hash (attributes):

  • :subject (String)
  • :start (Time)
  • :end (Time)

Returns:

See Also:



38
39
40
41
42
43
44
45
46
47
# File 'lib/ews/types/calendar_folder.rb', line 38

def create_item(attributes, to_ews_create_opts = {})
  template = Viewpoint::EWS::Template::CalendarItem.new attributes
  template.saved_item_folder_id = {id: self.id, change_key: self.change_key}
  rm = ews.create_item(template.to_ews_create(to_ews_create_opts)).response_messages.first
  if rm && rm.success?
    CalendarItem.new ews, rm.items.first[:calendar_item][:elems].first
  else
    raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" unless rm
  end
end

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

Fetch items between a given time period

Parameters:

  • start_date (DateTime)

    the time to start fetching Items from

  • end_date (DateTime)

    the time to stop fetching Items from



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ews/types/calendar_folder.rb', line 10

def items_between(start_date, end_date, opts={})
  items do |obj|
    obj.restriction = { :and =>
      [
        {:is_greater_than_or_equal_to =>
          [
            {:field_uRI => {:field_uRI=>'calendar:Start'}},
            {:field_uRI_or_constant=>{:constant => {:value =>start_date}}}
          ]
        },
        {:is_less_than_or_equal_to =>
          [
            {:field_uRI => {:field_uRI=>'calendar:End'}},
            {:field_uRI_or_constant=>{:constant => {:value =>end_date}}}
          ]
        }
      ]
    }
  end
end