Class: AhlScraper::PlayerGames::DataFetcher
- Inherits:
-
Object
- Object
- AhlScraper::PlayerGames::DataFetcher
- Defined in:
- lib/ahl_scraper/fetchers/player_games/data_fetcher.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(player_id, season_id) ⇒ DataFetcher
constructor
A new instance of DataFetcher.
Constructor Details
#initialize(player_id, season_id) ⇒ DataFetcher
Returns a new instance of DataFetcher.
6 7 8 9 |
# File 'lib/ahl_scraper/fetchers/player_games/data_fetcher.rb', line 6 def initialize(player_id, season_id) @player_id = player_id @season_id = season_id end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 |
# File 'lib/ahl_scraper/fetchers/player_games/data_fetcher.rb', line 11 def call player_data = JSON.parse(player_data_without_bio, symbolize_names: true) player_data&.dig(:gameByGame, 0, :sections, 0, :data)&.map { |data| { **data, position: player_data[:info][:position] } } end |