Class: NominetEPP::Custom::ListResponse

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

Instance Method Summary collapse

Methods inherited from BasicResponse

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

Constructor Details

#initialize(response) ⇒ ListResponse

Returns a new instance of ListResponse.

Raises:

  • (ArgumentError)


4
5
6
7
# File 'lib/nominet-epp/responses/custom/list_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

#domainsObject



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

def domains
  @domains ||= parse_listData
end

#namespacesObject



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

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

#parse_listDataObject (protected)



18
19
20
21
22
23
24
25
26
# File 'lib/nominet-epp/responses/custom/list_response.rb', line 18

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