mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Refactored contact with ability
This commit is contained in:
parent
62f8061e10
commit
96d1c60dd8
33 changed files with 763 additions and 1045 deletions
|
@ -112,7 +112,7 @@ module Epp
|
|||
end
|
||||
|
||||
def next_domain_name
|
||||
"example#{@uniq_no.call}.ee"
|
||||
"example#{rand(100000000)}.ee"
|
||||
end
|
||||
|
||||
### REQUEST TEMPLATES ###
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
module EppContactXmlHelper
|
||||
def create_contact_xml(xml_params = {})
|
||||
defaults = {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe' },
|
||||
addr: {
|
||||
street: { value: '123 Example' },
|
||||
city: { value: 'Tallinn' },
|
||||
cc: { value: 'EE' }
|
||||
}
|
||||
},
|
||||
voice: { value: '+372.1234567' },
|
||||
email: { value: 'test@example.example' },
|
||||
ident: { value: '37605030299', attrs: { type: 'op' } }
|
||||
}
|
||||
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.create(xml_params)
|
||||
end
|
||||
|
||||
def update_contact_xml(xml_params = {})
|
||||
defaults = {
|
||||
id: { value: 'asd123123er' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
chg: {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe Edited' }
|
||||
},
|
||||
voice: { value: '+372.7654321' },
|
||||
email: { value: 'edited@example.example' },
|
||||
disclose: {
|
||||
value: {
|
||||
voice: { value: '' },
|
||||
email: { value: '' }
|
||||
}, attrs: { flag: '0' }
|
||||
}
|
||||
}
|
||||
}
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.update(xml_params)
|
||||
end
|
||||
|
||||
def delete_contact_xml(xml_params = {})
|
||||
defaults = { id: { value: 'sh8012' } }
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.delete(xml_params)
|
||||
end
|
||||
|
||||
def info_contact_xml(xml_params = {})
|
||||
defaults = { id: { value: 'sh8012' }, authInfo: { pw: { value: 'password' } } }
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.info(xml_params)
|
||||
end
|
||||
|
||||
def check_contact_xml(xml_params = {})
|
||||
defaults = {
|
||||
id: { value: 'ad123c3' }
|
||||
}
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.check(xml_params)
|
||||
end
|
||||
|
||||
def check_multiple_contacts_xml
|
||||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<check>
|
||||
<contact:check
|
||||
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
|
||||
<contact:id>check-1234</contact:id>
|
||||
<contact:id>check-4321</contact:id>
|
||||
</contact:check>
|
||||
</check>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>'
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.include EppContactXmlHelper
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue