Class: BoardGameGem::BGGSearchResult

Inherits:
BGGBase
  • Object
show all
Defined in:
lib/bgg_search_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ BGGSearchResult

Returns a new instance of BGGSearchResult.



6
7
8
9
10
11
# File 'lib/bgg_search_result.rb', line 6

def initialize(xml)
	@id = xml["id"].to_i
	@type = xml["type"]
	@name = get_string(xml, "name", "value")
	@year_published = get_string(xml, "yearpublished", "value")
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/bgg_search_result.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/bgg_search_result.rb', line 4

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/bgg_search_result.rb', line 4

def type
  @type
end

#year_publishedObject (readonly)

Returns the value of attribute year_published.



4
5
6
# File 'lib/bgg_search_result.rb', line 4

def year_published
  @year_published
end

Instance Method Details

#to_item(statistics = false) ⇒ Object



13
14
15
# File 'lib/bgg_search_result.rb', line 13

def to_item(statistics = false)
	return BoardGameGem.get_item(@id, statistics)
end