fantasy-football 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b28a69596c517566201c97b7a83ce6dceb19a9d3ad23b4b6daaf68d65886a785
4
- data.tar.gz: 72850a8b5d8dba99bc13b492f91659e54c34f8c346e47ebe1f8bfa5a0aa28a22
3
+ metadata.gz: c5a59bd1cc3884b50de0f7fe08b14a0477000cae4d74b12e1fc26a8c806a598a
4
+ data.tar.gz: c2208dc6a42677c479d58f65ead6ff7a01a041d7349e456019c4a52bee4567ff
5
5
  SHA512:
6
- metadata.gz: be152a71fedd40cb6e418894ecd83f107c42b11f974c75ad0ee0733a402bd5e06f60612a0b51aa2808b9cb45dc7ae64ad60c16c97ffae4316734d43308ea696d
7
- data.tar.gz: ef77a72dae2385e831f77d821f5329e3d91337913956ff324dcf5219018c60817c6efe05c89c6eb75dd9500717209a1cf9a0141e7c76d7744a246efe650bbc31
6
+ metadata.gz: fd9c8efb194ab0cf4e5332997d4e90d7723275e994f5e1ef5db6202be9503bf52b6d4d8b5c9fb325beb3c7aa3f4d95f7c0ba922ff7b97d8d443e586e9dbf4d8c
7
+ data.tar.gz: 272c79fa3c56869d9cdc808d1a96d842afdd171876634ade6ae3d01dfc169dfa7eb8662ce010126daba2c5a4b844a74b86d1fe2456ea7b80cfabf4a3e8ac49b8
@@ -26,8 +26,9 @@ class FantasyFootball::CLI
26
26
  def print_rankings
27
27
  # Iterates through Player.all to print player name and rankings by position
28
28
  puts " "
29
- puts "-- Top #{FantasyFootball::Scraper.size} #{position.upcase}s for Week #{11} of #{Time.new.year} --"
30
- FantasyFootball::Player.find_by_position(position).sort {|a,b| a.rank.to_i <=> b.rank.to_i}.each {|i| puts "#{i.rank}. #{i.name}"}
29
+ FantasyFootball::Player.find_by_position(position).sort {|a,b| a.rank.to_i <=> b.rank.to_i}.each_with_index {| p, i|
30
+ puts "-- Top #{FantasyFootball::Scraper.size} #{position.upcase}s for Week #{p.week} of #{Time.new.year} --" if i == 0
31
+ puts "#{p.rank}. #{p.name}"}
31
32
  puts " "
32
33
  end
33
34
 
@@ -3,7 +3,7 @@ class FantasyFootball::Player
3
3
  extend Findable::ClassMethods
4
4
  include Memorable::InstanceMethods
5
5
 
6
- attr_accessor :name, :position, :projection, :team, :height, :weight, :age, :college, :rank, :url
6
+ attr_accessor :name, :position, :projection, :team, :height, :weight, :age, :college, :rank, :url, :week
7
7
 
8
8
  @@all = []
9
9
 
@@ -7,12 +7,12 @@ class FantasyFootball::Scraper
7
7
  def self.scrape_rankings(position)
8
8
  doc = Nokogiri::HTML(open("https://www.fantasypros.com/nfl/rankings/#{position}.php"))
9
9
  # binding.pry
10
- @week = doc.css('h1').text.split[5]
10
+ week = doc.css('h1').text.split[5]
11
11
  table = doc.css('tbody tr') # Selects the HTML table with player rankings
12
- build_players(table, position)
12
+ build_players(table, position, week)
13
13
  end
14
14
 
15
- def self.build_players(table,position)
15
+ def self.build_players(table, position, week)
16
16
  # Input is HTML table of player rankings, instantiates Players, assigns name, rank, and url
17
17
  table.each_with_index do |t, i|
18
18
  if i < size
@@ -20,6 +20,7 @@ class FantasyFootball::Scraper
20
20
  p.name = [t.text.split[1], t.text.split[3]].join(" ")
21
21
  p.rank = t.text.split[0]
22
22
  p.url = "https://www.fantasypros.com" + t.css('a')[0]["href"]
23
+ p.week = week
23
24
  p.position = position.upcase
24
25
  end
25
26
  end
@@ -1,3 +1,3 @@
1
1
  module FantasyFootball
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fantasy-football
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - "'Mike Dilley'"