class Bgg::Search::Result

Attributes

id[R]
name[R]
type[R]
year_published[R]

Public Class Methods

new(result_item) click to toggle source
# File lib/bgg/search_result.rb, line 6
def initialize(result_item)
  @id             = result_item['id'].to_i
  @name           = result_item['name'][0]['value']
  @type           = result_item['type']
  @year_published = result_item.fetch('yearpublished', [{'value' => '0'}])[0]['value'].to_i
end

Public Instance Methods

game() click to toggle source
# File lib/bgg/search_result.rb, line 13
def game
  Bgg::Game.find_by_id(self.id)
end