Class: Exchanger::GetFolder::Request

Inherits:
Operation::Request show all
Defined in:
lib/exchanger/operations/get_folder.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

#base_shapeObject

Returns the value of attribute base_shape


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

def base_shape
  @base_shape
end

#email_addressObject

Returns the value of attribute email_address


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

def email_address
  @email_address
end

#folder_idsObject

Returns the value of attribute folder_ids


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

def folder_ids
  @folder_ids
end

Instance Method Details

#resetObject

Reset request options to defaults.


10
11
12
13
14
# File 'lib/exchanger/operations/get_folder.rb', line 10

def reset
  @folder_ids = []
  @base_shape = :default
  @email_address = nil
end

#to_xmlObject


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/exchanger/operations/get_folder.rb', line 16

def to_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.send("soap:Envelope", "xmlns:soap" => NS["soap"]) do
      xml.send("soap:Body") do
        xml.GetFolder("xmlns" => NS["m"], "xmlns:t" => NS["t"]) do
          xml.FolderShape do
            xml.send "t:BaseShape", base_shape.to_s.camelize
          end
          xml.FolderIds do
            folder_ids.each do |folder_id|
              if folder_id.is_a?(Symbol)
                xml.send("t:DistinguishedFolderId", "Id" => folder_id) do
                  if email_address
                    xml.send("t:Mailbox") do
                      xml.send("t:EmailAddress", email_address)
                    end
                  end
                end
              else
                xml.send("t:FolderId", "Id" => folder_id)
              end
            end
          end
        end
      end
    end
  end
end