Class: EppXml::Session

Inherits:
Object
  • Object
show all
Includes:
ClientTransactionId
Defined in:
lib/epp-xml/session.rb

Instance Attribute Summary

Attributes included from ClientTransactionId

#cl_trid, #cl_trid_prefix

Instance Method Summary collapse

Methods included from ClientTransactionId

#clTRID, #initialize

Instance Method Details

#login(xml_params = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/epp-xml/session.rb', line 7

def (xml_params = {})
  defaults = {
    clID: { value: 'user' },
    pw: { value: 'pw' },
    newPW: nil,
    options: {
      version: { value: '1.0' },
      lang: { value: 'en' }
    },
    svcs: {
      _objURIs: [
        { objURI: { value: 'https://epp.tld.ee/schema/domain-eis-1.0.xsd' } },
        { objURI: { value: 'https://epp.tld.ee/schema/contact-eis-1.0.xsd' } },
        { objURI: { value: 'urn:ietf:params:xml:ns:host-1.0' } },
        { objURI: { value: 'urn:ietf:params:xml:ns:keyrelay-1.0' } }
      ],
      svcExtension: [
        { extURI: { value: 'urn:ietf:params:xml:ns:secDNS-1.1' } },
        { extURI: { value: 'https://epp.tld.ee/schema/eis-1.0.xsd' } }
      ]
    }
  }

  xml_params = defaults.deep_merge(xml_params)

  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. do
        EppXml.generate_xml_from_hash(xml_params, xml)
      end
      xml.clTRID(clTRID) if clTRID
    end
  end
end

#logoutObject



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/epp-xml/session.rb', line 47

def logout
  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.logout
      xml.clTRID(clTRID) if clTRID
    end
  end
end

#poll(xml_params = {}, custom_params = {}) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/epp-xml/session.rb', line 60

def poll(xml_params = {}, custom_params = {})
  defaults = {
    poll: { value: '', attrs: { op: 'req' } }
  }

  xml_params = defaults.deep_merge(xml_params)

  xml = Builder::XmlMarkup.new

  xml.instruct!(:xml, standalone: 'no')
  xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
    xml.command do
      EppXml.generate_xml_from_hash(xml_params, xml)

      EppXml.custom_ext(xml, custom_params)
      xml.clTRID(clTRID) if clTRID
    end
  end
end