Class: NflData::Api::Schedule

Inherits:
Object
  • Object
show all
Defined in:
lib/nfl_data/api/schedule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parsers::ScheduleParser.new, feed: MySportsFeeds::SeasonalGamesFeed.new) ⇒ Schedule



8
9
10
11
# File 'lib/nfl_data/api/schedule.rb', line 8

def initialize(parser: Parsers::ScheduleParser.new, feed: MySportsFeeds::SeasonalGamesFeed.new)
  @parser = parser
  @feed = feed
end

Instance Attribute Details

#feedObject (readonly)

Returns the value of attribute feed.



6
7
8
# File 'lib/nfl_data/api/schedule.rb', line 6

def feed
  @feed
end

#parserObject (readonly)

Returns the value of attribute parser.



6
7
8
# File 'lib/nfl_data/api/schedule.rb', line 6

def parser
  @parser
end

Instance Method Details

#season(year:) ⇒ Object



13
14
15
16
# File 'lib/nfl_data/api/schedule.rb', line 13

def season(year:)
  schedule_data = feed.feed(season_start_year: year)
  parser.parse(schedule_data: schedule_data).to_h.to_json
end