lib/rews/folder.rb in rews-0.2.12 vs lib/rews/folder.rb in rews-0.5.0

- old
+ new

@@ -187,73 +187,10 @@ r = find_item(opts) r.result.map!(&:item_id) r end - GET_ITEM_OPTS = { - :item_shape=>Shape::ITEM_SHAPE_OPTS, - :ignore_change_keys=>nil - } - # retrieve a bunch of <tt>Item::Item</tt>s in one API hit. - # takes a list of <tt>Item::ItemId</tt>s, or a list of <tt>Item::Item</tt>, - # or a <tt>Folder::FindResult</tt> and options to specify +Shape::ItemShape+ - def get_item(message_ids, opts={}) - opts = check_opts(GET_ITEM_OPTS, opts) - message_ids = message_ids.result if message_ids.is_a?(FindResult) - - r = with_error_check(client, :get_item_response,:response_messages,:get_item_response_message) do - client.savon_client.request(:wsdl, "GetItem") do - http.headers["SOAPAction"] = "\"#{SCHEMA_MESSAGES}/GetItem\"" # required by EWS 2007 - soap.namespaces["xmlns:t"]=SCHEMA_TYPES - - xml = Builder::XmlMarkup.new - - xml << Shape::ItemShape.new(opts[:item_shape]||{}).to_xml - xml.wsdl :ItemIds do - message_ids.each do |mid| - mid = mid.item_id if mid.is_a?(Item::Item) - xml << mid.to_xml(opts[:ignore_change_keys]) - end - end - - soap.body = xml.target! - end - end - Item.read_get_item_response_messages(client, r) - end - - DELETE_ITEM_OPTS = { - :delete_type! =>nil, - :ignore_change_keys=>false - } - - # delete a bunch of Items in one API hit. - # takes a list of <tt>Item::ItemId</tt>s, or a list of <tt>Item::Item</tt>, - # or a <tt>Folder::FindResult</tt> and options to specify DeleteType - def delete_item(message_ids, opts={}) - opts = check_opts(DELETE_ITEM_OPTS, opts) - message_ids = message_ids.result if message_ids.is_a?(FindResult) - - r = with_error_check(client, :delete_item_response, :response_messages, :delete_item_response_message) do - client.savon_client.request(:wsdl, "DeleteItem", :DeleteType=>opts[:delete_type]) do - http.headers["SOAPAction"] = "\"#{SCHEMA_MESSAGES}/DeleteItem\"" # required by EWS 2007 - soap.namespaces["xmlns:t"]=SCHEMA_TYPES - - xml = Builder::XmlMarkup.new - - xml.wsdl :ItemIds do - message_ids.each do |mid| - mid = mid.item_id if mid.is_a?(Item::Item) - xml << mid.to_xml(opts[:ignore_change_keys]) - end - end - - soap.body = xml.target! - end - end - true - end end # identifies a regular (non-distinguished) Folder on an Exchange server class VanillaFolderId < BaseFolderId # the Id of the Folder