Class: EPP::Response
- Inherits:
-
Object
- Object
- EPP::Response
- Defined in:
- lib/epp-client/response.rb
Overview
An EPP XML Response
Instance Method Summary collapse
-
#code ⇒ Integer
Response code.
-
#data ⇒ XML::Node+
Response data.
-
#error_reason ⇒ String
Error reason.
-
#error_value ⇒ XML::Node
Descriptive Error Information.
-
#extension ⇒ XML::Node+
Response extension block.
-
#initialize(xml_string) ⇒ Response
constructor
Creates an instance of an EPP::Response.
- #inspect ⇒ Object
-
#message ⇒ String
Response message.
-
#msgQ ⇒ XML::Node
Response Message Queue.
- #pending? ⇒ Boolean
-
#success? ⇒ Boolean
Indicates if the response is successful.
-
#to_s(opts = {}) ⇒ String
Convert the receiver to a string.
-
#to_xml ⇒ XML::Document
Returns the XML response document.
Constructor Details
Instance Method Details
#code ⇒ Integer
Response code
24 25 26 |
# File 'lib/epp-client/response.rb', line 24 def code @code ||= result['code'].to_i end |
#data ⇒ XML::Node+
Response data
53 54 55 56 57 58 |
# File 'lib/epp-client/response.rb', line 53 def data @data ||= begin list = @xml.find('/e:epp/e:response/e:resData/node()').reject { |n| n.empty? } list.size > 1 ? list : list[0] end end |
#error_reason ⇒ String
Error reason
42 43 44 45 46 47 48 49 |
# File 'lib/epp-client/response.rb', line 42 def error_reason unless defined?(@error_reason) reason = result.find('e:extValue/e:reason/text()').first @error_reason = reason && reason.content.strip end @error_reason end |
#error_value ⇒ XML::Node
Descriptive Error Information
36 37 38 |
# File 'lib/epp-client/response.rb', line 36 def error_value @error_value ||= result.find('e:extValue/e:value/node()').first end |
#extension ⇒ XML::Node+
Response extension block
68 69 70 71 72 73 |
# File 'lib/epp-client/response.rb', line 68 def extension @extension ||= begin list = @xml.find('/e:epp/e:response/e:extension/node()').reject { |n| n.empty? } list.size > 1 ? list : list[0] end end |
#inspect ⇒ Object
76 77 78 |
# File 'lib/epp-client/response.rb', line 76 def inspect @xml.inspect end |
#message ⇒ String
Response message
30 31 32 |
# File 'lib/epp-client/response.rb', line 30 def @message ||= result.find('e:msg/text()').first.content.strip end |
#msgQ ⇒ XML::Node
Response Message Queue
62 63 64 |
# File 'lib/epp-client/response.rb', line 62 def msgQ @msgQ ||= @xml.find('/e:epp/e:response/e:msgQ').first end |
#pending? ⇒ Boolean
18 19 20 |
# File 'lib/epp-client/response.rb', line 18 def pending? code == 1001 end |
#success? ⇒ Boolean
Indicates if the response is successful.
14 15 16 |
# File 'lib/epp-client/response.rb', line 14 def success? code == 1000 end |
#to_s(opts = {}) ⇒ String
Convert the receiver to a string
90 91 92 |
# File 'lib/epp-client/response.rb', line 90 def to_s(opts = {}) @xml.to_s({:indent => false}.merge(opts)) end |
#to_xml ⇒ XML::Document
Returns the XML response document
82 83 84 |
# File 'lib/epp-client/response.rb', line 82 def to_xml @xml end |