Class: NamecheapApi::Response
- Inherits:
-
Object
- Object
- NamecheapApi::Response
- Defined in:
- lib/namecheap_api/response.rb
Instance Attribute Summary collapse
-
#raw_body ⇒ Object
Returns the value of attribute raw_body.
Instance Method Summary collapse
- #command ⇒ Object
- #doc ⇒ Object
-
#initialize(body) ⇒ Response
constructor
A new instance of Response.
- #results ⇒ Object
Constructor Details
#initialize(body) ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/namecheap_api/response.rb', line 7 def initialize(body) @raw_body = body end |
Instance Attribute Details
#raw_body ⇒ Object
Returns the value of attribute raw_body.
5 6 7 |
# File 'lib/namecheap_api/response.rb', line 5 def raw_body @raw_body end |
Instance Method Details
#command ⇒ Object
11 12 13 |
# File 'lib/namecheap_api/response.rb', line 11 def command doc.css('RequestedCommand').text end |
#doc ⇒ Object
21 22 23 |
# File 'lib/namecheap_api/response.rb', line 21 def doc @doc ||= Nokogiri::XML(raw_body) end |
#results ⇒ Object
15 16 17 18 19 |
# File 'lib/namecheap_api/response.rb', line 15 def results doc.css('CommandResponse > *').map do |result| clean_hash_keys(result.to_h) end end |