Class: NflData::Api::Statline
- Inherits:
-
Object
- Object
- NflData::Api::Statline
- Defined in:
- lib/nfl_data/api/statline.rb
Instance Attribute Summary collapse
-
#feed ⇒ Object
readonly
Returns the value of attribute feed.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
-
#initialize(parser: Parsers::StatlineParser.new, feed: MySportsFeeds::WeeklyPlayerGamelogs.new) ⇒ Statline
constructor
A new instance of Statline.
- #statlines(year:, week:) ⇒ Object
Constructor Details
#initialize(parser: Parsers::StatlineParser.new, feed: MySportsFeeds::WeeklyPlayerGamelogs.new) ⇒ Statline
Returns a new instance of Statline.
6 7 8 9 |
# File 'lib/nfl_data/api/statline.rb', line 6 def initialize(parser: Parsers::StatlineParser.new, feed: MySportsFeeds::WeeklyPlayerGamelogs.new) @parser = parser @feed = feed end |
Instance Attribute Details
#feed ⇒ Object (readonly)
Returns the value of attribute feed.
4 5 6 |
# File 'lib/nfl_data/api/statline.rb', line 4 def feed @feed end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
4 5 6 |
# File 'lib/nfl_data/api/statline.rb', line 4 def parser @parser end |
Instance Method Details
#statlines(year:, week:) ⇒ Object
11 12 13 14 |
# File 'lib/nfl_data/api/statline.rb', line 11 def statlines(year:, week:) statline_data = feed.feed(season_start_year: year, week: week) {statlines: parser.parse(statline_data: statline_data).map(&:to_h)}.to_json end |