Class: Exchanger::MoveItem::Request

Inherits:
Operation::Request show all
Defined in:
lib/exchanger/operations/move_item.rb

Instance Attribute Summary collapse

Attributes inherited from Operation::Request

#body, #response

Instance Method Summary collapse

Methods inherited from Operation::Request

#action, #headers, #initialize

Constructor Details

This class inherits a constructor from Exchanger::Operation::Request

Instance Attribute Details

#folder_idObject

Returns the value of attribute folder_id.



7
8
9
# File 'lib/exchanger/operations/move_item.rb', line 7

def folder_id
  @folder_id
end

#itemsObject

Returns the value of attribute items.



7
8
9
# File 'lib/exchanger/operations/move_item.rb', line 7

def items
  @items
end

Instance Method Details

#resetObject

Reset request options to defaults.



10
11
12
# File 'lib/exchanger/operations/move_item.rb', line 10

def reset
  @items = []
end

#to_xmlObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/exchanger/operations/move_item.rb', line 14

def to_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.send("soap:Envelope", "xmlns:soap" => NS["soap"], "xmlns:t" => NS["t"], "xmlns:xsi" => NS["xsi"], "xmlns:xsd" => NS["xsd"]) do
      xml.send("soap:Body") do
        xml.MoveItem("xmlns" => NS["m"], "xmlns:t" => NS["t"]) do
          xml.ToFolderId do
            if folder_id.is_a?(Symbol)
              xml.send("t:DistinguishedFolderId", "Id" => folder_id)
            else
              xml.send("t:FolderId", "Id" => folder_id)
            end
          end
          xml.ItemIds do
            items.each do |item|
              xml.send "t:ItemId", {"Id" => item.id, "ChangeKey" => item.change_key}
            end
          end
        end
      end
    end
  end
end