Class: BoardGameGem::BGGCollectionItem
- Defined in:
- lib/bgg_collection_item.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#num_players ⇒ Object
readonly
Returns the value of attribute num_players.
-
#num_plays ⇒ Object
readonly
Returns the value of attribute num_plays.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#thumbnail ⇒ Object
readonly
Returns the value of attribute thumbnail.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#year_published ⇒ Object
readonly
Returns the value of attribute year_published.
Instance Method Summary collapse
-
#initialize(xml) ⇒ BGGCollectionItem
constructor
A new instance of BGGCollectionItem.
- #to_item(statistics = false) ⇒ Object
Constructor Details
#initialize(xml) ⇒ BGGCollectionItem
Returns a new instance of BGGCollectionItem.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bgg_collection_item.rb', line 6 def initialize(xml) @id = xml["objectid"].to_i @type = xml["subtype"] @name = get_string(xml, "name") @year_published = get_string(xml, "yearpublished") @image = get_string(xml, "image") @thumbnail = get_string(xml, "thumbnail") @num_players = get_string(xml, "numplayers") @status = { :own => get_boolean(xml, "status", "own"), :prev_owned => get_boolean(xml, "status", "prevowned"), :for_trade => get_boolean(xml, "status", "fortrade"), :want => get_boolean(xml, "status", "want"), :want_to_play => get_boolean(xml, "status", "wanttoplay"), :want_to_buy => get_boolean(xml, "status", "wanttobuy"), :wishlist => get_boolean(xml, "status", "wishlist"), :wishlist_priority => get_integer(xml, "status", "wishlistpriority"), :preordered => get_boolean(xml, "status", "preordered"), :last_modified => get_datetime(xml, "status", "lastmodified") } @num_plays = get_integer(xml, "numplays") end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def image @image end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def name @name end |
#num_players ⇒ Object (readonly)
Returns the value of attribute num_players.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def num_players @num_players end |
#num_plays ⇒ Object (readonly)
Returns the value of attribute num_plays.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def num_plays @num_plays end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def status @status end |
#thumbnail ⇒ Object (readonly)
Returns the value of attribute thumbnail.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def thumbnail @thumbnail end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def type @type end |
#year_published ⇒ Object (readonly)
Returns the value of attribute year_published.
4 5 6 |
# File 'lib/bgg_collection_item.rb', line 4 def year_published @year_published end |
Instance Method Details
#to_item(statistics = false) ⇒ Object
29 30 31 |
# File 'lib/bgg_collection_item.rb', line 29 def to_item(statistics = false) return BoardGameGem.get_item(@id, statistics) end |