class Sportradar::Mlb::Parsers::PlayByPlayParser
Attributes
game_play_by_play[R]
Public Class Methods
new(game_play_by_play: {})
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 5 def initialize(game_play_by_play: {}) @game_play_by_play = game_play_by_play['game'] || game_play_by_play end
Public Instance Methods
at_bat_summary()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 33 def at_bat_summary at_bats.map(&:to_s) end
at_bats()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 29 def at_bats Models::AtBat.from_innings(game_id: game_id, innings: innings) end
away()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 13 def away game_play_by_play['away'] || {} end
away_team_id()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 17 def away_team_id away['id'] end
game_id()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 9 def game_id game_play_by_play['id'] end
home()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 21 def home game_play_by_play['home'] || {} end
innings()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 25 def innings game_play_by_play['innings'] || [] end
pitch_summary()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 41 def pitch_summary pitches.map(&:to_s) end
pitches()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 37 def pitches Models::Pitch.from_at_bats(game_id: game_id, at_bats: at_bats) end
putouts()
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 45 def putouts end
Private Instance Methods
build_play_by_play(team_id:, event:)
click to toggle source
# File lib/sportradar/mlb/parsers/play_by_play_parser.rb, line 52 def build_play_by_play(team_id:, event:) Sportradar::Mlb::Models::PlayByPlay.new(game_id: game_id, team_id: team_id, event: event) end