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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8aecf6e5a4e046e48a38fd04e4882d425364afba
4
- data.tar.gz: 4a04847ed7c908fc3fde9099416dc192ea2c569f
3
+ metadata.gz: 64a63bf2183c414320f53009ec6591759567411b
4
+ data.tar.gz: 0c881180e9d6aac69afd46dbd7b93c3022341abf
5
5
  SHA512:
6
- metadata.gz: c0c422899928dd5df18788d37c00cd7cc1c54962a5f1bb65647ad4ecf98420445b8fe3f664f3eb516be3e60b59b9a00ce5bd41c321bed3657e6d738bdcd40514
7
- data.tar.gz: ea221e7f902b8f13a017058e1574cc380d4bb85b7a7dc8d7101c45e77a8301a79f896d03598c3e9d483841c38c709b43bc199b99eba0dc706aaa74485dd64e74
6
+ metadata.gz: 0474ae69f32ac0c765dc6014d9b8842e684951ec21c73a92d056c8c75371eb4ecb4eae54c3a9685971091d22693ce6905781d86333279e5e40317dc15ddcc8dd
7
+ data.tar.gz: 248b63c613cb9b90372fae0c73c1641b8b9347240ddbe6c80e2782577b045ddf8b94eb7db577191db4c010b68532f77bd793c44c5c95d91ca34872c0555109fb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.1.8)
4
+ sportradar-api (0.1.10)
5
5
  activesupport
6
6
  httparty (>= 0.13.3)
7
7
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.10"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportradar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett