Class: Exchanger::ExpandDL::Request

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

#mailboxObject

Returns the value of attribute mailbox


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

def mailbox
  @mailbox
end

Instance Method Details

#resetObject

Reset request options to defaults.


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

def reset
  @mailbox = nil
end

#to_xmlObject


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

def to_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.send("soap:Envelope", "xmlns:soap" => NS["soap"]) do
      xml.send("soap:Body") do
        xml.ExpandDL("xmlns" => NS["m"], "xmlns:t" => NS["t"]) do
          xml.Mailbox do
            if mailbox.item_id
              xml.send("t:ItemId", "Id" => mailbox.item_id.id, "ChangeKey" => mailbox.item_id.change_key)
            else
              xml.send("t:EmailAddress", mailbox.email_address)
            end
          end
        end
      end
    end
  end
end