nfl_data 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 76aafbb6c1f23945d6989f38524dea8879050b4e
4
- data.tar.gz: 75b9447480541f4953160686f7a6c78f48d70ad7
3
+ metadata.gz: ad42de07246821b18e092d1a55ee59c8e6677f5f
4
+ data.tar.gz: 854728d10139e95adc91438f49a672ab8d3e3a7c
5
5
  SHA512:
6
- metadata.gz: e961087eea50af8160bae218d01a68718aae3359daeb2d01a577f4ba6e2b031bf694348eee4b2f09071a3400d734465f97500f05da4f5bb7e6faaf69d10572fc
7
- data.tar.gz: 2ba232651330a087e758325ffb61819e82ad67cee0192ab4e7a300f7b4daa5ff46ca1f8bb6325001ebe8d3d1b5cbfcaeaa033d827625025ac1a07796c4e0ef24
6
+ metadata.gz: 6705b8a6e4843e7c87fccc8478eff4c945b38bdcedc1181da89f728789b2b4cc9d5beaf9bd63bccdf36c48fd5c5e49cd57d54e754ec5e1d5a8a62b151ed08b27
7
+ data.tar.gz: b4bb0a5e344802f21b6b1bf15053df12ecaf40efbb3bf95bfdcb78e0a1992ecc6ecb1118181a22bb0a0f73c9b45f0cdd5a149a31dd54ef33d5e991f13fde79eb
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'irb'
5
+ require 'irb/completion'
6
+ require 'nfl_data'
7
+
8
+ IRB.start
@@ -22,14 +22,15 @@ module NflData
22
22
  end
23
23
 
24
24
  class Game
25
- attr_accessor :week, :opponent, :date, :time
25
+ attr_accessor :week, :opponent, :date, :time, :home_game
26
26
 
27
27
  def to_hash
28
28
  {
29
29
  week: week,
30
30
  opponent: opponent,
31
31
  date: date,
32
- time: time
32
+ time: time,
33
+ home_game: home_game
33
34
  }
34
35
  end
35
36
  end
@@ -59,7 +59,9 @@ module NflData
59
59
  game.week = elements[0].inner_text.strip
60
60
  game.date = elements[1].inner_text.strip
61
61
  game.time = elements[3].nil? ? nil : elements[3].inner_text.strip
62
- game.opponent = get_opponent(team, elements[2].search('a'))
62
+ participants = elements[2].search('a')
63
+ game.opponent = get_opponent(team, participants)
64
+ game.home_game = home_game?(team, participants)
63
65
  schedule.games << game
64
66
  end
65
67
  end
@@ -74,5 +76,11 @@ module NflData
74
76
  return participants[1].inner_text.strip if team.short_name == p1
75
77
  p1
76
78
  end
79
+
80
+ def home_game?(team, participants)
81
+ return nil if participants[0].nil?
82
+ home_team = participants[1].inner_text.strip
83
+ home_team == team.short_name
84
+ end
77
85
  end
78
86
  end
@@ -1,3 +1,3 @@
1
1
  module NflData
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -19,7 +19,7 @@ describe PlayerParser do
19
19
  response = @parser.get_by_position(:quarterbacks)
20
20
 
21
21
  response.keys.must_include :quarterbacks
22
- response[:quarterbacks].count.must_equal 125
22
+ response[:quarterbacks].count.must_equal 121
23
23
  end
24
24
  end
25
25
 
@@ -28,7 +28,7 @@ describe PlayerParser do
28
28
  response = @parser.get_by_position(:runningbacks)
29
29
 
30
30
  response.keys.must_include :runningbacks
31
- response[:runningbacks].count.must_equal 261
31
+ response[:runningbacks].count.must_equal 231
32
32
  end
33
33
  end
34
34
 
@@ -37,7 +37,7 @@ describe PlayerParser do
37
37
  response = @parser.get_by_position(:wide_receivers)
38
38
 
39
39
  response.keys.must_include :wide_receivers
40
- response[:wide_receivers].count.must_equal 387
40
+ response[:wide_receivers].count.must_equal 373
41
41
  end
42
42
  end
43
43
 
@@ -46,7 +46,7 @@ describe PlayerParser do
46
46
  response = @parser.get_by_position(:tight_ends)
47
47
 
48
48
  response.keys.must_include :tight_ends
49
- response[:tight_ends].count.must_equal 197
49
+ response[:tight_ends].count.must_equal 190
50
50
  end
51
51
  end
52
52
 
@@ -55,10 +55,10 @@ describe PlayerParser do
55
55
  response = @parser.get_by_position(:all)
56
56
 
57
57
  {
58
- quarterbacks: 125,
59
- runningbacks: 261,
60
- wide_receivers: 387,
61
- tight_ends: 197
58
+ quarterbacks: 121,
59
+ runningbacks: 231,
60
+ wide_receivers: 373,
61
+ tight_ends: 190
62
62
  }.each do |position, player_count|
63
63
  response.keys.must_include position
64
64
  response[position].count.must_equal player_count
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfl_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - thetizzo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-09 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,7 +97,8 @@ dependencies:
97
97
  description: Parse NFL data like a boss
98
98
  email:
99
99
  - j.m.taylor1@gmail.com
100
- executables: []
100
+ executables:
101
+ - console
101
102
  extensions: []
102
103
  extra_rdoc_files: []
103
104
  files:
@@ -106,6 +107,7 @@ files:
106
107
  - LICENSE.txt
107
108
  - README.md
108
109
  - Rakefile
110
+ - bin/console
109
111
  - lib/nfl_data.rb
110
112
  - lib/nfl_data/api/player.rb
111
113
  - lib/nfl_data/api/statline.rb