nfl_data 0.0.10 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.envrc +7 -0
  3. data/.gitignore +3 -3
  4. data/.rspec +1 -0
  5. data/.standard.yml +2 -0
  6. data/.travis.yml +6 -0
  7. data/CHANGELOG.md +7 -0
  8. data/Gemfile +1 -1
  9. data/README.md +94 -21
  10. data/Rakefile +5 -6
  11. data/bin/console +1 -1
  12. data/bin/setup +8 -0
  13. data/lib/nfl_data.rb +10 -18
  14. data/lib/nfl_data/api/player.rb +8 -30
  15. data/lib/nfl_data/api/schedule.rb +19 -0
  16. data/lib/nfl_data/api/statline.rb +8 -23
  17. data/lib/nfl_data/models/game.rb +5 -0
  18. data/lib/nfl_data/models/player.rb +11 -19
  19. data/lib/nfl_data/models/schedule.rb +12 -0
  20. data/lib/nfl_data/models/statline.rb +18 -28
  21. data/lib/nfl_data/my_sports_feeds/client.rb +45 -0
  22. data/lib/nfl_data/my_sports_feeds/players_feed.rb +18 -0
  23. data/lib/nfl_data/my_sports_feeds/seasonal_games_feed.rb +22 -0
  24. data/lib/nfl_data/my_sports_feeds/weekly_player_gamelogs.rb +21 -0
  25. data/lib/nfl_data/parsers/player_parser.rb +21 -81
  26. data/lib/nfl_data/parsers/schedule_parser.rb +20 -0
  27. data/lib/nfl_data/parsers/statline_parser.rb +27 -76
  28. data/lib/nfl_data/version.rb +1 -1
  29. data/nfl_data.gemspec +23 -21
  30. data/spec/api/player_spec.rb +24 -0
  31. data/spec/api/schedule_spec.rb +20 -0
  32. data/spec/api/statline_spec.rb +31 -0
  33. data/spec/models/game_spec.rb +15 -0
  34. data/spec/models/player_spec.rb +42 -0
  35. data/spec/models/schedule_spec.rb +17 -0
  36. data/spec/models/statline_spec.rb +63 -0
  37. data/spec/my_sports_feeds/client_spec.rb +17 -0
  38. data/spec/my_sports_feeds/players_feed_spec.rb +49 -0
  39. data/spec/my_sports_feeds/seasonal_games_feed_spec.rb +41 -0
  40. data/spec/my_sports_feeds/weekly_player_gamelogs_spec.rb +144 -0
  41. data/spec/parsers/player_parser_spec.rb +63 -0
  42. data/spec/parsers/schedule_parser_spec.rb +41 -0
  43. data/spec/parsers/statline_parser_spec.rb +68 -0
  44. data/spec/spec_helper.rb +55 -0
  45. metadata +107 -45
  46. data/lib/nfl_data/api/team.rb +0 -26
  47. data/lib/nfl_data/models/team.rb +0 -39
  48. data/lib/nfl_data/parsers/parser_helper.rb +0 -6
  49. data/lib/nfl_data/parsers/team_parser.rb +0 -91
  50. data/test/nfl_data/api/player_test.rb +0 -25
  51. data/test/nfl_data/api/statline_test.rb +0 -21
  52. data/test/nfl_data/api/team_test.rb +0 -13
  53. data/test/nfl_data/models/player_test.rb +0 -75
  54. data/test/nfl_data/models/statline_test.rb +0 -126
  55. data/test/nfl_data/models/team_test.rb +0 -45
  56. data/test/nfl_data/parsers/player_parser_test.rb +0 -80
  57. data/test/nfl_data/parsers/statline_parser_test.rb +0 -35
  58. data/test/nfl_data/parsers/team_parser_test.rb +0 -41
  59. data/test/test_helper.rb +0 -12
@@ -1,80 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe PlayerParser do
4
- before do
5
- @parser = PlayerParser.new
6
- end
7
-
8
- after do
9
- @parser = nil
10
- end
11
-
12
- it 'should know the correct base url' do
13
- @parser.base_url.must_equal "http://www.nfl.com/players/search?category=position&conferenceAbbr=null&playerType=current&conference=ALL&filter="
14
- end
15
-
16
- describe 'get_by_position' do
17
- it 'should get quarterbacks' do
18
- VCR.use_cassette('quarterbacks') do
19
- response = @parser.get_by_position(:quarterbacks)
20
-
21
- response.keys.must_include :quarterbacks
22
- response[:quarterbacks].count.must_equal 123
23
- end
24
- end
25
-
26
- it 'should get runningbacks' do
27
- VCR.use_cassette('runningbacks') do
28
- response = @parser.get_by_position(:runningbacks)
29
-
30
- response.keys.must_include :runningbacks
31
- response[:runningbacks].count.must_equal 245
32
- end
33
- end
34
-
35
- it 'should get wide receivers' do
36
- VCR.use_cassette('wide_receivers') do
37
- response = @parser.get_by_position(:wide_receivers)
38
-
39
- response.keys.must_include :wide_receivers
40
- response[:wide_receivers].count.must_equal 398
41
- end
42
- end
43
-
44
- it 'should get tight ends' do
45
- VCR.use_cassette('tight_ends') do
46
- response = @parser.get_by_position(:tight_ends)
47
-
48
- response.keys.must_include :tight_ends
49
- response[:tight_ends].count.must_equal 206
50
- end
51
- end
52
-
53
- it 'should get all the players' do
54
- VCR.use_cassette('all_players') do
55
- response = @parser.get_by_position(:all)
56
-
57
- {
58
- quarterbacks: 123,
59
- runningbacks: 245,
60
- wide_receivers: 398,
61
- tight_ends: 206
62
- }.each do |position, player_count|
63
- response.keys.must_include position
64
- response[position].count.must_equal player_count
65
- end
66
- end
67
- end
68
-
69
- it 'should use JAX as Jacksonville abbreviation for all JAX team players' do
70
- VCR.use_cassette('all_players') do
71
- response = @parser.get_by_position(:all)
72
-
73
- players = [response[:quarterbacks], response[:runningbacks], response[:wide_receivers], response[:tight_ends]].flatten
74
-
75
- players.any? {|player| player[:team] == 'JAX'}.must_equal true
76
- players.none? {|player| player[:team] == 'JAC'}.must_equal true
77
- end
78
- end
79
- end
80
- end
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe StatlineParser do
4
- before do
5
- @parser = StatlineParser.new
6
- end
7
-
8
- after do
9
- @parser = nil
10
- end
11
-
12
- describe 'get' do
13
- it 'should get passing statlines' do
14
- VCR.use_cassette('passing') do
15
- response = @parser.get(4, 2014, :passing)
16
- response.count.must_equal 34
17
- end
18
- end
19
-
20
- it 'should get rushing statlines' do
21
- VCR.use_cassette('rushing') do
22
- response = @parser.get(4, 2014, :rushing)
23
- response.count.must_equal 106
24
- end
25
- end
26
-
27
- it 'should get receiving statlines' do
28
- VCR.use_cassette('receiving') do
29
- response = @parser.get(4, 2014, :receiving)
30
- response.count.must_equal 210
31
- end
32
- end
33
-
34
- end
35
- end
@@ -1,41 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe TeamParser do
4
- before do
5
- @parser = TeamParser.new
6
- end
7
-
8
- after do
9
- @parser = nil
10
- end
11
-
12
- it 'should know the correct base url' do
13
- @parser.base_url.must_equal "http://www.nfl.com/standings?category=league&split=Overall&season="
14
- end
15
-
16
- describe 'get_by_year' do
17
- it 'should get all the teams for year without schedule' do
18
- VCR.use_cassette('teams_without_schedule') do
19
- @parser.get_by_year(2014, false).count.must_equal 32
20
- end
21
- end
22
-
23
- it 'should get all the teams for year with schedule' do
24
- VCR.use_cassette('teams_with_schedule') do
25
- result = @parser.get_by_year(2014, true)
26
- result.count.must_equal 32
27
- result.each do |team|
28
- team[:schedule].count.must_equal 17 # includes bye weeks
29
- end
30
- end
31
- end
32
-
33
- it 'should use JAX as the abbreviation for Jacksonville' do
34
- VCR.use_cassette('teams_with_schedule') do
35
- result = @parser.get_by_year(2014, true)
36
- result.any? {|team| team[:short_name] == 'JAX'}.must_equal true
37
- result.none? {|team| team[:short_name] == 'JAC'}.must_equal true
38
- end
39
- end
40
- end
41
- end
@@ -1,12 +0,0 @@
1
- require 'nfl_data'
2
-
3
- require 'minitest/autorun'
4
- require 'minitest/pride'
5
- require 'vcr'
6
-
7
- include NflData
8
-
9
- VCR.configure do |c|
10
- c.cassette_library_dir = 'test/fixtures/cassettes'
11
- c.hook_into :webmock
12
- end