class Bgg::Play

Attributes

date[R]
game_id[R]
game_name[R]
game_type[R]
id[R]
length[R]
location[R]
players[R]
quantity[R]

Public Class Methods

new(play) click to toggle source
# File lib/bgg/play.rb, line 6
def initialize(play)
        @id = play['id'].to_i
        @incomplete = play['incomplete'].to_i
        @game_id = play['item'][0]['objectid'].to_i
        @length = play['length'].to_i
        @nowinstats = play['nowinstats'].to_i
        @quantity = play['quantity'].to_i

        @game_name = play['item'][0]['name']
        @game_type = play['item'][0]['subtypes'][0]['subtype'][0]['value']

        @date = play['date']
        @location = play['location']

        @players = []
        if play.has_key?('players')
                play['players'][0]['player'].each do |player|
                        @players << Player.new(player)
                end
        end
end

Public Instance Methods

game() click to toggle source
# File lib/bgg/play.rb, line 36
def game
        Bgg::Game.find_by_id(self.game_id)
end
incomplete?() click to toggle source
# File lib/bgg/play.rb, line 32
def incomplete?
        @incomplete != 0
end
nowinstats?() click to toggle source
# File lib/bgg/play.rb, line 28
def nowinstats?
        @nowinstats != 0
end