mlb_gd2 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mlb_gd2/batter.rb +2 -1
- data/lib/mlb_gd2/game.rb +3 -1
- data/lib/mlb_gd2/gameday.rb +63 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e543f12c1d1693f43f83e144cb778e60d3bfdfa
|
4
|
+
data.tar.gz: 0ede3012dc162f46830cc7e1e30c5278294bf95d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecf372f8ab201055e9b158ac953ef10c2ff1792a8c05829611c9bcf40da94f7a70cfee69244c34c36f4376368c875f5371ac9abaa26539c109a906c1c210d32c
|
7
|
+
data.tar.gz: 57b5d319878b7a5a9fcd1f6a5a61b48d836102a684e9db8cc21c9e86fac2360e05a2c5a7acaaede8dc3656cf7856b49d63e0c27866f9735262f0a9678f7d00b1
|
data/lib/mlb_gd2/batter.rb
CHANGED
@@ -4,13 +4,14 @@ require_relative "./helpers"
|
|
4
4
|
|
5
5
|
class Batter
|
6
6
|
|
7
|
-
attr_reader :name, :position, :at_bats, :runs, :hits, :doubles, :triples, :homeruns, :rbis, :walks, :strikeouts, :avg, :obp, :slg, :ops
|
7
|
+
attr_reader :name, :position, :bat_order, :at_bats, :runs, :hits, :doubles, :triples, :homeruns, :rbis, :walks, :strikeouts, :avg, :obp, :slg, :ops
|
8
8
|
|
9
9
|
include Helpers
|
10
10
|
|
11
11
|
def initialize(batter_xml)
|
12
12
|
@name = batter_xml.attribute("name").value
|
13
13
|
@position = batter_xml.attribute("pos").value
|
14
|
+
@bat_order = batter_xml.attribute("bo") ? batter_xml.attribute("bo").value : "N/A"
|
14
15
|
@at_bats = batter_xml.attribute("ab").value
|
15
16
|
@runs = batter_xml.attribute("r").value
|
16
17
|
@hits = batter_xml.attribute("h").value
|
data/lib/mlb_gd2/game.rb
CHANGED
data/lib/mlb_gd2/gameday.rb
CHANGED
@@ -24,7 +24,69 @@ class Gameday
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def game_from_team(team)
|
27
|
-
|
27
|
+
if team.downcase.include? "angels"
|
28
|
+
tid = "ana"
|
29
|
+
elsif team.downcase.include? "astros"
|
30
|
+
tid = "hou"
|
31
|
+
elsif team.downcase.include? "athletics"
|
32
|
+
tid = "oak"
|
33
|
+
elsif team.downcase.include? "blue jays"
|
34
|
+
tid = "tor"
|
35
|
+
elsif team.downcase.include? "braves"
|
36
|
+
tid = "atl"
|
37
|
+
elsif team.downcase.include? "brewers"
|
38
|
+
tid = "mil"
|
39
|
+
elsif team.downcase.include? "cardinals"
|
40
|
+
tid = "sln"
|
41
|
+
elsif team.downcase.include? "cubs"
|
42
|
+
tid = "chn"
|
43
|
+
elsif team.downcase.include? "diamondbacks"
|
44
|
+
tid = "ari"
|
45
|
+
elsif team.downcase.include? "dodgers"
|
46
|
+
tid = "lan"
|
47
|
+
elsif team.downcase.include? "giants"
|
48
|
+
tid = "sfn"
|
49
|
+
elsif team.downcase.include? "indians"
|
50
|
+
tid = "cle"
|
51
|
+
elsif team.downcase.include? "mariners"
|
52
|
+
tid = "sea"
|
53
|
+
elsif team.downcase.include? "marlins"
|
54
|
+
tid = "mia"
|
55
|
+
elsif team.downcase.include? "mets"
|
56
|
+
tid = "nyn"
|
57
|
+
elsif team.downcase.include? "nationals"
|
58
|
+
tid = "was"
|
59
|
+
elsif team.downcase.include? "orioles"
|
60
|
+
tid = "bal"
|
61
|
+
elsif team.downcase.include? "padres"
|
62
|
+
tid = "sdn"
|
63
|
+
elsif team.downcase.include? "pillies"
|
64
|
+
tid = "phi"
|
65
|
+
elsif team.downcase.include? "pirates"
|
66
|
+
tid = "pit"
|
67
|
+
elsif team.downcase.include? "rangers"
|
68
|
+
tid = "tex"
|
69
|
+
elsif team.downcase.include? "rays"
|
70
|
+
tid = "tba"
|
71
|
+
elsif team.downcase.include? "red sox"
|
72
|
+
tid = "bos"
|
73
|
+
elsif team.downcase.include? "reds"
|
74
|
+
tid = "cin"
|
75
|
+
elsif team.downcase.include? "rockies"
|
76
|
+
tid = "col"
|
77
|
+
elsif team.downcase.include? "royals"
|
78
|
+
tid = "kca"
|
79
|
+
elsif team.downcase.include? "tigers"
|
80
|
+
tid = "det"
|
81
|
+
elsif team.downcase.include? "twins"
|
82
|
+
tid = "min"
|
83
|
+
elsif team.downcase.include? "white sox"
|
84
|
+
tid = "cha"
|
85
|
+
elsif team.downcase.include? "yankees"
|
86
|
+
tid = "nya"
|
87
|
+
end
|
88
|
+
|
89
|
+
selected_games = games.select { |game| game.url.include?(tid) || game.url.include?(tid) }
|
28
90
|
|
29
91
|
if selected_games.length > 1
|
30
92
|
puts "That query fits more than one game. Please be more specific."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mlb_gd2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Firth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|