Class: IGE_ISB_API::Games

Inherits:
Object
  • Object
show all
Defined in:
lib/ige_isb_api/games.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGames

Returns a new instance of Games.



421
422
423
424
# File 'lib/ige_isb_api/games.rb', line 421

def initialize()
  @categories = []
  @games = []
end

Instance Attribute Details

#categoriesObject

Returns the value of attribute categories.



419
420
421
# File 'lib/ige_isb_api/games.rb', line 419

def categories
  @categories
end

#imagesObject

Returns the value of attribute images.



419
420
421
# File 'lib/ige_isb_api/games.rb', line 419

def images
  @images
end

Instance Method Details

#load_from_xml(the_xml, language = IGE_ISB_API::Constants::DEFAULT_LANGUAGE) ⇒ Object



426
427
428
429
430
431
432
# File 'lib/ige_isb_api/games.rb', line 426

def load_from_xml(the_xml, language = IGE_ISB_API::Constants::DEFAULT_LANGUAGE)
  doc = Nokogiri::XML(the_xml)
  @images = doc.xpath("//images").first['url']
  doc.xpath("//games/c").each do |cat_node|
    @categories << Category.from_node(cat_node, language: language)
  end
end