Class: EveApp::XmlApi::Calls::AssetList

Inherits:
Base
  • Object
show all
Defined in:
lib/eve_app/xml_api/calls.rb

Direct Known Subclasses

CorporateAssetList, PersonalAssetList

Instance Attribute Summary collapse

Attributes inherited from Base

#cached_until, #results, #xml

Instance Method Summary collapse

Methods inherited from Base

#error?, #ids, #merge

Constructor Details

#initialize(xml) ⇒ AssetList

Returns a new instance of AssetList.



130
131
132
133
134
# File 'lib/eve_app/xml_api/calls.rb', line 130

def initialize(xml)
  @assets = []
  parse_rows(xml.search("//rowset[@name='assets']/row"))
  @cached_until = (xml.search('cachedUntil').text + 'Z').to_time
end

Instance Attribute Details

#assetsObject (readonly)

Returns the value of attribute assets.



128
129
130
# File 'lib/eve_app/xml_api/calls.rb', line 128

def assets
  @assets
end

Instance Method Details

#parse_rows(rows, parent = nil) ⇒ Object



136
137
138
139
140
141
142
143
144
# File 'lib/eve_app/xml_api/calls.rb', line 136

def parse_rows(rows, parent=nil)
  rows.each do |container|
    asset = Classes::Asset.new(container)
    asset.container = container.children.any?
    asset.parent = parent if parent
    parse_rows(container.search("rowset/row"), asset) if asset.container?
    @assets << asset
  end
end