sportradar-api 0.9.55 → 0.9.56

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: e16145bde571888af4764729db4031bfcf17343c
4
- data.tar.gz: e392405fecaff5488227515f436d9428e5b7cff6
3
+ metadata.gz: '084b14d963276db2e60db96a1ce5c241213603ab'
4
+ data.tar.gz: 7c429f5679aaebbb9c3670924b37a4451922cf86
5
5
  SHA512:
6
- metadata.gz: 9035e1c84f0c9648d4049940c4b25f5625893ca3d9cd1a8eebd0cb324feeb155718bb3002424b98a2ef062514d0410d13a7ba1f0a3bcec4e5b3ab9c09d4ba8cd
7
- data.tar.gz: 8068dc1fc2b6dc1054d7e3a43e142292ce3570b65357c8f99dcd5353673cc027a009617a6767f8d6433cb4e8ddeb176f31f73e522641ec0c3b37b961676677e2
6
+ metadata.gz: 91ab4641debcfb0e07ddc083e1efa57777608874c857636e4c9c68bd969fb7f9fce77ac8f45a65fb2c80f03a66cbb564aba15bb5b912594624b5aab8f5feb104
7
+ data.tar.gz: 97775135f32329c855beee2ba97d2322080d6914834711f1985985d716f5df9d0a072871d5d068ae8fc7c5872f0758f0015306ea5954f2d732de6df5d06b1f5b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.9.55)
4
+ sportradar-api (0.9.56)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -3,7 +3,7 @@ module Sportradar
3
3
  module Basketball
4
4
  class Nba
5
5
  class Game < Data
6
- attr_accessor :response, :id, :home, :away, :home_id, :away_id, :score, :scoring, :status, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :quarter, :team_stats, :player_stats, :changes, :media_timeouts
6
+ attr_accessor :response, :id, :home_id, :away_id, :score, :scoring, :status, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :quarter, :team_stats, :player_stats, :changes, :media_timeouts
7
7
  @all_hash = {}
8
8
  # def self.new(data, **opts)
9
9
  # existing = @all_hash[data['id']]
@@ -269,10 +269,11 @@ end
269
269
  __END__
270
270
 
271
271
  ss = sr.schedule;
272
- sr = Sportradar::Api::Basketball::Nba.new
273
272
  sd = sr.daily_schedule;
273
+ sr = Sportradar::Api::Basketball::Nba.new
274
274
  sd = sr.daily_schedule(Date.yesterday)
275
- g = sd.games.last;
275
+ sd = sr.daily_schedule(Date.new(2017, 1, 20))
276
+ g = sd.games.first;
276
277
  box = g.get_box;
277
278
  pbp = g.get_pbp;
278
279
  g.quarters.size
@@ -3,7 +3,7 @@ module Sportradar
3
3
  module Basketball
4
4
  class Nba
5
5
  class Player < Data
6
- attr_accessor :response, :id, :number, :full_name, :first_name, :last_name, :position, :birth_date, :birth_place, :college, :height, :weight, :birth_place, :college, :averages, :draft
6
+ attr_accessor :response, :id, :number, :full_name, :first_name, :last_name, :position, :birth_place, :college, :height, :weight, :averages, :draft
7
7
  # @all_hash = {}
8
8
  # def self.new(data, **opts)
9
9
  # existing = @all_hash[data['id']]
@@ -9,12 +9,7 @@ module Sportradar
9
9
  @api = opts[:api]
10
10
  @game = opts[:game]
11
11
 
12
- @scores = {
13
- 1 => {},
14
- 2 => {},
15
- 3 => {},
16
- 4 => {},
17
- }
12
+ @scores = {}
18
13
  @id = data['id']
19
14
 
20
15
  update(data, **opts)
@@ -66,19 +61,15 @@ module Sportradar
66
61
  b = arr + [da_ot].compact.flatten(1)
67
62
  b.each { |h| h[id] = h.delete('points').to_i }
68
63
  a.zip(b).map{ |a, b| [a['sequence'].to_i, a.merge(b)] }.sort{ |(a,_), (b,_)| a <=> b }.to_h
69
- rescue => e
70
- binding.pry
71
64
  end
72
65
 
73
66
  def parse_from_pbp(data)
74
67
  quarters = data['quarter'][1..-1]
75
68
  overtimes = data['overtime']
76
- overtimes = [overtimes] if overtimes.is_a?(Hash)
77
- quarters = quarters[0] if quarters.is_a?(Array)
78
- data = (quarters + overtimes).map{|q| q['scoring'] }
69
+ overtimes = [overtimes] if !overtimes.is_a?(Array)
70
+ quarters = quarters[0] if (quarters.is_a?(Array) && (quarters.size == 1) && quarters.first.is_a?(Array))
71
+ data = (quarters + overtimes).compact.map{|q| q['scoring'] }
79
72
  data.map.with_index(1) { |h, i| [i, { h.dig('home', 'id') => h.dig('home', 'points').to_i, h.dig('away', 'id') => h.dig('away', 'points').to_i }] }.to_h
80
- rescue => e
81
- {}
82
73
  end
83
74
 
84
75
  def parse_from_summary(data)
@@ -66,6 +66,7 @@ module Sportradar
66
66
  def nba_game_seconds
67
67
  ([quarter, 4].min * 720) + ([quarter - 4, 0].max * 300) - clock_seconds # seconds elapsed in game, only works for NBA
68
68
  end
69
+ alias :game_seconds :nba_game_seconds
69
70
 
70
71
  def update(data, **opts)
71
72
  @event_type = data['event_type'] # "lineupchange",
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.9.55"
3
+ VERSION = "0.9.56"
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.9.55
4
+ version: 0.9.56
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-01-21 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler