Class: Sportradar::Api::Football::Nfl::TeamDepthChart

Inherits:
Data
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sportradar/api/football/nfl/team_depth_chart.rb

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, **opts) ⇒ TeamDepthChart

data.keys => [“offense”, “defense”, “special_teams”, “name”, “market”, “alias”, “id”]



11
12
13
14
15
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 11

def initialize(data, **opts)
  @response = data
  @team_id  = data['id']
  @abbrev   = data['alias']
end

Instance Attribute Details

#abbrevObject

Returns the value of attribute abbrev.



7
8
9
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 7

def abbrev
  @abbrev
end

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 7

def response
  @response
end

#seasonObject

Returns the value of attribute season.



7
8
9
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 7

def season
  @season
end

#team_idObject Also known as: id

Returns the value of attribute team_id.



7
8
9
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 7

def team_id
  @team_id
end

Instance Method Details

#defenseObject



21
22
23
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 21

def defense
  @defense ||= DepthChart.new(response['defense']) if response['defense']
end

#eachObject



29
30
31
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 29

def each
  [:offense, :defense, :special_teams].each { |type| yield type, send(type) }
end

#offenseObject



17
18
19
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 17

def offense
  @offense ||= DepthChart.new(response['offense']) if response['offense']
end

#special_teamsObject



25
26
27
# File 'lib/sportradar/api/football/nfl/team_depth_chart.rb', line 25

def special_teams
  @special_teams ||= DepthChart.new(response['special_teams']) if response['special_teams']
end