sportradar-api 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api/soccer/match.rb +13 -1
- data/lib/sportradar/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64a63bf2183c414320f53009ec6591759567411b
|
4
|
+
data.tar.gz: 0c881180e9d6aac69afd46dbd7b93c3022341abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0474ae69f32ac0c765dc6014d9b8842e684951ec21c73a92d056c8c75371eb4ecb4eae54c3a9685971091d22693ce6905781d86333279e5e40317dc15ddcc8dd
|
7
|
+
data.tar.gz: 248b63c613cb9b90372fae0c73c1641b8b9347240ddbe6c80e2782577b045ddf8b94eb7db577191db4c010b68532f77bd793c44c5c95d91ca34872c0555109fb
|
data/Gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ module Sportradar
|
|
2
2
|
module Api
|
3
3
|
class Soccer::Match < Data
|
4
4
|
|
5
|
-
attr_accessor :id, :status, :scheduled, :scratched, :season_id, :reference_id, :category, :tournament_group, :tournament, :home, :away, :venue, :round, :coverage, :period, :clock, :referee, :facts, :response
|
5
|
+
attr_accessor :id, :status, :scheduled, :scratched, :season_id, :reference_id, :category, :tournament_group, :tournament, :home, :away, :venue, :round, :coverage, :period, :clock, :referee, :facts, :response, :future_game, :winner
|
6
6
|
|
7
7
|
def initialize(data)
|
8
8
|
@response = data
|
@@ -22,6 +22,9 @@ module Sportradar
|
|
22
22
|
@home = Sportradar::Api::Soccer::Team.new data["home"]
|
23
23
|
@venue = Sportradar::Api::Soccer::Venue.new data["venue"] if data["venue"]
|
24
24
|
|
25
|
+
@future_game = @scheduled > Time.now.utc
|
26
|
+
@winner = find_winner unless future_game
|
27
|
+
|
25
28
|
# Actual stats from match summary
|
26
29
|
@period = data["period"]
|
27
30
|
@clock = data["clock"]
|
@@ -29,6 +32,15 @@ module Sportradar
|
|
29
32
|
@facts = data["facts"]["fact"].map {|fact| Sportradar::Api::Soccer::Fact.new fact } if data["facts"]
|
30
33
|
end
|
31
34
|
|
35
|
+
def find_winner
|
36
|
+
if @home.winner == 'draw'
|
37
|
+
'draw'
|
38
|
+
else
|
39
|
+
[@home, @away].find {|team| team.winner == "true" }
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
32
44
|
def period_name
|
33
45
|
period_names = {"P1" => "Period one", "H" => "Halftime", "P2" => "Period two", "PX1" => "Pre-extra time one", "X1" => "Extra time one", "PX2" => "Pre-extra time two", "X2" => "Extra time two", "PP" => "Pre-penalty", "P" => "Penalty"}
|
34
46
|
period_names[period] if period
|