Module: Epp::Eis::SessionCommands

Defined in:
lib/epp-eis/session.rb

Instance Method Summary collapse

Instance Method Details

#command_session(&block) ⇒ Object

Opens session to EPP server, and yields the block given. Wraps login and logout request around it.



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/epp-eis/session.rb', line 36

def command_session(&block)
  open_connection

  @logged_in = true if 

  begin
    yield
  ensure
    @logged_in = false if @logged_in && logout
    close_connection
  end
end

#helloObject



81
82
83
84
85
86
87
# File 'lib/epp-eis/session.rb', line 81

def hello
  builder = build_epp_request do |xml|
    xml.hello
  end
  
  HelloResponse.new(send_request(builder.to_xml))
end

#list_command(command_name) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/epp-eis/session.rb', line 49

def list_command(command_name)
  response = nil
  
  command_session do
    builder = build_epp_request do |xml|
      xml.extension {
        xml.extcommand('xmlns:fred' => 'http://www.nic.cz/xml/epp/fred-1.4', 'xsi:schemaLocation' => 'http://www.nic.cz/xml/epp/fred-1.4 fred-1.4.xsd') {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml.send(command_name)
          xml.clTRID UUIDTools::UUID.timestamp_create.to_s
        }
      }
    end
    
    response = send_request(builder.to_xml)
    
    builder = build_epp_request do |xml|
      xml.extension {
        xml.extcommand('xmlns:fred' => 'http://www.nic.cz/xml/epp/fred-1.4', 'xsi:schemaLocation' => 'http://www.nic.cz/xml/epp/fred-1.4 fred-1.4.xsd') {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml.getResults
          xml.clTRID UUIDTools::UUID.timestamp_create.to_s
        }
      }
    end
    
    response = GetResultsResponse.new(send_request(builder.to_xml))
  end
  
  return response
end