sportradar-api 0.10.28 → 0.10.29
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a338e4b223081ae732503691faa00eea24c75167
|
|
4
|
+
data.tar.gz: 13fedf4240e0529b5f43fc45ea4268ea3b77ee19
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4e9c67488f5f92e046fdc22a56c06d9087a3a56969eb23931724dfe26efeef2b220c7f0eec010905bf2f62c87ba02a6f133e506b0b17c61cb35cf7f8597fab1
|
|
7
|
+
data.tar.gz: d681067b13bd39c0e1be3588cff3989a6bd94fb6767e433df2053cca14811db33d99567df7255718305938fbe91eb781ade8a9d07bffc62c8a43b36891480111
|
data/Gemfile.lock
CHANGED
|
@@ -6,7 +6,7 @@ module Sportradar
|
|
|
6
6
|
attr_accessor :response, :id, :event, :hitter_id, :outcome, :description
|
|
7
7
|
|
|
8
8
|
def initialize(data, **opts)
|
|
9
|
-
|
|
9
|
+
@response = data
|
|
10
10
|
@api = opts[:api]
|
|
11
11
|
@event = opts[:event]
|
|
12
12
|
|
|
@@ -22,6 +22,13 @@ module Sportradar
|
|
|
22
22
|
# return false if other.nil?
|
|
23
23
|
# @id == other.id && pitches == other.pitches
|
|
24
24
|
# end
|
|
25
|
+
def outcome_id
|
|
26
|
+
pitches.last&.outcome_id
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def hit?
|
|
30
|
+
!!pitches.last&.hit_type
|
|
31
|
+
end
|
|
25
32
|
|
|
26
33
|
def update(data, **opts)
|
|
27
34
|
@description = data['description'] if data['description']
|
|
@@ -43,6 +50,7 @@ module Sportradar
|
|
|
43
50
|
@pitches_hash.values
|
|
44
51
|
end
|
|
45
52
|
end
|
|
53
|
+
|
|
46
54
|
end
|
|
47
55
|
end
|
|
48
56
|
end
|
|
@@ -2,7 +2,7 @@ module Sportradar
|
|
|
2
2
|
module Api
|
|
3
3
|
module Baseball
|
|
4
4
|
class Pitch < Data
|
|
5
|
-
attr_accessor :response, :id, :at_bat, :outcome_id, :status, :count, :is_ab_over, :warming_up, :runners, :errors
|
|
5
|
+
attr_accessor :response, :id, :at_bat, :outcome_id, :status, :count, :is_ab_over, :warming_up, :runners, :errors, :pitch_type_name, :speed, :outcome, :hit_type
|
|
6
6
|
|
|
7
7
|
def initialize(data, **opts)
|
|
8
8
|
@response = data
|
|
@@ -19,7 +19,10 @@ module Sportradar
|
|
|
19
19
|
end
|
|
20
20
|
def update(data, **opts)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
if data['outcome_id']
|
|
23
|
+
@outcome_id = data['outcome_id']
|
|
24
|
+
@outcome = self.class.pitch_outcome(@outcome_id)
|
|
25
|
+
end
|
|
23
26
|
@description = data['description'] if data['description']
|
|
24
27
|
@status = data['status'] if data['status']
|
|
25
28
|
|
|
@@ -61,6 +64,7 @@ module Sportradar
|
|
|
61
64
|
@y = data['pitch_y'] if data['pitch_y']
|
|
62
65
|
@zone = data['pitch_zone'] if data['pitch_zone']
|
|
63
66
|
|
|
67
|
+
@pitch_type_name = self.class.pitch_type(@type)
|
|
64
68
|
@total_pitch_count = data['pitch_count'] if data['pitch_count']
|
|
65
69
|
end
|
|
66
70
|
|
|
@@ -92,7 +96,6 @@ module Sportradar
|
|
|
92
96
|
@warming_preferred_name = data['preferred_name']
|
|
93
97
|
@warming_jersey_number = data['jersey_number']
|
|
94
98
|
@warming_up = "#{data['preferred_name'] || data['first_name']} #{data['last_name']}"
|
|
95
|
-
puts data unless data['last_name']
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
def parse_steal(data)
|
|
@@ -105,6 +108,116 @@ module Sportradar
|
|
|
105
108
|
{"type"=>"steal", "id"=>"37c9192d-cac9-4320-b721-f68955eecf24", "status"=>"official", "created_at"=>"2017-05-06T03:02:16+00:00", "pitcher"=>{"id"=>"90fb6719-5135-42f3-88c0-0ccde448368c"}, "runners"=>[{"id"=>"106e6fb6-6460-412e-abdb-9f73469a27b9", "starting_base"=>1, "ending_base"=>1, "outcome_id"=>"CK", "out"=>false, "last_name"=>"DeShields", "first_name"=>"Delino", "preferred_name"=>"Delino", "jersey_number"=>"3"}]}
|
|
106
109
|
{"type"=>"steal", "id"=>"b8dcebfa-e02c-470e-ba73-e9b6b553cc0d", "status"=>"official", "created_at"=>"2017-05-06T03:38:48+00:00", "pitcher"=>{"id"=>"1a2638a3-28df-46b3-9cca-0f8eb29b581f"}, "runners"=>[{"id"=>"2847c4e0-01be-46bd-992e-701ee447e3f5", "starting_base"=>1, "ending_base"=>1, "outcome_id"=>"CK", "out"=>false, "last_name"=>"Upton", "first_name"=>"Justin", "preferred_name"=>"Justin", "jersey_number"=>"8"}, {"id"=>"f27a7574-57db-4eeb-8f88-377048806de2", "starting_base"=>3, "ending_base"=>3, "outcome_id"=>"", "out"=>false, "last_name"=>"Martínez", "first_name"=>"Victor", "preferred_name"=>"Victor", "jersey_number"=>"41"}]}
|
|
107
110
|
|
|
111
|
+
|
|
112
|
+
def self.pitch_type(code)
|
|
113
|
+
pitch_types[code]
|
|
114
|
+
end
|
|
115
|
+
def self.pitch_types
|
|
116
|
+
@pitch_types ||= {
|
|
117
|
+
'FA' => 'Fastball',
|
|
118
|
+
'SI' => 'Sinker',
|
|
119
|
+
'CT' => 'Cutter',
|
|
120
|
+
'CU' => 'Curveball',
|
|
121
|
+
'SL' => 'Slider',
|
|
122
|
+
'CH' => 'Changeup',
|
|
123
|
+
'KN' => 'Knuckleball',
|
|
124
|
+
'SP' => 'Splitter',
|
|
125
|
+
'SC' => 'Screwball',
|
|
126
|
+
'FO' => 'Forkball',
|
|
127
|
+
'IB' => 'Intentional Ball',
|
|
128
|
+
'PI' => 'Pitchout',
|
|
129
|
+
}
|
|
130
|
+
end
|
|
131
|
+
def self.pitch_outcome(code)
|
|
132
|
+
pitch_outcomes[code]
|
|
133
|
+
end
|
|
134
|
+
def self.pitch_outcomes
|
|
135
|
+
@pitch_outcomes ||= {
|
|
136
|
+
'aBK' => 'Balk',
|
|
137
|
+
'aCI' => 'Catcher Interference',
|
|
138
|
+
'aD' => 'Double',
|
|
139
|
+
'aDAD3' => 'Double - Adv 3rd',
|
|
140
|
+
'aDAD4' => 'Double - Adv Home',
|
|
141
|
+
'aFCAD2' => 'Fielders Choice - Adv 2nd',
|
|
142
|
+
'aFCAD3' => 'Fielders Choice - Adv 3rd',
|
|
143
|
+
'aFCAD4' => 'Fielders Choice - Adv Home',
|
|
144
|
+
'aHBP' => 'Hit By Pitch',
|
|
145
|
+
'aHR' => 'Homerun',
|
|
146
|
+
'aIBB' => 'Intentional Walk',
|
|
147
|
+
'aKLAD1' => 'Strike Looking - Adv 1st',
|
|
148
|
+
'aKLAD2' => 'Strike Looking - Adv 2nd',
|
|
149
|
+
'aKLAD3' => 'Strike Looking - Adv 3rd',
|
|
150
|
+
'aKLAD4' => 'Strike Looking - Adv Home',
|
|
151
|
+
'aKSAD1' => 'Strike Swinging - Adv 1st',
|
|
152
|
+
'aKSAD2' => 'Strike Swinging - Adv 2nd',
|
|
153
|
+
'aKSAD3' => 'Strike Swinging - Adv 3rd',
|
|
154
|
+
'aKSAD4' => 'Strike Swinging - Adv Home',
|
|
155
|
+
'aROE' => 'Reached On Error',
|
|
156
|
+
'aROEAD2' => 'Reached On Error - Adv 2nd',
|
|
157
|
+
'aROEAD3' => 'Reached On Error - Adv 3rd',
|
|
158
|
+
'aROEAD4' => 'Reached On Error - Adv Home',
|
|
159
|
+
'aS' => 'Single',
|
|
160
|
+
'aSAD2' => 'Single - Adv 2nd',
|
|
161
|
+
'aSAD3' => 'Single - Adv 3rd',
|
|
162
|
+
'aSAD4' => 'Single - Adv Home',
|
|
163
|
+
'aSBAD1' => 'Sacrifice Bunt - Adv 1st',
|
|
164
|
+
'aSBAD2' => 'Sacrifice Bunt - Adv 2nd',
|
|
165
|
+
'aSBAD3' => 'Sacrifice Bunt - Adv 3rd',
|
|
166
|
+
'aSBAD4' => 'Sacrifice Bunt - Adv Home',
|
|
167
|
+
'aSFAD1' => 'Sacrifice Fly - Adv 1st',
|
|
168
|
+
'aSFAD2' => 'Sacrifice Fly - Adv 2nd',
|
|
169
|
+
'aSFAD3' => 'Sacrifice Fly - Adv 3rd',
|
|
170
|
+
'aSFAD4' => 'Sacrifice Fly - Adv Home',
|
|
171
|
+
'aT' => 'Triple',
|
|
172
|
+
'aTAD4' => 'Triple - Adv Home',
|
|
173
|
+
'bAB' => 'Enforced Ball',
|
|
174
|
+
'bB' => 'Ball',
|
|
175
|
+
'bDB' => 'Dirt Ball',
|
|
176
|
+
'bIB' => 'Intentional Ball',
|
|
177
|
+
'bPO' => 'Pitchout',
|
|
178
|
+
'kF' => 'Foul Ball',
|
|
179
|
+
'kFT' => 'Foul Tip',
|
|
180
|
+
'kKL' => 'Strike Looking',
|
|
181
|
+
'kKS' => 'Strike Swinging',
|
|
182
|
+
'oBI' => 'Hitter Interference',
|
|
183
|
+
'oDT3' => 'Double - Out at 3rd',
|
|
184
|
+
'oDT4' => 'Double - Out at Home',
|
|
185
|
+
'oFC' => 'Fielders Choice',
|
|
186
|
+
'oFCT2' => 'Fielders Choice - Out at 2nd',
|
|
187
|
+
'oFCT3' => 'Fielders Choice - Out at 3rd',
|
|
188
|
+
'oFCT4' => 'Fielders Choice - Out at Home',
|
|
189
|
+
'oFO' => 'Fly Out',
|
|
190
|
+
'oGO' => 'Ground Out',
|
|
191
|
+
'oKLT1' => 'Strike Looking - Out at 1st',
|
|
192
|
+
'oKLT2' => 'Strike Looking - Out at 2nd',
|
|
193
|
+
'oKLT3' => 'Strike Looking - Out at 3rd',
|
|
194
|
+
'oKLT4' => 'Strike Looking - Out at Home',
|
|
195
|
+
'oKST1' => 'Strike Swinging - Out at 1st',
|
|
196
|
+
'oKST2' => 'Strike Swinging - Out at 2nd',
|
|
197
|
+
'oKST3' => 'Strike Swinging - Out at 3rd',
|
|
198
|
+
'oKST4' => 'Strike Swinging - Out at Home',
|
|
199
|
+
'oLO' => 'Line Out',
|
|
200
|
+
'oOBB' => 'Out of Batters Box',
|
|
201
|
+
'oOP' => 'Out on Appeal',
|
|
202
|
+
'oPO' => 'Pop Out',
|
|
203
|
+
'oROET2' => 'Reached On Error - Out at 2nd',
|
|
204
|
+
'oROET3' => 'Reached On Error - Out at 3rd',
|
|
205
|
+
'oROET4' => 'Reached On Error - Out at Home',
|
|
206
|
+
'oSB' => 'Sacrifice Bunt',
|
|
207
|
+
'oSBT2' => 'Sacrifice Bunt - Out at 2nd',
|
|
208
|
+
'oSBT3' => 'Sacrifice Bunt - Out at 3rd',
|
|
209
|
+
'oSBT4' => 'Sacrifice Bunt - Out at Home',
|
|
210
|
+
'oSF' => 'Sacrifice Fly',
|
|
211
|
+
'oSFT2' => 'Sacrifice Fly - Out at 2nd',
|
|
212
|
+
'oSFT3' => 'Sacrifice Fly - Out at 3rd',
|
|
213
|
+
'oSFT4' => 'Sacrifice Fly - Out at Home',
|
|
214
|
+
'oST2' => 'Single - Out at 2nd',
|
|
215
|
+
'oST3' => 'Single - Out at 3rd',
|
|
216
|
+
'oST4' => 'Single - Out at Home',
|
|
217
|
+
'oTT4' => 'Triple - Out at Home',
|
|
218
|
+
}
|
|
219
|
+
end
|
|
220
|
+
|
|
108
221
|
end
|
|
109
222
|
end
|
|
110
223
|
end
|
|
@@ -2,7 +2,7 @@ module Sportradar
|
|
|
2
2
|
module Api
|
|
3
3
|
module Baseball
|
|
4
4
|
class Runner < Data
|
|
5
|
-
attr_accessor :response, :id, :starting_base, :ending_base, :outcome_id, :out, :description, :fielders
|
|
5
|
+
attr_accessor :response, :id, :starting_base, :ending_base, :outcome_id, :out, :description, :fielders, :outcome
|
|
6
6
|
|
|
7
7
|
def initialize(data, **opts)
|
|
8
8
|
@response = data
|
|
@@ -15,6 +15,7 @@ module Sportradar
|
|
|
15
15
|
@starting_base = data["starting_base"]
|
|
16
16
|
@ending_base = data["ending_base"]
|
|
17
17
|
@outcome_id = data["outcome_id"]
|
|
18
|
+
@outcome = runner_outcome(@outcome_id)
|
|
18
19
|
@out = data["out"]
|
|
19
20
|
@last_name = data["last_name"]
|
|
20
21
|
@first_name = data["first_name"]
|
|
@@ -24,6 +25,53 @@ module Sportradar
|
|
|
24
25
|
@fielders = data['fielders'].map { |hash| Fielder.new(hash) } if data['fielders']
|
|
25
26
|
end
|
|
26
27
|
|
|
28
|
+
def runner_outcome(code)
|
|
29
|
+
runner_outcomes[code]
|
|
30
|
+
end
|
|
31
|
+
def runner_outcomes
|
|
32
|
+
@runner_outcomes ||= {
|
|
33
|
+
'CK' => 'Checked',
|
|
34
|
+
'ERN' => 'Earned Run/RBI',
|
|
35
|
+
'eRN' => 'Earned Run/No RBI',
|
|
36
|
+
'URN' => 'Unearned Run/RBI',
|
|
37
|
+
'uRN' => 'Unearned Run/No RBI',
|
|
38
|
+
'PO' => 'Pickoff',
|
|
39
|
+
'POCS2' => 'Pickoff/Caught Stealing 2nd',
|
|
40
|
+
'POCS3' => 'Pickoff/Caught Stealing 3nd',
|
|
41
|
+
'POCS4' => 'Pickoff/Caught Stealing Home',
|
|
42
|
+
'AD1' => 'Advance 1st',
|
|
43
|
+
'AD2' => 'Advance 2nd',
|
|
44
|
+
'AD3' => 'Advance 3rd',
|
|
45
|
+
'SB2' => 'Stole 2nd',
|
|
46
|
+
'SB2E4E' => 'Stole 2nd, error to home (earned)',
|
|
47
|
+
'SB3' => 'Stole 3rd',
|
|
48
|
+
'SB3E4E' => 'Stole 3rd, error to home (earned)',
|
|
49
|
+
'SB4' => 'Stole Home',
|
|
50
|
+
'TO2' => 'Tag out 2nd',
|
|
51
|
+
'TO3' => 'Tag out 3rd',
|
|
52
|
+
'TO4' => 'Tag out Home',
|
|
53
|
+
'FO1' => 'Force out 1st',
|
|
54
|
+
'FO2' => 'Force out 2nd',
|
|
55
|
+
'FO3' => 'Force out 3rd',
|
|
56
|
+
'FO4' => 'Force out Home',
|
|
57
|
+
'CS2' => 'Caught Stealing 2nd',
|
|
58
|
+
'CS3' => 'Caught Stealing 3rd',
|
|
59
|
+
'CS4' => 'Caught Stealing Home',
|
|
60
|
+
'SB2E3' => 'Stole 2nd, error to 3rd',
|
|
61
|
+
'SB2E4' => 'Stole 2nd, error to Home',
|
|
62
|
+
'SB3E4' => 'Stole 3nd, error to Home',
|
|
63
|
+
'DI2' => 'Indifference to 2nd',
|
|
64
|
+
'DI3' => 'Indifference to 3rd',
|
|
65
|
+
'DO1' => 'Doubled off 1st',
|
|
66
|
+
'DO2' => 'Doubled off 2nd',
|
|
67
|
+
'DO3' => 'Doubled off 3rd',
|
|
68
|
+
'RI' => 'Runner Interference',
|
|
69
|
+
'OOA' => 'Out on Appeal',
|
|
70
|
+
'OBP' => 'Out of Base Path',
|
|
71
|
+
'HBB' => 'Hit by Batted Ball',
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
27
75
|
end
|
|
28
76
|
end
|
|
29
77
|
end
|