class PlaylyfeClient::V2::Event

Attributes

event[R]
game[R]
timestamp[R]

Public Class Methods

build(ev_hash, game, team_player_or_process=nil) click to toggle source
# File lib/playlyfe_client/v2/event.rb, line 33
def self.build(ev_hash, game, team_player_or_process=nil)   
  event= PlaylyfeClient::V2::PlayerEvent::Base.build(ev_hash,game,team_player_or_process)
  event= PlaylyfeClient::V2::TeamEvent::Base.build(ev_hash,game,team_player_or_process) if event.nil?
  event= PlaylyfeClient::V2::ProcessEvent::Base.build(ev_hash,game,team_player_or_process) if event.nil?
  return event #could be nil!
end
new(ev_hash,game) click to toggle source
# File lib/playlyfe_client/v2/event.rb, line 12
def initialize(ev_hash,game)
  @event=ev_hash[:event] || ev_hash["event"]
  ts=ev_hash[:timestamp] || ev_hash["timestamp"]
  @timestamp= (ts.kind_of?(Time) ? ts : Time.parse(ts) )
  @game=game
  @ev_hash=ev_hash
end

Public Instance Methods

created_at() click to toggle source
# File lib/playlyfe_client/v2/event.rb, line 6
def created_at
  @timestamp
end