Class: PlaylyfeClient::V2::Game

Inherits:
Game
  • Object
show all
Defined in:
lib/playlyfe_client/v2/game.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from Game

#connection, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Game

#to_hash

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



17
18
19
# File 'lib/playlyfe_client/v2/game.rb', line 17

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



17
18
19
# File 'lib/playlyfe_client/v2/game.rb', line 17

def description
  @description
end

#game_hashObject (readonly)

Returns the value of attribute game_hash.



17
18
19
# File 'lib/playlyfe_client/v2/game.rb', line 17

def game_hash
  @game_hash
end

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/playlyfe_client/v2/game.rb', line 17

def id
  @id
end

#ignore_rate_limit_errorsObject

Returns the value of attribute ignore_rate_limit_errors.



18
19
20
# File 'lib/playlyfe_client/v2/game.rb', line 18

def ignore_rate_limit_errors
  @ignore_rate_limit_errors
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



17
18
19
# File 'lib/playlyfe_client/v2/game.rb', line 17

def timezone
  @timezone
end

#typeObject (readonly)

Returns the value of attribute type.



17
18
19
# File 'lib/playlyfe_client/v2/game.rb', line 17

def type
  @type
end

Class Method Details

.find_by_connection(conn) ⇒ Object



20
21
22
# File 'lib/playlyfe_client/v2/game.rb', line 20

def self.find_by_connection(conn)
  PlaylyfeClient::V2::Game.new(conn)
end

Instance Method Details

#actionsObject



36
37
38
# File 'lib/playlyfe_client/v2/game.rb', line 36

def actions
  @actions ||= PlaylyfeClient::V2::ActionCollection.new(self)
end

#available_actionsObject



40
41
42
# File 'lib/playlyfe_client/v2/game.rb', line 40

def available_actions
  actions
end

#events(start_time = nil, end_time = nil) ⇒ Object

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



54
55
56
57
58
59
60
# 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) ⇒ Object



48
49
50
51
# File 'lib/playlyfe_client/v2/game.rb', line 48

def image_data(style=:original)
  data=connection.get_game_image_data
  puts(data)
end

#leaderboardsObject



44
45
46
# File 'lib/playlyfe_client/v2/game.rb', line 44

def leaderboards
  @leaderboards ||= PlaylyfeClient::V2::LeaderboardCollection.new(self)
end

#metricsObject



32
33
34
# File 'lib/playlyfe_client/v2/game.rb', line 32

def metrics
  @metrics ||= PlaylyfeClient::V2::MetricCollection.new(self)
end

#playersObject



24
25
26
# File 'lib/playlyfe_client/v2/game.rb', line 24

def players
  @players ||= PlaylyfeClient::V2::PlayerCollection.new(self)
end

#teamsObject



28
29
30
# File 'lib/playlyfe_client/v2/game.rb', line 28

def teams 
  @teams ||= PlaylyfeClient::V2::TeamCollection.new(self)
end