Class: NominetEPP::Custom::TagListResponse
- Inherits:
-
BasicResponse
- Object
- BasicResponse
- NominetEPP::Custom::TagListResponse
- Defined in:
- lib/nominet-epp/responses/custom/tag_list_response.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ TagListResponse
constructor
A new instance of TagListResponse.
- #namespaces ⇒ Object
- #parse_infdata ⇒ Object protected
- #tags ⇒ Object
Methods inherited from BasicResponse
#method, #method_missing, #respond_to?, #respond_to_missing?
Constructor Details
#initialize(response) ⇒ TagListResponse
Returns a new instance of TagListResponse.
4 5 6 7 |
# File 'lib/nominet-epp/responses/custom/tag_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
#namespaces ⇒ Object
13 14 15 |
# File 'lib/nominet-epp/responses/custom/tag_list_response.rb', line 13 def namespaces { 'tag' => 'http://www.nominet.org.uk/epp/xml/nom-tag-1.0' } end |
#parse_infdata ⇒ Object (protected)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nominet-epp/responses/custom/tag_list_response.rb', line 18 def parse_infdata = {} @response.data.find('//tag:infData', namespaces).each do |node| tag = node.find('tag:registrar-tag').first.content.strip name = node.find('tag:name').first.content.strip handshake = node.find('tag:handshake').first.content.strip trad = node.find('tag:trad-name').first trad = trad && trad.content.strip [tag] = { 'name' => name, 'handshake' => handshake == 'Y' } [tag]['trad_name'] = trad if trad end end |
#tags ⇒ Object
9 10 11 |
# File 'lib/nominet-epp/responses/custom/tag_list_response.rb', line 9 def @tags ||= parse_infdata end |