mlb_gameday 0.1.9 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 659644f1bee589e3bf02073d2d8759404932132d
4
- data.tar.gz: 18d9c42c2405de51871523f667370b6cb9c0c88a
3
+ metadata.gz: ffc7edac538b2d044423bf79f8a6212cbc149fd4
4
+ data.tar.gz: b3d1fcc715b2c8fa71ee72718161336803f0a8e8
5
5
  SHA512:
6
- metadata.gz: cd54b4d1546656b9bc4eb464e92e103e5ad753558447de06c3d221bdceb9364e7454689b1476bc6052a81de537029ebec49a88634b0389e2250338cde1a0e24a
7
- data.tar.gz: 3a2fc51fbd9564432d5c623a2c38838977c25529adf6d895f245f5efea82690dbff2bbbb81246c0016edf2387e324f5388fe5edbf2527d2abb38e36bdae52ebc
6
+ metadata.gz: 2240a4e97e7a6797d3370e60a57bfdb0c6c0792febf959555062dd328cd0f0dee0c821b2a43e19e0cbda1204103bc5c568d2559d0edb5d8ba02c55ae3d1f157c
7
+ data.tar.gz: 2b95fe77dc317cf0a63c95cd8f6efd3773a208337bb26c5774b905bcfeaa68773a70e9c22ae4e05464b43fc26ec866fc3b2dda5b827c3e6d763b8668dd1eb465
@@ -2,6 +2,7 @@ AllCops:
2
2
  Include:
3
3
  - Rakefile
4
4
  - Gemfile
5
+ TargetRubyVersion: 2.4
5
6
 
6
7
  Metrics/AbcSize:
7
8
  Enabled: false
@@ -17,3 +18,6 @@ Metrics/MethodLength:
17
18
 
18
19
  Style/Documentation:
19
20
  Enabled: false
21
+
22
+ Style/MultilineMethodCallIndentation:
23
+ EnforcedStyle: indented
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ * Added game attendance, weather, wind, elapsed time, and umpires
6
+ * Understand a few more game statuses
7
+ * Use Ruby 2.4 lonely operator (&.) **This drops compatibility for Ruby 2.3 and below.**
8
+ * Fixed implicit names bug (thanks to @cacqw7) [#4](https://github.com/Fustrate/mlb_gameday/pull/4)
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
  require 'rspec/core/rake_task'
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'httparty'
2
4
  require 'nokogiri'
3
5
  require 'open-uri'
4
6
  require 'psych'
5
7
  require 'chronic'
6
8
 
7
- %w(version league division team game player pitcher batter).each do |file|
9
+ %w[version league division team game player pitcher batter].each do |file|
8
10
  require "mlb_gameday/#{file}"
9
11
  end
10
12
 
@@ -13,7 +15,7 @@ module MLBGameday
13
15
 
14
16
  BATTER = '/year_%{year}/batters/%{id}'
15
17
  PITCHER = '/year_%{year}/pitchers/%{id}'
16
- BOXSCORE = '/year_%{year}/month_%{month}/day_%{day}/gid_%{gid}/boxscore'
18
+ RAWBOXSCORE = '/year_%{year}/month_%{month}/day_%{day}/gid_%{gid}/rawboxscore'
17
19
  GAMECENTER = '/year_%{year}/month_%{month}/day_%{day}/gid_%{gid}/gamecenter'
18
20
  LINESCORE = '/year_%{year}/month_%{month}/day_%{day}/gid_%{gid}/linescore'
19
21
  SCOREBOARD = '/year_%Y/month_%m/day_%d/miniscoreboard'
@@ -23,7 +25,7 @@ module MLBGameday
23
25
 
24
26
  def initialize
25
27
  @leagues = Psych.load File.open File.join(
26
- File.dirname(File.expand_path __FILE__), '../resources/data.yml'
28
+ File.dirname(File.expand_path(__FILE__)), '../resources/data.yml'
27
29
  )
28
30
  end
29
31
 
@@ -34,11 +36,9 @@ module MLBGameday
34
36
  end
35
37
 
36
38
  def team(name)
37
- if name.is_a? MLBGameday::Team
38
- name
39
- else
40
- teams.select { |team| team.is_called?(name) }.first
41
- end
39
+ return name if name.is_a? MLBGameday::Team
40
+
41
+ teams.find { |team| team.called?(name) }
42
42
  end
43
43
 
44
44
  def teams
@@ -72,7 +72,7 @@ module MLBGameday
72
72
  gid,
73
73
  gamecenter: gamecenter_xml(gid),
74
74
  linescore: linescore_xml(gid),
75
- boxscore: boxscore_xml(gid)
75
+ rawboxscore: rawboxscore_xml(gid)
76
76
  )
77
77
  end
78
78
 
@@ -100,25 +100,21 @@ module MLBGameday
100
100
  end
101
101
 
102
102
  def linescore_xml(gid)
103
- year, month, day, _ = gid.split '_'
103
+ year, month, day, = gid.split '_'
104
104
 
105
105
  fetch_xml LINESCORE, year: year, month: month, day: day, gid: gid
106
106
  end
107
107
 
108
- def boxscore_xml(gid)
109
- year, month, day, _ = gid.split '_'
108
+ def rawboxscore_xml(gid)
109
+ year, month, day, = gid.split '_'
110
110
 
111
- fetch_xml BOXSCORE, year: year, month: month, day: day, gid: gid
112
- rescue
113
- nil
111
+ fetch_xml RAWBOXSCORE, year: year, month: month, day: day, gid: gid
114
112
  end
115
113
 
116
114
  def gamecenter_xml(gid)
117
- year, month, day, _ = gid.split '_'
115
+ year, month, day, = gid.split '_'
118
116
 
119
117
  fetch_xml GAMECENTER, year: year, month: month, day: day, gid: gid
120
- rescue
121
- nil
122
118
  end
123
119
 
124
120
  def batter_xml(id, year: nil)
@@ -126,7 +122,7 @@ module MLBGameday
126
122
  year_data = fetch_xml BATTER, id: id, year: (year || Date.today.year)
127
123
 
128
124
  gid = year_data.xpath('//batting/@game_id').text
129
- year, month, day, _ = gid.split '/'
125
+ year, month, day, = gid.split '/'
130
126
 
131
127
  fetch_xml "/year_#{year}/month_#{month}/day_#{day}/" \
132
128
  "gid_#{gid.gsub(/[^a-z0-9]/, '_')}/batters/#{id}"
@@ -137,7 +133,7 @@ module MLBGameday
137
133
  year_data = fetch_xml PITCHER, id: id, year: (year || Date.today.year)
138
134
 
139
135
  gid = year_data.xpath('//pitching/@game_id').text
140
- year, month, day, _ = gid.split '/'
136
+ year, month, day, = gid.split '/'
141
137
 
142
138
  fetch_xml "/year_#{year}/month_#{month}/day_#{day}/" \
143
139
  "gid_#{gid.gsub(/[^a-z0-9]/, '_')}/pitchers/#{id}"
@@ -146,9 +142,13 @@ module MLBGameday
146
142
  protected
147
143
 
148
144
  def fetch_xml(path, interpolations = {})
149
- Nokogiri::XML open format(API_URL + path + '.xml', interpolations)
150
- rescue OpenURI::HTTPError
151
- false
145
+ full_path = "#{API_URL}#{path}.xml"
146
+
147
+ full_path = format(full_path, interpolations) if interpolations.any?
148
+
149
+ Nokogiri::XML open full_path
150
+ rescue
151
+ nil
152
152
  end
153
153
  end
154
154
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  class Batter < Player
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  class Division
3
5
  attr_reader :id, :league, :name, :teams
@@ -1,25 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  # This class is just too long. It might be able to be split up, but it's not
3
5
  # likely to happen any time soon. For now, we'll disable the cop.
4
6
  # rubocop:disable Metrics/ClassLength
5
7
  class Game
6
- attr_reader :gid, :home_team, :away_team, :linescore, :gamecenter, :boxscore
8
+ attr_reader :gid, :home_team, :away_team, :files
7
9
 
8
- def initialize(api, gid, linescore: nil, gamecenter: nil, boxscore: nil)
10
+ def initialize(api, gid, files = {})
9
11
  @api = api
10
12
  @gid = gid
11
13
 
12
- @linescore = linescore
13
- @gamecenter = gamecenter
14
- @boxscore = boxscore
14
+ @files = files
15
15
 
16
- if linescore
17
- @home_team = @api.team linescore.xpath('//game/@home_name_abbrev').text
18
- @away_team = @api.team linescore.xpath('//game/@away_name_abbrev').text
19
- else
20
- @home_team = @api.team gamecenter.xpath('//game/@id').text[18, 6]
21
- @away_team = @api.team gamecenter.xpath('//game/@id').text[11, 6]
22
- end
16
+ @home_team = @api.team files[:linescore].xpath('//game/@home_team_name').text
17
+ @away_team = @api.team files[:linescore].xpath('//game/@away_team_name').text
23
18
  end
24
19
 
25
20
  def teams
@@ -27,22 +22,24 @@ module MLBGameday
27
22
  end
28
23
 
29
24
  def venue
30
- return @linescore.xpath('//game/@venue').text if @linescore
25
+ if @files[:linescore]
26
+ return @files[:linescore].xpath('//game/@venue').text
27
+ end
31
28
 
32
- @gamecenter.xpath('//game/venueShort').text
29
+ files[:gamecenter].xpath('//game/venueShort').text
33
30
  end
34
31
 
35
32
  def home_start_time(ampm: true)
36
33
  if ampm
37
34
  [
38
- @linescore.xpath('//game/@home_time').text,
39
- @linescore.xpath('//game/@home_ampm').text,
40
- @linescore.xpath('//game/@home_time_zone').text
35
+ @files[:linescore].xpath('//game/@home_time').text,
36
+ @files[:linescore].xpath('//game/@home_ampm').text,
37
+ @files[:linescore].xpath('//game/@home_time_zone').text
41
38
  ].join ' '
42
39
  else
43
40
  [
44
- @linescore.xpath('//game/@home_time').text,
45
- @linescore.xpath('//game/@home_time_zone').text
41
+ @files[:linescore].xpath('//game/@home_time').text,
42
+ @files[:linescore].xpath('//game/@home_time_zone').text
46
43
  ].join ' '
47
44
  end
48
45
  end
@@ -50,41 +47,39 @@ module MLBGameday
50
47
  def away_start_time(ampm: true)
51
48
  if ampm
52
49
  [
53
- @linescore.xpath('//game/@away_time').text,
54
- @linescore.xpath('//game/@away_ampm').text,
55
- @linescore.xpath('//game/@away_time_zone').text
50
+ @files[:linescore].xpath('//game/@away_time').text,
51
+ @files[:linescore].xpath('//game/@away_ampm').text,
52
+ @files[:linescore].xpath('//game/@away_time_zone').text
56
53
  ].join ' '
57
54
  else
58
55
  [
59
- @linescore.xpath('//game/@away_time').text,
60
- @linescore.xpath('//game/@away_time_zone').text
56
+ @files[:linescore].xpath('//game/@away_time').text,
57
+ @files[:linescore].xpath('//game/@away_time_zone').text
61
58
  ].join ' '
62
59
  end
63
60
  end
64
61
 
65
62
  # Preview, Pre-Game, In Progress, Final
66
63
  def status
67
- @status ||= if @linescore
68
- @linescore.xpath('//game/@status').text
69
- else
70
- {
71
- 'P' => 'Preview',
72
- 'I' => 'In Progress',
73
- 'O' => 'Over'
74
- }[@gamecenter.xpath('//game/@status').text]
75
- end
64
+ return 'Preview' unless @files[:linescore]
65
+
66
+ @status ||= @files[:linescore].xpath('//game/@status').text
76
67
  end
77
68
 
78
69
  # [3, Top/Middle/Bottom/End]
79
70
  def inning
80
- return [0, '?'] unless @linescore && @linescore.xpath('//game/@inning')
71
+ return [0, '?'] unless @files[:linescore]&.xpath('//game/@inning')
81
72
 
82
- [@linescore.xpath('//game/@inning').text.to_i,
83
- @linescore.xpath('//game/@inning_state').text]
73
+ [
74
+ @files[:linescore].xpath('//game/@inning').text.to_i,
75
+ @files[:linescore].xpath('//game/@inning_state').text
76
+ ]
84
77
  end
85
78
 
86
79
  def runners
87
- first, second, third = [nil, nil, nil]
80
+ first = nil
81
+ second = nil
82
+ third = nil
88
83
 
89
84
  [first, second, third]
90
85
  end
@@ -92,7 +87,7 @@ module MLBGameday
92
87
  def over?
93
88
  ['Final', 'Game Over', 'Completed Early'].include? status
94
89
  end
95
- alias_method :fat_lady_has_sung?, :over?
90
+ alias fat_lady_has_sung? over?
96
91
 
97
92
  def in_progress?
98
93
  status == 'In Progress'
@@ -107,71 +102,77 @@ module MLBGameday
107
102
  end
108
103
 
109
104
  def home_record
110
- return [0, 0] unless @linescore
105
+ return [0, 0] unless @files[:linescore]
111
106
 
112
- [@linescore.xpath('//game/@home_win'),
113
- @linescore.xpath('//game/@home_loss')].map(&:text).map(&:to_i)
107
+ [
108
+ @files[:linescore].xpath('//game/@home_win'),
109
+ @files[:linescore].xpath('//game/@home_loss')
110
+ ].map(&:text).map(&:to_i)
114
111
  end
115
112
 
116
113
  def away_record
117
- return [0, 0] unless @linescore
114
+ return [0, 0] unless @files[:linescore]
118
115
 
119
- [@linescore.xpath('//game/@away_win'),
120
- @linescore.xpath('//game/@away_loss')].map(&:text).map(&:to_i)
116
+ [
117
+ @files[:linescore].xpath('//game/@away_win'),
118
+ @files[:linescore].xpath('//game/@away_loss')
119
+ ].map(&:text).map(&:to_i)
121
120
  end
122
121
 
123
122
  def current_pitcher
124
123
  return nil unless in_progress?
125
124
 
126
- @api.pitcher @linescore.xpath('//game/current_pitcher/@id').text,
125
+ @api.pitcher @files[:linescore].xpath('//game/current_pitcher/@id').text,
127
126
  year: date.year
128
127
  end
129
128
 
130
129
  def opposing_pitcher
131
130
  return nil unless in_progress?
132
131
 
133
- @api.pitcher @linescore.xpath('//game/opposing_pitcher/@id').text,
132
+ @api.pitcher @files[:linescore].xpath('//game/opposing_pitcher/@id').text,
134
133
  year: date.year
135
134
  end
136
135
 
137
136
  def winning_pitcher
138
137
  return nil unless over?
139
138
 
140
- @api.pitcher @linescore.xpath('//game/winning_pitcher/@id').text,
139
+ @api.pitcher @files[:linescore].xpath('//game/winning_pitcher/@id').text,
141
140
  year: date.year
142
141
  end
143
142
 
144
143
  def losing_pitcher
145
144
  return nil unless over?
146
145
 
147
- @api.pitcher @linescore.xpath('//game/losing_pitcher/@id').text,
146
+ @api.pitcher @files[:linescore].xpath('//game/losing_pitcher/@id').text,
148
147
  year: date.year
149
148
  end
150
149
 
151
150
  def save_pitcher
152
151
  return nil unless over?
153
152
 
154
- @api.pitcher @linescore.xpath('//game/save_pitcher/@id').text,
153
+ @api.pitcher @files[:linescore].xpath('//game/save_pitcher/@id').text,
155
154
  year: date.year
156
155
  end
157
156
 
158
157
  def away_starting_pitcher
159
- return '' unless @linescore
158
+ return '' unless @files[:linescore]
160
159
 
161
- @linescore.xpath('//game/away_probable_pitcher/@id').text
160
+ @files[:linescore].xpath('//game/away_probable_pitcher/@id').text
162
161
  end
163
162
 
164
163
  def home_starting_pitcher
165
- return '' unless @linescore
164
+ return '' unless @files[:linescore]
166
165
 
167
- @linescore.xpath('//game/home_probable_pitcher/@id').text
166
+ @files[:linescore].xpath('//game/home_probable_pitcher/@id').text
168
167
  end
169
168
 
170
169
  def score
171
170
  return [0, 0] unless in_progress? || over?
172
171
 
173
- [@linescore.xpath('//game/@home_team_runs').text,
174
- @linescore.xpath('//game/@away_team_runs').text].map(&:to_i)
172
+ [
173
+ @files[:linescore].xpath('//game/@home_team_runs').text,
174
+ @files[:linescore].xpath('//game/@away_team_runs').text
175
+ ].map(&:to_i)
175
176
  end
176
177
 
177
178
  def home_pitcher
@@ -180,7 +181,7 @@ module MLBGameday
180
181
  case status
181
182
  when 'In Progress'
182
183
  # The xpath changes based on which half of the inning it is
183
- if @linescore.xpath('//game/@top_inning').text == 'Y'
184
+ if @files[:linescore].xpath('//game/@top_inning').text == 'Y'
184
185
  opposing_pitcher
185
186
  else
186
187
  current_pitcher
@@ -200,7 +201,7 @@ module MLBGameday
200
201
  case status
201
202
  when 'In Progress'
202
203
  # The xpath changes based on which half of the inning it is
203
- if @linescore.xpath('//game/@top_inning').text == 'Y'
204
+ if @files[:linescore].xpath('//game/@top_inning').text == 'Y'
204
205
  current_pitcher
205
206
  else
206
207
  opposing_pitcher
@@ -215,39 +216,69 @@ module MLBGameday
215
216
  end
216
217
 
217
218
  def home_tv
218
- return nil unless @gamecenter
219
+ return nil unless files[:gamecenter]
219
220
 
220
- @gamecenter.xpath('//game/broadcast/home/tv').text
221
+ files[:gamecenter].xpath('//game/broadcast/home/tv').text
221
222
  end
222
223
 
223
224
  def away_tv
224
- return nil unless @gamecenter
225
+ return nil unless files[:gamecenter]
225
226
 
226
- @gamecenter.xpath('//game/broadcast/away/tv').text
227
+ files[:gamecenter].xpath('//game/broadcast/away/tv').text
227
228
  end
228
229
 
229
230
  def home_radio
230
- return nil unless @gamecenter
231
+ return nil unless files[:gamecenter]
231
232
 
232
- @gamecenter.xpath('//game/broadcast/home/radio').text
233
+ files[:gamecenter].xpath('//game/broadcast/home/radio').text
233
234
  end
234
235
 
235
236
  def away_radio
236
- return nil unless @gamecenter
237
+ return nil unless files[:gamecenter]
237
238
 
238
- @gamecenter.xpath('//game/broadcast/away/radio').text
239
+ files[:gamecenter].xpath('//game/broadcast/away/radio').text
239
240
  end
240
241
 
241
242
  def free?
242
- return false unless @linescore
243
+ return false unless @files[:linescore]
243
244
 
244
- @linescore.xpath('//game/game_media/media/@free').text == 'ALL'
245
+ @files[:linescore].xpath('//game/game_media/media/@free').text == 'ALL'
245
246
  end
246
247
 
247
248
  def date
248
- return Date.today unless @linescore # SUPER KLUDGE
249
+ return Date.today unless @files[:linescore] # SUPER KLUDGE
250
+
251
+ @date ||= Chronic.parse(
252
+ @files[:linescore].xpath('//game/@original_date').text
253
+ )
254
+ end
255
+
256
+ def attendance
257
+ @files[:rawboxscore]&.xpath('//boxscore/@attendance')&.text || '0'
258
+ end
259
+
260
+ def elapsed_time
261
+ @files[:rawboxscore]&.xpath('//boxscore/@elapsed_time')&.text || ''
262
+ end
263
+
264
+ def weather
265
+ @files[:rawboxscore]&.xpath('//boxscore/@weather')&.text || ''
266
+ end
267
+
268
+ def wind
269
+ @files[:rawboxscore]&.xpath('//boxscore/@wind')&.text || ''
270
+ end
271
+
272
+ def umpires
273
+ return [] unless @files[:rawboxscore]
274
+
275
+ umps = {}
276
+
277
+ @files[:rawboxscore].xpath('//boxscore/umpires/umpire').each do |umpire|
278
+ umps[umpire.xpath('@position').text] = umpire.xpath('@name').text
279
+ end
249
280
 
250
- @date ||= Chronic.parse @linescore.xpath('//game/@original_date').text
281
+ umps
251
282
  end
252
283
 
253
284
  # So we don't get huge printouts
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  class League
3
5
  attr_reader :name, :divisions
@@ -8,7 +10,7 @@ module MLBGameday
8
10
  end
9
11
 
10
12
  def division(name)
11
- fail 'Invalid division' unless %i(East Central West).include?(name)
13
+ raise 'Invalid division' unless %i[East Central West].include?(name)
12
14
 
13
15
  @divisions[name]
14
16
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  class Pitcher < Player
3
5
  def era
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  class Player
3
5
  attr_reader :id, :data
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
4
  class Team
3
5
  attr_reader :id, :name, :city, :league, :division, :code, :file_code
@@ -12,16 +14,16 @@ module MLBGameday
12
14
  @code = opts[:code]
13
15
  @file_code = opts[:file_code]
14
16
  end
15
-
17
+
16
18
  def full_name
17
19
  "#{city} #{name}"
18
20
  end
19
-
21
+
20
22
  def names
21
23
  @names ||= (implicit_names + alt_names).uniq
22
24
  end
23
-
24
- def is_called?(name)
25
+
26
+ def called?(name)
25
27
  names.include?(name.downcase)
26
28
  end
27
29
 
@@ -29,29 +31,31 @@ module MLBGameday
29
31
  def inspect
30
32
  %(#<MLBGameday::Team @name="#{@name}">)
31
33
  end
32
-
34
+
33
35
  private
36
+
34
37
  def alt_names
35
38
  @alt_names ||= []
36
39
  end
37
-
40
+
38
41
  def implicit_names
39
- result = strict_names + [code, singular_name, despaced_name].map(&:downcase)
40
- result << city.downcase unless ["New York", "Chicago"].include?(city)
41
-
42
- result.uniq
42
+ result = strict_names
43
+ result << [code, singular_name, despaced_name].map(&:downcase)
44
+ result << city.downcase unless ['New York', 'Chicago'].include?(city)
45
+
46
+ result.flatten.uniq
43
47
  end
44
-
48
+
45
49
  def strict_names
46
50
  [name, full_name].map(&:downcase)
47
51
  end
48
-
52
+
49
53
  def singular_name
50
- name.chomp('s')
54
+ name.chomp 's'
51
55
  end
52
-
56
+
53
57
  def despaced_name
54
- name.tr(' ', '')
58
+ name.tr ' ', ''
55
59
  end
56
60
  end
57
61
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MLBGameday
2
- VERSION = '0.1.9'
4
+ VERSION = '0.2.0'
3
5
  end
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'mlb_gameday/version'
@@ -15,9 +17,9 @@ Gem::Specification.new do |spec|
15
17
  spec.license = 'MIT'
16
18
 
17
19
  spec.files = `git ls-files`.split($RS)
18
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
20
- spec.require_paths = %w(lib)
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = %w[lib]
21
23
 
22
24
  spec.add_development_dependency 'bundler', '~> 1.9'
23
25
  spec.add_development_dependency 'rake', '~> 10.4'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'minitest/autorun'
2
4
  require 'mlb_gameday.rb'
3
5
 
@@ -62,34 +64,42 @@ class TestApi < MiniTest::Test
62
64
  end
63
65
  end
64
66
  end
65
-
67
+
66
68
  def test_names_include_singular_name_when_different_from_name
67
- @api.teams.reject {|team| team.name == team.send(:singular_name)}.each do |team|
68
- assert_includes team.names, team.send(:singular_name).downcase
69
- end
69
+ @api.teams
70
+ .reject { |team| team.name == team.send(:singular_name) }
71
+ .each do |team|
72
+ assert_includes team.names, team.send(:singular_name).downcase
73
+ end
70
74
  end
71
-
75
+
72
76
  def test_names_includes_despaced_name_when_name_is_multi_word
73
- @api.teams.select {|team| team.name.split.size > 1}.each do |team|
77
+ @api.teams
78
+ .select { |team| team.name.split.size > 1 }
79
+ .each do |team|
74
80
  assert_includes team.names, team.send(:despaced_name).downcase
75
- end
81
+ end
76
82
  end
77
83
 
78
84
  def test_names_includes_city_except_nyc_and_chicago
79
- @api.teams.reject {|team| ["New York", "Chicago"].include?(team.city)}.each do |team|
85
+ @api.teams
86
+ .reject { |team| ['New York', 'Chicago'].include?(team.city) }
87
+ .each do |team|
80
88
  assert_includes team.names, team.city.downcase
81
- end
89
+ end
82
90
  end
83
91
 
84
92
  def test_names_does_not_include_city_for_nyc_and_chicago
85
- @api.teams.select {|team| ["New York", "Chicago"].include?(team.city)}.each do |team|
93
+ @api.teams
94
+ .select { |team| ['New York', 'Chicago'].include?(team.city) }
95
+ .each do |team|
86
96
  refute_includes team.names, team.city.downcase
87
- end
97
+ end
88
98
  end
89
-
99
+
90
100
  def test_no_teams_share_any_names
91
101
  @api.teams.each do |team|
92
- @api.teams.select {|t| t != team}.each do |other_team|
102
+ @api.teams.reject { |t| t == team }.each do |other_team|
93
103
  assert_equal (team.names - other_team.names), team.names
94
104
  end
95
105
  end
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open-uri'
2
4
  require 'fileutils'
3
5
 
4
- fail 'Please pass a URL to this program.' if ARGV[0].empty?
6
+ raise 'Please pass a URL to this program.' if ARGV[0].empty?
5
7
 
6
8
  def download_url(url)
7
9
  response = open(url)
8
10
 
9
- puts "Downloading #{url}"
11
+ puts "Downloading #{url}"
10
12
 
11
- fail "Error downloading #{url}" unless response.status[0] == '200'
13
+ raise "Error downloading #{url}" unless response.status[0] == '200'
12
14
 
13
15
  handle_file url, response.read
14
16
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'minitest/autorun'
2
4
  require 'mlb_gameday.rb'
3
5
 
4
6
  # Mock the basic `open` function so we don't actually hit the MLB website
5
7
  class MockedApi < MLBGameday::API
6
- alias_method :old_open, :open
8
+ alias old_open open
7
9
 
8
10
  def open(url, &block)
9
11
  dir = File.dirname __FILE__
@@ -20,7 +22,7 @@ class MockedApi < MLBGameday::API
20
22
 
21
23
  return file unless block_given?
22
24
 
23
- block.call file
25
+ yield file
24
26
  end
25
27
  end
26
28
 
@@ -43,7 +45,7 @@ class TestGame < MiniTest::Test
43
45
  assert_equal 1, games.count
44
46
  end
45
47
 
46
- def test_two_teams
48
+ def test_game_has_two_teams
47
49
  assert_equal 2, @game.teams.count
48
50
  end
49
51
 
@@ -80,4 +82,32 @@ class TestGame < MiniTest::Test
80
82
 
81
83
  assert @free_game.free?
82
84
  end
85
+
86
+ def test_game_attendance
87
+ assert_equal '41,129', @game.attendance
88
+ end
89
+
90
+ def test_game_elapsed_time
91
+ assert_equal '3:08', @game.elapsed_time
92
+ end
93
+
94
+ def test_game_weather
95
+ assert_equal '71 degrees, partly cloudy', @game.weather
96
+ end
97
+
98
+ def test_game_wind
99
+ assert_equal '8 mph, Out to CF', @game.wind
100
+ end
101
+
102
+ def test_game_umpires
103
+ assert_equal(
104
+ {
105
+ 'HP' => 'Phil Cuzzi',
106
+ '1B' => 'Gerry Davis',
107
+ '2B' => 'Quinn Wolcott',
108
+ '3B' => 'Greg Gibson'
109
+ },
110
+ @game.umpires
111
+ )
112
+ end
83
113
  end
@@ -0,0 +1,2 @@
1
+
2
+ <!--Copyright 2016 MLB Advanced Media, L.P. Use of any content on this page acknowledges agreement to the terms posted here http://gdx.mlb.com/components/copyright.txt--><boxscore wind="8 mph, Out to CF" game_type="R" venue_name="Dodger Stadium" attendance="41,129" home_sport_code="mlb" official_scorer="Don Hartack" game_pk="381326" date="May 28, 2014" status_ind="F" home_league_id="104" elapsed_time="3:08" game_id="2014/05/28/cinmlb-lanmlb-1" venue_id="22" start_time="7:11 PM" weather="71 degrees, partly cloudy" gameday_sw="P"><linescore home_team_runs="2" home_team_errors="0" home_team_hits="5" away_team_errors="0" away_team_runs="3" away_team_hits="8"><inning_line_score home="0" away="2" inning="1" /><inning_line_score home="0" away="0" inning="2" /><inning_line_score home="0" away="0" inning="3" /><inning_line_score home="0" away="0" inning="4" /><inning_line_score home="1" away="0" inning="5" /><inning_line_score home="1" away="1" inning="6" /><inning_line_score home="0" away="0" inning="7" /><inning_line_score home="0" away="0" inning="8" /><inning_line_score away="0" home="0" inning="9" /></linescore><umpires><umpire id="427093" position="HP" name="Phil Cuzzi" /><umpire id="427103" position="1B" name="Gerry Davis" /><umpire id="511890" position="2B" name="Quinn Wolcott" /><umpire id="427184" position="3B" name="Greg Gibson" /></umpires><team id="113" team_code="cin" losses="28" team_flag="away" short_name="Cincinnati" wins="23" full_name="Cincinnati Reds"><pitching hr="1" bam_era="3.60" so="8" r="2" bf="34" bis_era="3.60" bb="2" h="5" er="2" out="27"><pitcher bam_s_er="36" bam_bs="0" hr="1" bam_hld="0" bis_bs="0" np="96" name_display_first_last="Homer Bailey" game_score="64" pos="P" id="456701" bis_l="3" bam_l="3" bk="0" bis_w="5" name="Bailey" bf="27" bis_era="5.04" bb="1" bam_s_so="56" bam_s_bb="21" bam_w="5" so="6" bis_hld="0" wp="1" bam_s_r="36" win="true" pitch_order="100" h="5" bis_s_r="36" bam_s_ip="64.1" bam_era="5.04" bis_s_so="56" bis_s_h="76" bis_s_ip="64.1" bam_s_h="76" s="66" ao="2" bis_sv="0" r="2" bis_s_er="36" bam_sv="0" bis_s_bb="21" er="2" out="21" go="11"><strikeout event="61" batter_id="624577" batter_name="Puig" /><strikeout event="67" batter_id="434670" batter_name="Ramirez, H" /><strikeout event="114" batter_id="461314" batter_name="Kemp" /><strikeout event="159" batter_id="477132" batter_name="Kershaw" /><strikeout event="175" batter_id="444843" batter_name="Ethier" /><walk event="225" batter_id="408236" batter_name="Gonzalez, A" /><strikeout event="353" batter_id="434670" batter_name="Ramirez, H" /></pitcher><pitcher bam_s_er="11" bam_bs="1" hr="0" bam_hld="7" bis_bs="1" np="5" name_display_first_last="Manny Parra" game_score="50" pos="P" id="448159" bis_l="0" bam_l="0" bk="0" bis_w="0" name="Parra, M" bf="2" bis_era="5.50" bb="1" bam_s_so="20" bam_s_bb="10" bam_w="0" so="0" bis_hld="7" hold="true" bam_s_r="12" pitch_order="101" h="0" bis_s_r="12" bam_s_ip="18.0" bam_era="5.50" bis_s_so="20" bis_s_h="18" bis_s_ip="18.0" bam_s_h="18" s="1" ao="0" bis_sv="1" r="0" bis_s_er="11" bam_sv="1" bis_s_bb="10" er="0" out="1" go="1"><walk event="469" batter_id="543829" batter_name="Gordon, D" /></pitcher><pitcher bam_s_er="2" bam_bs="1" hr="0" bam_hld="0" bis_bs="1" save="true" np="11" name_display_first_last="Aroldis Chapman" game_score="55" pos="P" id="547973" bis_l="1" bam_l="1" bk="0" bis_w="0" name="Chapman, A" bf="3" bis_era="2.25" bb="0" bam_s_so="14" bam_s_bb="3" bam_w="0" so="2" bis_hld="0" bam_s_r="2" pitch_order="103" h="0" bis_s_r="2" bam_s_ip="8.0" bam_era="2.25" bis_s_so="14" bis_s_h="4" bis_s_ip="8.0" bam_s_h="4" s="8" ao="0" bis_sv="5" r="0" bis_s_er="2" bam_sv="5" bis_s_bb="3" er="0" out="3" go="1"><strikeout event="545" batter_id="461314" batter_name="Kemp" /><strikeout event="551" batter_id="457759" batter_name="Turner, J" /></pitcher><pitcher bam_s_er="1" bam_bs="1" hr="0" bam_hld="4" bis_bs="1" np="4" name_display_first_last="Jonathan Broxton" game_score="52" pos="P" id="455009" bis_l="0" bam_l="0" bk="0" bis_w="1" name="Broxton" bf="2" bis_era="0.61" bb="0" bam_s_so="10" bam_s_bb="5" bam_w="1" ir="1" so="0" bis_hld="4" hold="true" bam_s_r="1" pitch_order="102" h="0" bis_s_r="1" bam_s_ip="14.2" bam_era="0.61" bis_s_so="10" bis_s_h="6" bis_s_ip="14.2" bam_s_h="6" s="2" ao="2" bis_sv="5" r="0" ira="0" bis_s_er="1" bam_sv="5" bis_s_bb="5" er="0" out="2" go="0" /></pitching><batting hr="1" d="4" bam_obp=".305" ab_risp="9" so="12" bis_obp=".305" a="14" bis_ops=".676" bam_ops=".676" bis_slg=".371" t_lob="6" h="8" rbi="2" bis_avg=".240" lob="14" t="0" r="3" bam_slg=".371" po="27" ab="35" bb="1" h_risp="1" bam_avg=".240"><batter hr="0" sac="0" bis_obp=".263" bis_ops=".485" name_display_first_last="Homer Bailey" bam_ops=".485" bis_slg=".222" pos="P" id="456701" rbi="0" lob="2" bis_avg=".222" name="Bailey" bb="0" bis_s_hr="0" bam_s_so="9" fldg="1.000" first_two_out_risp_lob="100" bam_s_bb="1" hbp="0" d="0" e="0" bam_obp=".263" so="2" a="3" sf="0" bam_s_r="0" bam_s_hr="0" two_out_risp_lob="1" h="0" bat_order="900" bis_s_r="0" bis_s_rbi="1" t="0" bis_s_so="9" bis_s_h="4" bam_s_h="4" ao="0" bam_s_rbi="1" r="0" bam_slg=".222" sb="0" po="1" ab="3" bis_s_bb="1" go="1" bam_avg=".222" /><batter sac="0" bis_obp=".316" name_display_first_last="Ryan Ludwick" pos="LF" bis_avg=".246" bb="0" first_two_out_risp_lob="334" fldg=".000" bam_s_so="38" bis_s_hr="3" bam_s_bb="13" hbp="0" bam_obp=".316" so="2" sf="0" bat_order="600" bis_s_so="38" sb="0" bam_slg=".348" po="0" bam_avg=".246" go="1" hr="0" bis_ops=".664" bam_ops=".664" bis_slg=".348" rbi="0" id="407886" lob="2" name="Ludwick" d="0" e="0" a="0" two_out_risp_lob="1" bam_s_hr="3" bam_s_r="10" h="0" bis_s_r="10" bis_s_rbi="17" t="0" ao="1" bam_s_h="34" bis_s_h="34" r="0" bam_s_rbi="17" bam_s_d="5" bis_s_d="5" ab="4" bis_s_bb="13" /><batter sac="0" bis_obp=".287" name_display_first_last="Billy Hamilton" bam_s_sb="18" pos="CF" bis_avg=".245" tb="2" bb="0" bis_s_hr="1" fldg="1.000" bam_s_so="32" bam_s_bb="9" bis_s_sb="18" hbp="0" bam_obp=".287" so="1" sf="0" bat_order="100" bis_s_cs="6" bis_s_so="32" sb="0" bam_slg=".340" po="3" bam_avg=".245" go="2" hr="0" bis_ops=".627" bam_ops=".627" bis_slg=".340" bam_s_cs="6" id="571740" rbi="0" lob="0" name="Hamilton, B" d="1" e="0" a="0" bis_s_t="3" bam_s_t="3" bam_s_hr="1" bam_s_r="20" h="1" bis_s_r="20" bis_s_rbi="10" t="0" bis_s_h="39" ao="0" bam_s_h="39" r="0" bam_s_rbi="10" bam_s_e="1" bis_s_d="6" bam_s_d="6" ab="4" bis_s_e="1" bis_s_bb="9"><double pitcher_name="Kershaw" event="397" pitcher_id="477132" /></batter><batter sac="0" bis_obp=".300" name_display_first_last="Brandon Phillips" pos="2B" bis_avg=".275" tb="4" first_rbi="22" bb="0" fldg="1.000" bam_s_so="43" bis_s_hr="4" bam_s_bb="8" hbp="0" bam_obp=".300" so="0" sf="0" bat_order="300" bis_s_cs="2" bis_s_so="43" sb="0" bam_slg=".405" po="2" bam_avg=".275" go="3" hr="1" bis_ops=".705" bam_ops=".705" bis_slg=".405" bam_s_cs="2" id="408252" rbi="2" lob="1" name="Phillips" d="0" e="0" a="6" bam_s_hr="4" bam_s_r="17" h="1" bis_s_r="17" bis_s_rbi="18" t="0" bis_s_h="55" ao="0" bam_s_h="55" r="1" bam_s_rbi="18" bam_s_e="1" bis_s_d="14" bam_s_d="14" ab="4" bis_s_e="1" bis_s_bb="8"><home_run inning_num="1" pitcher_name="Kershaw" event="20" inning="1st" outs="1" pitcher_id="477132" runners_on="1" /></batter><batter sac="0" bis_obp=".341" name_display_first_last="Todd Frazier" bam_s_sb="4" pos="3B" bis_avg=".269" tb="4" bb="0" bis_s_hr="9" first_two_out_risp_lob="405" fldg="1.000" bam_s_so="42" bam_s_bb="17" bis_s_sb="4" hbp="0" bam_obp=".341" so="1" sf="0" bat_order="200" bis_s_cs="2" bis_s_so="42" sb="0" bam_slg=".489" po="0" bam_avg=".269" go="1" hr="0" bis_ops=".830" bam_ops=".830" bis_slg=".489" bam_s_cs="2" rbi="0" id="453943" lob="2" name="Frazier" d="2" e="0" a="1" two_out_risp_lob="2" bam_s_hr="9" bam_s_r="27" h="2" bis_s_r="27" bis_s_rbi="27" t="0" bis_s_h="50" ao="0" bam_s_h="50" r="2" bam_s_rbi="27" bam_s_e="7" bis_s_d="14" bam_s_d="14" ab="4" bis_s_e="7" bis_s_bb="17"><double pitcher_name="Kershaw" event="13" pitcher_id="477132" /><double pitcher_name="Kershaw" event="301" pitcher_id="477132" /></batter><batter sac="0" bis_obp=".411" name_display_first_last="Devin Mesoraco" bam_s_sb="1" pos="C" bis_avg=".360" tb="1" bb="1" bis_s_hr="6" fldg="1.000" bam_s_so="22" bam_s_bb="7" bis_s_sb="1" hbp="0" bam_obp=".411" so="2" sf="0" bat_order="400" bis_s_cs="1" bis_s_so="22" pb="1" sb="0" bam_slg=".663" po="7" bam_avg=".360" hr="0" first_pb="275" bis_ops="1.074" bam_ops="1.074" bis_slg=".663" bam_s_cs="1" id="519023" rbi="0" lob="0" name="Mesoraco" bis_s_pb="2" d="0" e="0" a="0" bam_s_hr="6" bam_s_r="13" h="1" bis_s_r="13" bis_s_rbi="20" t="0" bis_s_h="31" ao="0" bam_s_h="31" r="0" bam_s_rbi="20" bam_s_e="2" bam_s_pb="2" bis_s_d="8" bam_s_d="8" ab="3" bis_s_e="2" bis_s_bb="7" /><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="Manny Parra" bam_ops=".000" bis_slg=".000" pos="P" rbi="0" id="448159" lob="0" bis_avg=".000" name="Parra, M" bb="0" bis_s_hr="0" bam_s_so="0" fldg="1.000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="1" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="901" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="0" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_slg=".000" sb="0" po="0" ab="0" bis_s_bb="0" bam_avg=".000" /><batter sac="0" bis_obp=".261" name_display_first_last="Zack Cozart" bam_s_sb="1" pos="SS" bis_avg=".222" bb="0" fldg="1.000" bam_s_so="29" bis_s_hr="1" bam_s_bb="6" hbp="0" bis_s_sb="1" bam_obp=".261" so="3" sf="0" bat_order="800" bis_s_so="29" sb="0" bam_slg=".298" po="1" bam_avg=".222" go="1" hr="0" bis_ops=".559" bam_ops=".559" bis_slg=".298" id="446359" rbi="0" lob="3" name="Cozart" d="0" e="0" a="2" bis_s_t="1" bam_s_t="1" bam_s_hr="1" bam_s_r="11" h="0" bis_s_r="11" bis_s_rbi="12" t="0" bis_s_h="38" ao="0" bam_s_h="38" r="0" bam_s_rbi="12" bam_s_e="4" bis_s_d="8" bam_s_d="8" ab="4" bis_s_e="4" bis_s_bb="6" /><batter sac="0" bis_obp=".293" name_display_first_last="Roger Bernadina" bam_s_sb="2" pos="LF" bis_avg=".146" bb="0" fldg=".000" bam_s_so="14" bis_s_hr="0" bam_s_bb="10" hbp="0" bis_s_sb="2" bam_obp=".293" so="0" sf="0" bat_order="601" bis_s_so="14" sb="0" bam_slg=".188" po="0" bam_avg=".146" hr="0" bis_ops=".481" bam_ops=".481" bis_slg=".188" id="465668" rbi="0" lob="0" name="Bernadina" d="0" e="0" a="0" bam_s_hr="0" bam_s_r="2" h="0" bis_s_r="2" bis_s_rbi="4" t="0" ao="0" bam_s_h="7" bis_s_h="7" r="0" bam_s_rbi="4" bam_s_d="2" bis_s_d="2" ab="0" bis_s_bb="10" /><batter sac="0" bis_obp=".300" name_display_first_last="Skip Schumaker" bam_s_sb="1" pos="PH" bis_avg=".236" bb="0" fldg=".000" bam_s_so="12" bis_s_hr="1" bam_s_bb="5" hbp="0" bis_s_sb="1" bam_obp=".300" so="0" sf="0" bat_order="903" bis_s_so="12" sb="0" bam_slg=".345" po="0" bam_avg=".236" go="1" hr="0" bis_ops=".645" bam_ops=".645" bis_slg=".345" id="435401" rbi="0" lob="1" name="Schumaker" note="a-" d="0" e="0" a="0" bam_s_hr="1" bam_s_r="5" h="0" bis_s_r="5" bis_s_rbi="6" t="0" bis_s_h="13" ao="0" bam_s_h="13" r="0" bam_s_rbi="6" bam_s_e="1" bam_s_d="3" bis_s_d="3" ab="1" bis_s_e="1" bis_s_bb="5"><pinch_hit replaced_name="Broxton" inning_num="9" result="Grounded out" replaced_id="455009" event="519" sequence="a" inning="9th" /></batter><batter sac="0" bis_obp=".314" name_display_first_last="Brayan Pena" bam_s_sb="2" pos="1B" bis_avg=".283" tb="4" bb="0" bis_s_hr="3" first_two_out_risp_lob="202" fldg="1.000" bam_s_so="14" bam_s_bb="6" bis_s_sb="2" hbp="0" bam_obp=".314" so="0" sf="0" bat_order="700" bis_s_cs="2" bis_s_so="14" sb="0" bam_slg=".425" po="11" bam_avg=".283" go="1" hr="0" bis_ops=".739" bam_ops=".739" bis_slg=".425" bam_s_cs="2" rbi="0" id="430910" lob="1" name="Pena, B" d="1" e="0" a="1" two_out_risp_lob="1" bam_s_hr="3" bam_s_r="10" h="3" bis_s_r="10" bis_s_rbi="11" t="0" bis_s_h="32" ao="0" bam_s_h="32" r="0" bam_s_rbi="11" bam_s_e="1" bis_s_d="7" bam_s_d="7" ab="4" bis_s_e="1" bis_s_bb="6"><double pitcher_name="Kershaw" event="81" pitcher_id="477132" /></batter><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="Aroldis Chapman" bam_ops=".000" bis_slg=".000" pos="P" rbi="0" id="547973" lob="0" bis_avg=".000" name="Chapman, A" bb="0" bis_s_hr="0" bam_s_so="0" fldg=".000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="0" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="904" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="0" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_slg=".000" sb="0" po="0" ab="0" bis_s_bb="0" bam_avg=".000" /><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="Jonathan Broxton" bam_ops=".000" bis_slg=".000" pos="P" rbi="0" id="455009" lob="0" bis_avg=".000" name="Broxton" bb="0" bis_s_hr="0" bam_s_so="0" fldg=".000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="0" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="902" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="0" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_slg=".000" sb="0" po="0" ab="0" bis_s_bb="0" bam_avg=".000" /><batter sac="0" bis_obp=".317" name_display_first_last="Jay Bruce" bam_s_sb="5" pos="RF" bis_avg=".197" bb="0" fldg="1.000" bam_s_so="42" bis_s_hr="3" bam_s_bb="22" hbp="0" bis_s_sb="5" bam_obp=".317" so="1" sf="0" bat_order="500" bis_s_so="42" sb="0" bam_slg=".328" po="2" bam_avg=".197" go="2" hr="0" bis_ops=".645" bam_ops=".645" bis_slg=".328" id="457803" rbi="0" lob="2" name="Bruce" d="0" e="0" a="0" bam_s_t="1" bis_s_t="1" bam_s_hr="3" bam_s_r="21" h="0" bis_s_r="21" bis_s_rbi="14" t="0" bis_s_h="24" ao="1" bam_s_h="24" r="0" bam_s_rbi="14" bam_s_d="5" bis_s_d="5" ab="4" bis_s_bb="22" /></batting><double_play event="292" id_sequence="446359-408252-430910" name_sequence="Cozart-Phillips-Pena, B" /></team><team id="119" team_code="lan" losses="25" team_flag="home" short_name="LA Dodgers" wins="29" full_name="Los Angeles Dodgers"><pitching hr="1" bam_era="3.48" so="12" r="3" bf="36" bis_era="3.48" bb="1" h="8" er="3" out="27"><pitcher bam_s_er="14" bam_bs="1" hr="0" bam_hld="8" bis_bs="1" np="16" name_display_first_last="Brian Wilson" game_score="52" pos="P" id="451216" bis_l="2" bam_l="2" bk="0" bis_w="0" name="Wilson, Br" bf="4" bis_era="7.13" bb="0" bam_s_so="22" bam_s_bb="15" bam_w="0" so="1" bis_hld="8" bam_s_r="15" pitch_order="103" h="1" bis_s_r="15" bam_s_ip="17.2" bam_era="7.13" bis_s_so="22" bis_s_h="22" bis_s_ip="17.2" bam_s_h="22" s="12" ao="1" bis_sv="0" r="0" bis_s_er="14" bam_sv="0" bis_s_bb="15" er="0" out="3" go="1"><strikeout event="517" batter_id="446359" batter_name="Cozart" /></pitcher><pitcher bam_s_er="14" bam_bs="0" hr="1" bam_hld="0" bis_bs="0" loss="true" np="105" name_display_first_last="Clayton Kershaw" game_score="59" pos="P" id="477132" bis_l="2" bam_l="2" bk="0" bis_w="3" name="Kershaw" bf="29" bis_era="3.57" bb="1" bam_s_so="46" bam_s_bb="7" bam_w="3" so="9" bis_hld="0" wp="1" bam_s_r="14" pitch_order="100" h="7" bis_s_r="14" bam_s_ip="35.1" bam_era="3.57" bis_s_so="46" bis_s_h="36" bis_s_ip="35.1" bam_s_h="36" s="73" ao="0" bis_sv="0" r="3" bis_s_er="14" bam_sv="0" bis_s_bb="7" er="3" out="21" go="11"><strikeout event="30" batter_id="519023" batter_name="Mesoraco" /><strikeout event="76" batter_id="407886" batter_name="Ludwick" /><strikeout event="94" batter_id="446359" batter_name="Cozart" /><strikeout event="100" batter_id="456701" batter_name="Bailey" /><strikeout event="137" batter_id="571740" batter_name="Hamilton, B" /><strikeout event="143" batter_id="453943" batter_name="Frazier" /><strikeout event="196" batter_id="407886" batter_name="Ludwick" /><strikeout event="241" batter_id="446359" batter_name="Cozart" /><walk event="318" batter_id="519023" batter_name="Mesoraco" /><strikeout event="393" batter_id="456701" batter_name="Bailey" /></pitcher><pitcher bam_s_er="4" bam_bs="0" hr="0" bam_hld="1" bis_bs="0" np="11" name_display_first_last="Brandon League" game_score="53" pos="P" id="434181" bis_l="1" bam_l="1" bk="0" bis_w="1" name="League" bf="2" bis_era="1.32" bb="0" bam_s_so="17" bam_s_bb="7" bam_w="1" so="1" bis_hld="1" bam_s_r="5" pitch_order="101" h="0" bis_s_r="5" bam_s_ip="27.1" bam_era="1.32" bis_s_so="17" bis_s_h="22" bis_s_ip="27.1" bam_s_h="22" s="6" ao="0" bis_sv="0" r="0" bis_s_er="4" bam_sv="0" bis_s_bb="7" er="0" out="2" go="1"><strikeout event="447" batter_id="519023" batter_name="Mesoraco" /></pitcher><pitcher bam_s_er="4" bam_bs="0" hr="0" bam_hld="11" bis_bs="0" np="6" name_display_first_last="J.P. Howell" game_score="52" pos="P" id="434442" bis_l="3" bam_l="3" bk="0" bis_w="1" name="Howell" bf="1" bis_era="2.00" bb="0" bam_s_so="22" bam_s_bb="9" bam_w="1" so="1" bis_hld="11" bam_s_r="5" pitch_order="102" h="0" bis_s_r="5" bam_s_ip="18.0" bam_era="2.00" bis_s_so="22" bis_s_h="12" bis_s_ip="18.0" bam_s_h="12" s="3" ao="0" bis_sv="0" r="0" bis_s_er="4" bam_sv="0" bis_s_bb="9" er="0" out="1" go="0"><strikeout event="459" batter_id="457803" batter_name="Bruce" /></pitcher></pitching><batting hr="1" d="2" bam_obp=".324" ab_risp="7" so="8" bis_obp=".324" a="13" bis_ops=".739" bam_ops=".739" bis_slg=".415" t_lob="5" h="5" rbi="1" bis_avg=".257" lob="11" t="0" r="2" bam_slg=".415" po="27" ab="31" bb="2" h_risp="0" bam_avg=".257"><batter sac="0" bis_obp=".442" name_display_first_last="Yasiel Puig" bam_s_sb="5" pos="RF" bis_avg=".344" tb="4" first_rbi="344" bb="0" fldg="1.000" bam_s_so="41" bis_s_hr="11" bam_s_bb="26" hbp="0" bis_s_sb="5" bam_obp=".442" so="1" sf="0" bat_order="300" bis_s_cs="4" bis_s_so="41" sb="0" bam_slg=".623" po="1" bam_avg=".344" go="1" hr="1" bis_ops="1.065" bam_ops="1.065" bis_slg=".623" bam_s_cs="4" id="624577" rbi="1" lob="2" name="Puig" d="0" e="0" a="0" bis_s_t="3" bam_s_t="3" bam_s_hr="11" bam_s_r="29" h="1" bis_s_r="29" bis_s_rbi="39" t="0" bis_s_h="63" ao="1" bam_s_h="63" r="1" bam_s_rbi="39" bis_s_d="12" bam_s_d="12" ab="4" bis_s_bb="26"><home_run inning_num="6" pitcher_name="Bailey" event="343" inning="6th" outs="0" pitcher_id="456701" runners_on="0" /></batter><batter sac="0" bis_obp=".286" name_display_first_last="Justin Turner" bam_s_sb="1" pos="3B" bis_avg=".232" tb="2" bb="0" fldg="1.000" bam_s_so="21" bis_s_hr="2" bam_s_bb="8" hbp="0" bis_s_sb="1" bam_obp=".286" so="1" sf="0" bat_order="700" bis_s_so="21" sb="0" bam_slg=".358" po="0" bam_avg=".232" go="2" hr="0" bis_ops=".644" bam_ops=".644" bis_slg=".358" id="457759" rbi="0" lob="1" name="Turner, J" d="1" e="0" a="5" bam_s_hr="2" bam_s_r="10" h="1" bis_s_r="10" bis_s_rbi="8" t="0" bis_s_h="22" ao="0" bam_s_h="22" r="1" bam_s_rbi="8" bam_s_e="4" bis_s_d="6" bam_s_d="6" ab="4" bis_s_e="4" bis_s_bb="8"><double pitcher_name="Bailey" event="265" pitcher_id="456701" /></batter><batter sac="0" bis_obp=".278" name_display_first_last="Drew Butera" pos="C" bis_avg=".203" bb="0" fldg="1.000" bam_s_so="22" bis_s_hr="2" bam_s_bb="7" hbp="0" bam_obp=".278" so="0" sf="0" bat_order="800" bis_s_so="22" pb="1" sb="0" bam_slg=".319" po="12" bam_avg=".203" go="2" hr="0" first_pb="87" bis_ops=".597" bam_ops=".597" bis_slg=".319" id="460077" rbi="0" lob="2" name="Butera" bis_s_pb="7" d="0" e="0" a="0" bam_s_hr="2" bam_s_r="11" h="0" bis_s_r="11" bis_s_rbi="7" t="0" ao="1" bam_s_h="14" bis_s_h="14" r="0" bam_s_rbi="7" bam_s_pb="7" bam_s_d="2" bis_s_d="2" ab="3" bis_s_bb="7" /><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="Brandon League" bam_ops=".000" bis_slg=".000" pos="P" rbi="0" id="434181" lob="0" bis_avg=".000" name="League" bb="0" bis_s_hr="0" bam_s_so="1" fldg="1.000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="1" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="902" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="1" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_s_e="2" bam_slg=".000" sb="0" bis_s_e="2" po="0" ab="0" bis_s_bb="0" bam_avg=".000" /><batter sac="0" bis_obp=".317" name_display_first_last="Matt Kemp" bam_s_sb="5" pos="LF" bis_avg=".255" bb="0" fldg=".000" bam_s_so="46" bis_s_hr="5" bam_s_bb="14" hbp="0" bis_s_sb="5" bam_obp=".317" so="2" sf="0" bat_order="600" bis_s_cs="2" bis_s_so="46" sb="0" bam_slg=".438" po="0" bam_avg=".255" hr="0" bis_ops=".755" bam_ops=".755" bis_slg=".438" bam_s_cs="2" id="461314" rbi="0" lob="1" name="Kemp" d="0" e="0" a="0" bam_s_hr="5" bam_s_r="20" h="0" bis_s_r="20" bis_s_rbi="13" t="0" bis_s_h="39" ao="2" bam_s_h="39" r="0" bam_s_rbi="13" bam_s_e="4" bis_s_d="13" bam_s_d="13" ab="4" bis_s_e="4" bis_s_bb="14" /><batter sac="0" bis_obp=".342" name_display_first_last="Adrian Gonzalez" bam_s_sb="1" pos="1B" bis_avg=".269" bb="1" fldg="1.000" bam_s_so="38" bis_s_hr="12" bam_s_bb="23" hbp="0" bis_s_sb="1" bam_obp=".342" so="0" sf="0" bat_order="500" bis_s_so="38" sb="0" bam_slg=".507" po="12" bam_avg=".269" go="2" hr="0" bis_ops=".849" bam_ops=".849" bis_slg=".507" id="408236" rbi="0" lob="0" name="Gonzalez, A" d="0" e="0" a="0" bam_s_hr="12" bam_s_r="28" h="0" bis_s_r="28" bis_s_rbi="36" t="0" bis_s_h="54" ao="1" bam_s_h="54" r="0" bam_s_rbi="36" bam_s_e="2" bam_s_d="12" bis_s_d="12" ab="3" bis_s_e="2" bis_s_bb="23" /><batter sac="0" bis_obp=".326" name_display_first_last="Hanley Ramirez" bam_s_sb="3" pos="SS" bis_avg=".245" bb="0" bis_s_hr="7" first_two_out_risp_lob="67" fldg="1.000" bam_s_so="35" bam_s_bb="21" bis_s_sb="3" hbp="0" bam_obp=".326" so="2" sf="0" bat_order="400" bis_s_cs="2" bis_s_so="35" sb="0" bam_slg=".438" po="1" bam_avg=".245" go="1" hr="0" bis_ops=".764" bam_ops=".764" bis_slg=".438" bam_s_cs="2" rbi="0" id="434670" lob="2" name="Ramirez, H" d="0" e="0" a="2" two_out_risp_lob="2" bam_s_hr="7" bam_s_r="23" h="0" bis_s_r="23" bis_s_rbi="25" t="0" bis_s_h="47" ao="1" bam_s_h="47" r="0" bam_s_rbi="25" bam_s_e="7" bis_s_d="16" bam_s_d="16" ab="4" bis_s_e="7" bis_s_bb="21" /><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="Jamie Romak" bam_ops=".000" bis_slg=".000" pos="PH" rbi="0" id="457449" lob="0" bis_avg=".000" name="Romak" bb="0" bis_s_hr="0" bam_s_so="0" fldg=".000" note="a-" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="0" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="901" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="0" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_slg=".000" sb="0" po="0" ab="1" bis_s_bb="0" go="1" bam_avg=".000"><pinch_hit replaced_name="Kershaw" inning_num="7" result="Grounded out" replaced_id="477132" event="422" sequence="a" inning="7th" /></batter><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="Brian Wilson" bam_ops=".000" bis_slg=".000" pos="P" rbi="0" id="451216" lob="0" bis_avg=".000" name="Wilson, Br" bb="0" bis_s_hr="0" bam_s_so="0" fldg=".000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="0" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="904" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="0" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_s_e="1" bam_slg=".000" sb="0" bis_s_e="1" po="0" ab="0" bis_s_bb="0" bam_avg=".000" /><batter gidp="1" sac="1" bis_obp=".329" name_display_first_last="Andre Ethier" bam_s_sb="1" first_sac="476" pos="CF" bis_avg=".271" bb="0" fldg=".000" bam_s_so="30" bis_s_hr="3" bam_s_bb="11" hbp="0" bis_s_sb="1" bam_obp=".329" so="1" sf="0" bat_order="200" bis_s_cs="1" bis_s_so="30" sb="0" bam_slg=".403" po="0" bam_avg=".271" go="4" hr="0" bis_ops=".732" bam_ops=".732" bis_slg=".403" bam_s_cs="1" id="444843" rbi="0" lob="3" first_gidp="292" name="Ethier" d="0" e="0" a="0" bis_s_t="1" bam_s_t="1" bam_s_hr="3" bam_s_r="11" h="0" bis_s_r="11" bis_s_rbi="25" t="0" bis_s_h="39" ao="0" bam_s_h="39" r="0" bam_s_rbi="25" bis_s_d="8" bam_s_d="8" ab="3" bis_s_bb="11"><sac_bunt pitcher_name="Parra, M" event="476" pitcher_id="448159" /></batter><batter hr="0" sac="0" bis_obp=".250" bis_ops=".500" name_display_first_last="Clayton Kershaw" bam_ops=".500" bis_slg=".250" pos="P" rbi="0" id="477132" lob="0" bis_avg=".250" tb="1" name="Kershaw" bb="0" bis_s_hr="0" bam_s_so="3" fldg="1.000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".250" so="1" a="3" sf="0" bam_s_r="1" bam_s_hr="0" h="1" bat_order="900" bis_s_r="1" bis_s_rbi="0" t="0" bis_s_so="3" bis_s_h="3" bam_s_h="3" ao="0" bam_s_rbi="0" r="0" bam_slg=".250" sb="0" po="0" ab="2" bis_s_bb="0" bam_avg=".250" /><batter hr="0" sac="0" bis_obp=".000" bis_ops=".000" name_display_first_last="J.P. Howell" bam_ops=".000" bis_slg=".000" pos="P" rbi="0" id="434442" lob="0" bis_avg=".000" name="Howell" bb="0" bis_s_hr="0" bam_s_so="0" fldg=".000" bam_s_bb="0" hbp="0" d="0" e="0" bam_obp=".000" so="0" a="0" sf="0" bam_s_r="0" bam_s_hr="0" h="0" bat_order="903" bis_s_r="0" bis_s_rbi="0" t="0" bis_s_so="0" bis_s_h="0" bam_s_h="0" ao="0" bam_s_rbi="0" r="0" bam_slg=".000" sb="0" po="0" ab="0" bis_s_bb="0" bam_avg=".000" /><batter sac="0" bis_obp=".339" name_display_first_last="Dee Gordon" bam_s_sb="30" pos="2B" bis_avg=".289" tb="3" bb="1" bis_s_hr="1" fldg="1.000" bam_s_so="30" bam_s_bb="15" bis_s_sb="30" hbp="0" bam_obp=".339" so="0" sf="0" bat_order="100" bis_s_cs="3" bis_s_so="30" sb="0" bam_slg=".378" po="1" bam_avg=".289" go="1" hr="0" bis_ops=".717" bam_ops=".717" bis_slg=".378" bam_s_cs="3" id="543829" rbi="0" lob="0" name="Gordon, D" d="1" e="0" a="2" bis_s_t="3" bam_s_t="3" bam_s_hr="1" bam_s_r="30" h="2" bis_s_r="30" bis_s_rbi="13" t="0" bis_s_h="58" ao="0" bam_s_h="58" r="0" bam_s_rbi="13" bam_s_e="5" bis_s_d="9" bam_s_d="9" ab="3" bis_s_e="5" bis_s_bb="15"><double pitcher_name="Bailey" event="46" pitcher_id="456701" /></batter></batting></team></boxscore>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlb_gameday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Hoffman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-22 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - ".rubocop.yml"
106
+ - CHANGELOG.md
106
107
  - Gemfile
107
108
  - LICENSE.txt
108
109
  - README.md
@@ -218,6 +219,7 @@ files:
218
219
  - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/pitchers/547973.xml
219
220
  - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/pitchers/571561.xml
220
221
  - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/pitchers/607162.xml
222
+ - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/rawboxscore.xml
221
223
  - test/year_2014/month_05/day_28/miniscoreboard.xml
222
224
  - test/year_2014/month_07/day_15/gid_2014_07_15_nasmlb_aasmlb_1/pitchers/477132.xml
223
225
  - test/year_2014/pitchers/477132.xml
@@ -241,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
243
  version: '0'
242
244
  requirements: []
243
245
  rubyforge_project:
244
- rubygems_version: 2.5.1
246
+ rubygems_version: 2.6.11
245
247
  signing_key:
246
248
  specification_version: 4
247
249
  summary: Fetches gameday data from the MLB Gameday API
@@ -346,6 +348,7 @@ test_files:
346
348
  - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/pitchers/547973.xml
347
349
  - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/pitchers/571561.xml
348
350
  - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/pitchers/607162.xml
351
+ - test/year_2014/month_05/day_28/gid_2014_05_28_cinmlb_lanmlb_1/rawboxscore.xml
349
352
  - test/year_2014/month_05/day_28/miniscoreboard.xml
350
353
  - test/year_2014/month_07/day_15/gid_2014_07_15_nasmlb_aasmlb_1/pitchers/477132.xml
351
354
  - test/year_2014/pitchers/477132.xml