mlb_gd2 0.4.1 → 0.4.2

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: 6c045b479eb537e7727ce825cdf2761abb705449
4
- data.tar.gz: 649a1b86f50acbef4959d8fcccd1f60ec6ceb4cc
3
+ metadata.gz: 2e543f12c1d1693f43f83e144cb778e60d3bfdfa
4
+ data.tar.gz: 0ede3012dc162f46830cc7e1e30c5278294bf95d
5
5
  SHA512:
6
- metadata.gz: 70bf35725b7a8f03a008b9032cd660bc81df782cfa15a6785c571c06e68d911f67fa3983fcfb65319c7d92d9f5181464d043e7268698f08d0ca2dc4b644275a0
7
- data.tar.gz: 1876dd36d0d2decdc5b07ee70290d4e65a01ec65d160dbf54b26e0fd20413ba25b3de7628bd3c06f6f2adf8392194664d6da9fad8157729d1d2686d50fc2c1b5
6
+ metadata.gz: ecf372f8ab201055e9b158ac953ef10c2ff1792a8c05829611c9bcf40da94f7a70cfee69244c34c36f4376368c875f5371ac9abaa26539c109a906c1c210d32c
7
+ data.tar.gz: 57b5d319878b7a5a9fcd1f6a5a61b48d836102a684e9db8cc21c9e86fac2360e05a2c5a7acaaede8dc3656cf7856b49d63e0c27866f9735262f0a9678f7d00b1
@@ -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
@@ -5,6 +5,8 @@ require_relative "./team"
5
5
 
6
6
  class Game
7
7
 
8
+ attr_reader :url
9
+
8
10
  include Helpers
9
11
 
10
12
  def initialize(url)
@@ -22,6 +24,6 @@ class Game
22
24
 
23
25
  private
24
26
 
25
- attr_reader :url, :boxscore
27
+ attr_reader :boxscore
26
28
 
27
29
  end
@@ -24,7 +24,69 @@ class Gameday
24
24
  end
25
25
 
26
26
  def game_from_team(team)
27
- selected_games = games.select { |game| game.home_team.name.include?(team) || game.away_team.name.include?(team) }
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.1
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-17 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri