Class: FootballApi::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/football_api/match_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Stats

Returns a new instance of Stats.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/football_api/match_stats.rb', line 17

def initialize(hash = {})
  @total_shots    = hash[:shots][:total]          if hash[:shots]
  @ongoal_shots   = hash[:shots][:ongoal]         if hash[:shots]
  @fouls          = hash[:fouls][:total]          if hash[:fouls]
  @corners        = hash[:corners][:total]        if hash[:corners]
  @offsides       = hash[:offsides][:total]       if hash[:offsides]
  @possestiontime = hash[:possestiontime][:total] if hash[:possestiontime]
  @yellowcards    = hash[:yellowcards][:total]    if hash[:yellowcards]
  @redcards       = hash[:redcards][:total]       if hash[:redcards]
  @saves          = hash[:saves][:total]          if hash[:saves]
end

Instance Attribute Details

#cornersObject

Returns the value of attribute corners.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def corners
  @corners
end

#foulsObject

Returns the value of attribute fouls.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def fouls
  @fouls
end

#offsidesObject

Returns the value of attribute offsides.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def offsides
  @offsides
end

#ongoal_shotsObject

Returns the value of attribute ongoal_shots.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def ongoal_shots
  @ongoal_shots
end

#possestiontimeObject

Returns the value of attribute possestiontime.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def possestiontime
  @possestiontime
end

#redcardsObject

Returns the value of attribute redcards.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def redcards
  @redcards
end

#savesObject

Returns the value of attribute saves.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def saves
  @saves
end

#total_shotsObject

Returns the value of attribute total_shots.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def total_shots
  @total_shots
end

#yellowcardsObject

Returns the value of attribute yellowcards.



14
15
16
# File 'lib/football_api/match_stats.rb', line 14

def yellowcards
  @yellowcards
end