Class: NflData::PlayerParser

Inherits:
Object
  • Object
show all
Includes:
ParserHelper
Defined in:
lib/fantasy_foobar/kickers_included.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlayerParser

Returns a new instance of PlayerParser.



9
10
11
# File 'lib/fantasy_foobar/kickers_included.rb', line 9

def initialize
  @base_url = 'http://www.nfl.com/players/search?category=position&conferenceAbbr=null&playerType=current&conference=ALL&filter='
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



7
8
9
# File 'lib/fantasy_foobar/kickers_included.rb', line 7

def base_url
  @base_url
end

Instance Method Details

#get_by_position(position) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fantasy_foobar/kickers_included.rb', line 13

def get_by_position(position)
  if position == :all
    {
      quarterbacks: get('quarterback'),
      runningbacks: get('runningback'),
      wide_receivers: get('widereceiver'),
      tight_ends: get('tightend'),
      kickers: get('kicker')
    }
  else
    { position => get(position.to_s.gsub(/s|_/, '')) }
  end
end