class RealPage::Utils::RequestGenerator
Generate a SOAP request for a specific action and sections
Constants
- ENVELOPE
Attributes
sections[R]
soap_action[R]
Public Class Methods
new(soap_action, sections)
click to toggle source
@param soap_action
[String] the action to request from RealPage
. @param sections [Array<RequestSection>] the section generators that will
be used to generate the body of the XML request
# File lib/real_page/utils/request_generator.rb, line 17 def initialize(soap_action, sections) @soap_action = soap_action @sections = sections end
Public Instance Methods
body()
click to toggle source
@return [String] the XML request for the specified action and sections
# File lib/real_page/utils/request_generator.rb, line 23 def body Nokogiri::XML::Builder.new do |xml_builder| xml_builder.Envelope(ENVELOPE) do namespace = xml_builder.parent.namespace_definitions.first xml_builder.parent.namespace = namespace xml_builder['soapenv'].Header xml_builder['soapenv'].Body do xml_builder['tem'].send(soap_action.downcase) do sections.each do |section| section.generate(xml_builder['tem']) end end end end end.to_xml end
headers()
click to toggle source
# File lib/real_page/utils/request_generator.rb, line 40 def headers { 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => "http://tempuri.org/IRPXService/#{soap_action.downcase}" } end