Class: NflData::Api::Player
- Inherits:
-
Object
- Object
- NflData::Api::Player
- Defined in:
- lib/nfl_data/api/player.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::PlayerParser.new, feed: MySportsFeeds::PlayersFeed.new) ⇒ Player
constructor
A new instance of Player.
- #players(position: nil) ⇒ Object
Constructor Details
#initialize(parser: Parsers::PlayerParser.new, feed: MySportsFeeds::PlayersFeed.new) ⇒ Player
Returns a new instance of Player.
6 7 8 9 |
# File 'lib/nfl_data/api/player.rb', line 6 def initialize(parser: Parsers::PlayerParser.new, feed: MySportsFeeds::PlayersFeed.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/player.rb', line 4 def feed @feed end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
4 5 6 |
# File 'lib/nfl_data/api/player.rb', line 4 def parser @parser end |
Instance Method Details
#players(position: nil) ⇒ Object
11 12 13 14 |
# File 'lib/nfl_data/api/player.rb', line 11 def players(position: nil) player_data = feed.feed(position: position) {players: parser.parse(player_data: player_data).map(&:to_h)}.to_json end |