Class: Sportradar::Api::Football::StatPack

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/football/stat_pack.rb

Defined Under Namespace

Classes: Defense, ExtraPoints, FieldGoals, Fumbles, IntReturns, KickReturns, Kickoffs, MiscReturns, Passing, Penalties, PuntReturns, Punts, Receiving, Rushing

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Data

#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data

Constructor Details

#initialize(data) ⇒ StatPack

Returns a new instance of StatPack.



7
8
9
10
11
12
13
14
15
16
# File 'lib/sportradar/api/football/stat_pack.rb', line 7

def initialize(data)
  if data['name']
    @response = data
    @player = Sportradar::Api::Football::Nfl::Player.new(data) # need to handle ncaa/nfl, although it may not matter
  else
    @response = data['team'] || data['totals'] || data['kicks']
    @players = parse_into_array(selector: data["players"], klass: self.class) if data["players"]
  end
  set_stats
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def name
  @name
end

#playerObject

Returns the value of attribute player.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def player
  @player
end

#playersObject

Returns the value of attribute players.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def players
  @players
end

#positionObject

Returns the value of attribute position.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def position
  @position
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def response
  @response
end

#yardsObject

Returns the value of attribute yards.



5
6
7
# File 'lib/sportradar/api/football/stat_pack.rb', line 5

def yards
  @yards
end