mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 17:55:55 +02:00
Refactor + add example requests file
This commit is contained in:
parent
034adb616c
commit
3875e5f18a
5 changed files with 106 additions and 28 deletions
101
doc/epp_request_examples.xml
Normal file
101
doc/epp_request_examples.xml
Normal file
|
@ -0,0 +1,101 @@
|
|||
<!-- DOMAIN CREATING -->
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||
<domain:hostObj>ns2.example.net</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh801333</domain:contact>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2fooBAR</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:create>
|
||||
</create>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
|
||||
<!-- DOMAIN CREATING WITH DETAILED NAMESERVER ATTRIBUTES -->
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:ns>
|
||||
<domain:hostAttr>
|
||||
<domain:hostName>ns1.example.net</domain:hostName>
|
||||
<domain:hostAddr ip="v4">192.0.2.2</domain:hostAddr>
|
||||
<domain:hostAddr ip="v6">1080:0:0:0:8:800:200C:417A</domain:hostAddr>
|
||||
</domain:hostAttr>
|
||||
<domain:hostAttr>
|
||||
<domain:hostName>ns2.example.net</domain:hostName>
|
||||
</domain:hostAttr>
|
||||
</domain:ns>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh801333</domain:contact>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2fooBAR</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:create>
|
||||
</create>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
|
||||
<!-- DOMAIN INFO -->
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<info>
|
||||
<domain:info
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name hosts="all">example.ee</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
|
||||
<!-- DOMAIN RENEW -->
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<renew>
|
||||
<domain:renew
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
<domain:curExpDate>2014-08-07</domain:curExpDate>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
</domain:renew>
|
||||
</renew>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
|
||||
<!-- DOMAIN CHECK -->
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<check>
|
||||
<domain:check
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
</domain:check>
|
||||
</check>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
|
@ -9,7 +9,7 @@ describe 'EPP Domain', epp: true do
|
|||
it 'returns error if contact does not exists' do
|
||||
Fabricate(:contact, code: 'jd1234')
|
||||
|
||||
response = epp_request('domains/create.xml')
|
||||
response = epp_request(domain_create_xml, :xml)
|
||||
expect(response[:results][0][:result_code]).to eq('2303')
|
||||
expect(response[:results][0][:msg]).to eq('Contact was not found')
|
||||
expect(response[:results][0][:value]).to eq('sh8013')
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||
<domain:hostObj>ns2.example.net</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh801333</domain:contact>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2fooBAR</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:create>
|
||||
</create>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
|
@ -28,7 +28,7 @@ describe 'EPP Session', epp: true do
|
|||
end
|
||||
|
||||
it 'prohibits further actions unless logged in' do
|
||||
response = epp_plain_request('domains/create.xml')
|
||||
response = epp_plain_request(domain_create_xml, :xml)
|
||||
expect(response[:result_code]).to eq('2002')
|
||||
expect(response[:msg]).to eq('You need to login first.')
|
||||
expect(response[:clTRID]).to eq('ABC-12345')
|
||||
|
|
|
@ -13,9 +13,10 @@ module Epp
|
|||
end
|
||||
end
|
||||
|
||||
def epp_plain_request filename
|
||||
def epp_plain_request(data, type=:filename)
|
||||
begin
|
||||
parse_response(server.send_request(read_body(filename)))
|
||||
return parse_response(server.send_request(read_body(data))) if type == :filename
|
||||
return parse_response(server.send_request(data))
|
||||
rescue Exception => e
|
||||
e
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue