class NflData::PlayerParser

Attributes

base_url[R]

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

get_by_position(position) click to toggle source
# 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