sportradar-api 0.13.16 → 0.13.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d9c809aae29d3fd2cec351ad7ad73403cffe8ac
4
- data.tar.gz: 936e87965be194e38a1d59bdda04f967699dee19
3
+ metadata.gz: 15b657c8f1ad8710c0cb6bf38d32671b11a8f81a
4
+ data.tar.gz: 4550851ad2ae0b79939d83de91a7f37677b9d61c
5
5
  SHA512:
6
- metadata.gz: fe4d6052bd9b67dfef4b5fedf4b47bfdbe05133ef75f4e27c6bcbe21cb19e5d19dee7a1f5d7e58083a49a1fb4f19eecc9505b1ea14b484b9a33c0e8496003690
7
- data.tar.gz: 450edc8d03af7546e126d165b547521cea3688f7bdc841b6f5686f3d5deb8421b7489025d8c16611245c4bda32cf7c3e0d894c2a532cd7e01985cb7448b78ace
6
+ metadata.gz: cbe5d64ff33024f87dc3606caee80a49ebc8f643d174b15f5c1ce36204dc31ce1252c65fb6def7f47b5b221637d4f344165478c43176288e8e6fc76c8ca65519
7
+ data.tar.gz: bb3c31e9fee423a17f608dfa963542683e2832a216867f6c08e4dc302952cbe80a9e041b926da5fc7bb8244583f34eac77d705255af07bf43eaa5893bad93ce2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.13.16)
4
+ sportradar-api (0.13.17)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -86,7 +86,7 @@ GEM
86
86
  thor (0.19.4)
87
87
  thread_safe (0.3.6)
88
88
  tins (1.14.0)
89
- tzinfo (1.2.3)
89
+ tzinfo (1.2.4)
90
90
  thread_safe (~> 0.1)
91
91
  vcr (3.0.3)
92
92
  webmock (3.0.1)
@@ -23,8 +23,8 @@ module Sportradar
23
23
  @lineups_hash = {}
24
24
  get_tournament_id(data, **opts)
25
25
  @scoring_raw = Scoring.new(data, game: self)
26
- @home = Team.new({}, api: api, match: self)
27
- @away = Team.new({}, api: api, match: self)
26
+ @home = Team.new(data['home'].to_h, api: api, match: self)
27
+ @away = Team.new(data['away'].to_h, api: api, match: self)
28
28
  @teams_hash = { away: @away, home: @home }
29
29
  @team_ids = { away: @away.id, home: @home.id }
30
30
  @team_stats = {}
@@ -226,6 +226,19 @@ module Sportradar
226
226
  end
227
227
  end
228
228
 
229
+ def timeline_by_minute(minute_start, minute_end = nil)
230
+ if minute_end
231
+ @timeline_hash.each_value.select { |ev| (minute_start..minute_end).cover?(ev.match_time.to_i) }
232
+ else
233
+ @timeline_hash.each_value.select { |ev| minute_start === ev.match_time }
234
+ end
235
+ end
236
+
237
+ def plays_by_minute(type, minute_start, minute_end = nil)
238
+ timeline_by_minute(minute_start, minute_end).select { |ev| ev.type == type }
239
+ end
240
+
241
+
229
242
  def lineups(which = nil)
230
243
  if which
231
244
  @lineups_hash[which.to_s]
@@ -61,10 +61,10 @@ module Sportradar
61
61
  def get_tournament_id(data, **opts)
62
62
  @tournament_id ||= if opts[:tournament]
63
63
  opts[:tournament].id
64
- elsif opts[:season]
65
- opts[:season].tournament_id
66
- elsif opts[:match]
67
- opts[:match].tournament_id
64
+ elsif opts[:season]&.tournament_id
65
+ opts[:season]&.tournament_id
66
+ elsif opts[:match]&.tournament_id
67
+ opts[:match]&.tournament_id
68
68
  elsif data['tournament_id']
69
69
  data['tournament_id']
70
70
  elsif data['tournament']
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.13.16"
3
+ VERSION = "0.13.17"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportradar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.16
4
+ version: 0.13.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-01 00:00:00.000000000 Z
11
+ date: 2017-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler