Module: Abiquo::HttpAccessor

Included in:
Resource, ResourceCollection, SingleResource
Defined in:
lib/abiquo.rb

Instance Method Summary collapse

Instance Method Details

#xmlObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/abiquo.rb', line 27

def xml
  @xml ||= begin
    response = http.resource(url_with_params).get
    doc = Nokogiri.parse(response.body)
    # HACK: collections have link and totalSize entities we
    # don't want here
    if not doc.search('/*/totalSize').empty?
      doc.search('/*/totalSize | /*/link').each do |node|
        node.remove
      end
    end
    doc.root
  end
end