sportradar-api 0.13.5 → 0.13.6

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: 3d49ce56fe5c2ca03df70263e5b216efe58d4fbb
4
- data.tar.gz: 65d90cefb754021c67c6dda94fa53fb4f8ad33d9
3
+ metadata.gz: 74474a87a87f1d7c24470c35baf316ebe4298c12
4
+ data.tar.gz: 2521a474e47fe6301ee640af81cfcef6cebe6085
5
5
  SHA512:
6
- metadata.gz: 43ac236b4a45c7178c929036d25a4ae99340bc8e8710a4307e9f7d5791079b5e547aca9757c11ee6ae44e525c786c35687db9140474e7c90dc23e48c164c25f6
7
- data.tar.gz: 9ccedccca1160d5725a5553ea5b327884ffcae3cf11548910b5fcdd8e93dff9998fd250f371665d275bf35393cbdf3b79494c32cb17d4068c3b3716aff5b2f5e
6
+ metadata.gz: 3931981312ecac90dacac1c8efba50664c850dbde5c5eda2ad5002b281e90b3f23233d99c03daf4ce3ccd328bf35125913813a530f960e06242299f7839a3899
7
+ data.tar.gz: dad54c364a8a4776b53651d5c28c0aeeb2b5358e62c3c57be260c7b625dbc6cbc95bb8a771a701ed9b7b68d581dc62a6962502183fc8fe0c7c35a6cc1f4fea5f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.13.5)
4
+ sportradar-api (0.13.6)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -3,7 +3,7 @@ module Sportradar
3
3
  module Basketball
4
4
  class Play
5
5
  class Base < Data
6
- attr_accessor :response, :id, :clock, :event_type, :description, :statistics, :score, :team_id, :player_id, :quarter, :half, :updated, :location, :possession, :on_court, :game_seconds, :identifier
6
+ attr_accessor :response, :id, :clock, :event_type, :description, :statistics, :score, :team_id, :player_id, :quarter, :half, :updated, :location, :possession, :on_court, :on_court_ids, :game_seconds, :identifier
7
7
  alias :type :event_type
8
8
 
9
9
  def initialize(data, **opts)
@@ -87,11 +87,18 @@ module Sportradar
87
87
  @location = data['location'] # {"coord_x"=>"0", "coord_y"=>"0"},
88
88
  @possession = data['possession'] # {"name"=>"Knicks", "market"=>"New York", "id"=>"583ec70e-fb46-11e1-82cb-f4ce4684ea4c"},
89
89
  # @on_court = data['on_court'] # hash
90
+ handle_on_court(data['on_court']) if data['on_court']
90
91
 
91
92
  handle_time(data, **opts)
92
93
  parse_statistics(data) if data['statistics']
93
94
  end
94
95
 
96
+ def handle_on_court(data)
97
+ teams = [data['home'], data['away']]
98
+ @on_court = teams.flat_map { |hash| hash['players'].map { |pl| OpenStruct.new(pl) } }
99
+ @on_court_ids = @on_court.map(&:id)
100
+ end
101
+
95
102
  def handle_time(data, **opts)
96
103
  @game_seconds = if opts[:quarter]
97
104
  @quarter = opts[:quarter].sequence.to_i rescue opts[:quarter].to_i
@@ -34,9 +34,7 @@ module Sportradar
34
34
  @jersey_number = data['jersey_number'] if data['jersey_number']
35
35
  @preferred_foot = data['preferred_foot'] if data['preferred_foot']
36
36
  @matches_played = data['matches_played'] if data['matches_played']
37
-
38
37
  @stats = data['statistics'] if data['statistics']
39
-
40
38
  @date_of_birth = Date.parse(data['date_of_birth']) if data['date_of_birth']
41
39
  end
42
40
 
@@ -45,11 +43,11 @@ module Sportradar
45
43
  end
46
44
 
47
45
  def first_name
48
- @first_name || (@name && @name.split(', ')[1])
46
+ @name.split()[1]
49
47
  end
50
48
 
51
49
  def last_name
52
- @last_name || (@name && @name.split(', ')[0])
50
+ @name.split()[0].delete(',')
53
51
  end
54
52
 
55
53
  def api
@@ -31,7 +31,6 @@ module Sportradar
31
31
  update(data["team"])
32
32
  end
33
33
 
34
-
35
34
  @name = data['name'] if data['name']
36
35
  @country = data['country'] if data['country']
37
36
  @country_code = data['country_code'] if data['country_code']
@@ -235,6 +235,7 @@ module Sportradar
235
235
  'eu.uefa_champions_league' => "sr:tournament:7",
236
236
  'eu.la_liga' => "sr:tournament:8",
237
237
  'eu.eng_premier_league' => "sr:tournament:17",
238
+ 'eu.premier_league' => "sr:tournament:17",
238
239
  'eu.serie_a' => "sr:tournament:23",
239
240
  'eu.ligue_1' => "sr:tournament:34",
240
241
  'eu.bundesliga' => "sr:tournament:35",
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.13.5"
3
+ VERSION = "0.13.6"
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.5
4
+ version: 0.13.6
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-11-08 00:00:00.000000000 Z
11
+ date: 2017-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler