mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Moved contact xml builder into seperate file
This commit is contained in:
parent
ca7779fb4c
commit
e7ec64f7f7
2 changed files with 31 additions and 26 deletions
|
@ -89,32 +89,6 @@ module Epp
|
|||
end
|
||||
end
|
||||
|
||||
#contact builders
|
||||
|
||||
def contact_check_xml(xml_params={})
|
||||
|
||||
xml_params[:ids] = xml_params[:ids] || [ { id: 'check-1234' }, { id: 'check-4321' } ]
|
||||
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||
xml.command do
|
||||
xml.check do
|
||||
xml.tag!('contact:check', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||
unless xml_params[:ids] == [false]
|
||||
xml_params[:ids].each do |x|
|
||||
xml.tag!('contact:id', x[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
xml.clTRID 'ABC-12345'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
|
|
31
spec/support/epp_contact_xml_builder.rb
Normal file
31
spec/support/epp_contact_xml_builder.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
module EppContactXmlBuilder
|
||||
|
||||
def contact_check_xml(xml_params={})
|
||||
|
||||
xml_params[:ids] = xml_params[:ids] || [ { id: 'check-1234' }, { id: 'check-4321' } ]
|
||||
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||
xml.command do
|
||||
xml.check do
|
||||
xml.tag!('contact:check', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||
unless xml_params[:ids] == [false]
|
||||
xml_params[:ids].each do |x|
|
||||
xml.tag!('contact:id', x[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
xml.clTRID 'ABC-12345'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.include EppContactXmlBuilder
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue