Class: NominetEPP::Custom::HandshakeResponse

Inherits:
BasicResponse show all
Defined in:
lib/nominet-epp/responses/custom/handshake_response.rb

Instance Method Summary collapse

Methods inherited from BasicResponse

#method, #method_missing, #respond_to?, #respond_to_missing?

Constructor Details

#initialize(response) ⇒ HandshakeResponse

Returns a new instance of HandshakeResponse.

Raises:

  • (ArgumentError)


4
5
6
7
# File 'lib/nominet-epp/responses/custom/handshake_response.rb', line 4

def initialize(response)
  raise ArgumentError, "must be an EPP::Response" unless response.kind_of?(EPP::Response)
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NominetEPP::BasicResponse

Instance Method Details

#case_idObject



9
10
11
# File 'lib/nominet-epp/responses/custom/handshake_response.rb', line 9

def case_id
  @case_id ||= @response.data.find('//h:caseId', namespaces).first.content.strip
end

#domainsObject



13
14
15
# File 'lib/nominet-epp/responses/custom/handshake_response.rb', line 13

def domains
  @domains ||= parse_domainList
end

#namespacesObject



17
18
19
# File 'lib/nominet-epp/responses/custom/handshake_response.rb', line 17

def namespaces
  { 'h' => 'http://www.nominet.org.uk/epp/xml/std-handshake-1.0' }
end

#parse_domainListObject (protected)



22
23
24
25
26
27
28
29
30
# File 'lib/nominet-epp/responses/custom/handshake_response.rb', line 22

def parse_domainList
  domains = []
  
  @response.data.find('//h:domainName', namespaces).each do |node|
    domains << node.content.strip
  end
  
  domains
end