class PlaylyfeClient::V2::Game

Game is 1:1 to connection, so only one instance per connection finding is done by credentials

Attributes

created_at[R]
description[R]
game_hash[R]
id[R]
ignore_rate_limit_errors[RW]
timezone[R]
type[R]

Public Class Methods

find_by_connection(conn) click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 20
def self.find_by_connection(conn)
  PlaylyfeClient::V2::Game.new(conn)
end
new(conn) click to toggle source
Calls superclass method PlaylyfeClient::Game::new
# File lib/playlyfe_client/v2/game.rb, line 64
def initialize(conn)    
  super(conn)
  @game_hash=connection.get_game_hash
  #name is not name of Game but rather connection   @name= game_hash["name"]
  @description=game_hash["description"]
  @id=game_hash["id"]
  @image=game_hash["image"]
  @title=game_hash["title"]
  @type=game_hash["type"]
  @timezone=game_hash["timezone"] #TODO converion to TZInfo::Timezone ? http://www.rubydoc.info/gems/tzinfo/frames
  @created_at=game_hash["created"] ? Time.parse(game_hash["created"]) : nil
end

Public Instance Methods

actions() click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 36
def actions
  @actions ||= PlaylyfeClient::V2::ActionCollection.new(self)
end
available_actions() click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 40
def available_actions
  actions
end
events(start_time=nil,end_time=nil) click to toggle source

results are cached if start_time is nil (events for last 24 hours), otherwise direct call to Playlyfe is made

# File lib/playlyfe_client/v2/game.rb, line 54
def events(start_time=nil,end_time=nil)
  if start_time.nil?
    @events ||= PlaylyfeClient::V2::EventCollection.new(self)
  else  
    PlaylyfeClient::V2::EventCollection.new(self, self.connection.get_game_events_array(start_time, end_time))
  end
end
image_data(style=:original) click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 48
def image_data(style=:original)
  data=connection.get_game_image_data
  puts(data)
end
leaderboards() click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 44
def leaderboards
  @leaderboards ||= PlaylyfeClient::V2::LeaderboardCollection.new(self)
end
metrics() click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 32
def metrics
  @metrics ||= PlaylyfeClient::V2::MetricCollection.new(self)
end
players() click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 24
def players
  @players ||= PlaylyfeClient::V2::PlayerCollection.new(self)
end
teams() click to toggle source
# File lib/playlyfe_client/v2/game.rb, line 28
def teams 
  @teams ||= PlaylyfeClient::V2::TeamCollection.new(self)
end