npb-api 0.1.3 → 0.1.4

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: 62bbda6c6865b070a5d22d7cb1fe997c9efe51b0
4
- data.tar.gz: eb5a95219ecb68b5be8b2c68c2959bf627ba4a91
3
+ metadata.gz: fc10338b42c5f51ac124ffea3a406382f769f26f
4
+ data.tar.gz: d4ba34c3ae8383d7dcf8d30133ee79e38e00ae24
5
5
  SHA512:
6
- metadata.gz: f23781ae7201de7c6bac3784978bd740a4ceff8870ba434796a886fa1faed3a528844fe05cfc4bf2ed32e8e321d15d2bf7f90eb1beb2c66fd685b05531da5e18
7
- data.tar.gz: 540a6706e4c07c8d8b7f4459441a817d7c0a727f4d114896d94703bda9ff3bc7b8fe2de137c912a351e00eeb32a5754699e51402354a956ae961349f1207cfee
6
+ metadata.gz: de6123aac78333b8de6b987b28733c2ab4450be0e39423935ef5056fc02af694dfcdb20f2456fda48434f4cbf84fe96314ab2e5e6bc13d8b525e626c1363e541
7
+ data.tar.gz: b6314de78ceb12562571b8e95eff19137f2a48b556cd3a4a2e423fb86c80a5cbe39f3511f14bada6c63a9f206606d15693c8bd434311463cfc638e9136718b5d
@@ -26,79 +26,104 @@ module NpbApi
26
26
  end
27
27
 
28
28
  def holds
29
+ return nil if farm?
29
30
  @row.children[8].text.to_i
30
31
  end
31
32
 
32
33
  def hold_points
34
+ return nil if farm?
33
35
  @row.children[9].text.to_i
34
36
  end
35
37
 
36
38
  def complete_games
37
- @row.children[10].text.to_i
39
+ line = (farm? ? 8 : 10)
40
+ @row.children[line].text.to_i
38
41
  end
39
42
 
40
43
  def shutouts
41
- @row.children[11].text.to_i
44
+ line = (farm? ? 9 : 11)
45
+ @row.children[line].text.to_i
42
46
  end
43
47
 
44
48
  def without_walking
45
- @row.children[12].text.to_i
49
+ line = (farm? ? 10 : 12)
50
+ @row.children[line].text.to_i
46
51
  end
47
52
 
48
53
  def winning_percentage
49
- @row.children[14].text.to_f
54
+ line = (farm? ? 12 : 14)
55
+ @row.children[line].text.to_f
50
56
  end
51
57
 
52
58
  def total_batters_faced
53
- @row.children[15].text.to_i
59
+ line = (farm? ? 13 : 15)
60
+ @row.children[line].text.to_i
54
61
  end
55
62
 
56
63
  def innings_pitched
57
- (@row.children[16].text + @row.children[17].text).to_f
64
+ line1, line2 = (farm? ? [14, 15] : [16, 17])
65
+ (@row.children[line1].text + @row.children[line2].text).to_f
58
66
  end
59
67
 
60
68
  def hits
61
- @row.children[18].text.to_i
69
+ line = (farm? ? 16 : 18)
70
+ @row.children[line].text.to_i
62
71
  end
63
72
 
64
73
  def home_runs
65
- @row.children[20].text.to_i
74
+ line = (farm? ? 18 : 20)
75
+ @row.children[line].text.to_i
66
76
  end
67
77
 
68
78
  def walks
69
- @row.children[21].text.to_i
79
+ line = (farm? ? 19 : 21)
80
+ @row.children[line].text.to_i
70
81
  end
71
82
 
72
83
  def intentional_walks
73
- @row.children[22].text.to_i
84
+ line = (farm? ? 20 : 22)
85
+ @row.children[line].text.to_i
74
86
  end
75
87
 
76
88
  def hit_by_pitch
77
- @row.children[23].text.to_i
89
+ line = (farm? ? 21 : 23)
90
+ @row.children[line].text.to_i
78
91
  end
79
92
 
80
93
  def strikeouts
81
- @row.children[24].text.to_i
94
+ line = (farm? ? 22 : 24)
95
+ @row.children[line].text.to_i
82
96
  end
83
97
 
84
98
  def wild_pitches
85
- @row.children[25].text.to_i
99
+ line = (farm? ? 23 : 25)
100
+ @row.children[line].text.to_i
86
101
  end
87
102
 
88
103
  def balks
89
- @row.children[26].text.to_i
104
+ line = (farm? ? 24 : 26)
105
+ @row.children[line].text.to_i
90
106
  end
91
107
 
92
108
  def runs
93
- @row.children[27].text.to_i
109
+ line = (farm? ? 25 : 27)
110
+ @row.children[line].text.to_i
94
111
  end
95
112
 
96
113
  def earned_runs
97
- @row.children[28].text.to_i
114
+ line = (farm? ? 26 : 28)
115
+ @row.children[line].text.to_i
98
116
  end
99
117
 
100
118
  def earned_run_average
101
- @row.children[29].text.to_f
119
+ line = (farm? ? 27 : 29)
120
+ @row.children[line].text.to_f
121
+ end
122
+
123
+ private
124
+
125
+ def farm?
126
+ %w[eastern western].include?(league)
102
127
  end
103
128
  end
104
129
  end
@@ -1,3 +1,3 @@
1
1
  module NpbApi
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: npb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ohtsuka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler