Class: SportsDataApi::Nfl::Drive

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/nfl/drive.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_hash) ⇒ Drive

Returns a new instance of Drive.



6
7
8
9
10
11
12
# File 'lib/sports_data_api/nfl/drive.rb', line 6

def initialize(event_hash)
  @id = event_hash["id"]
  @clock = event_hash["clock"]
  @type = event_hash["type"]
  @team= event_hash["team"]
  @actions = Actions.build_actions(event_hash["actions"])
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



4
5
6
# File 'lib/sports_data_api/nfl/drive.rb', line 4

def actions
  @actions
end

#clockObject (readonly)

Returns the value of attribute clock.



4
5
6
# File 'lib/sports_data_api/nfl/drive.rb', line 4

def clock
  @clock
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/sports_data_api/nfl/drive.rb', line 4

def id
  @id
end

#teamObject (readonly)

Returns the value of attribute team.



4
5
6
# File 'lib/sports_data_api/nfl/drive.rb', line 4

def team
  @team
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/sports_data_api/nfl/drive.rb', line 4

def type
  @type
end

Instance Method Details

#event_actionsObject



18
19
20
# File 'lib/sports_data_api/nfl/drive.rb', line 18

def event_actions
  actions.select {|i| i.class == SportsDataApi::Nfl::EventAction }
end

#play_actionsObject



14
15
16
# File 'lib/sports_data_api/nfl/drive.rb', line 14

def play_actions
  actions.select {|i| i.class == SportsDataApi::Nfl::PlayAction}
end