sportradar-api 0.20.0.pre → 0.20.0

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
  SHA256:
3
- metadata.gz: 59b7c64c57502e09e0710bab7364fa547678c09db700de7d9a9995a118c077e3
4
- data.tar.gz: 7304057033316bda190fc8a9531686b745b6c63ca496d755c60080b61082579d
3
+ metadata.gz: efdb1c2b6c7dfaab41b0f12a3ce3f36ba5c887a9165f4e9f55cf93da6e06ffc0
4
+ data.tar.gz: fae52f1e64953e51d8329dcb8273de67cd83e156fe8f0c3b33200abe37c1fd34
5
5
  SHA512:
6
- metadata.gz: fd54b0aa75e0f0c7679b41012357455ef6788192946b7725061782e728c1faa77f935ddbb2791eea741476898082b24996225a1bfe781c0f9c79b3319340aa40
7
- data.tar.gz: cc3d800dc061431e86eafd74c6fcdc4111c23199cdc3f0a196d7c618d900f988ad1abd78752587d5ea761499fef94079925fc59292c1a07c141f06ac6021d958
6
+ metadata.gz: cbb4cdd8825d33afa1b392641884a3cbd954769e257a31142ed5ea22a6c3b6ec495bd9472ff7af0317693cdd9e5f168187de3cb36fa8ffc461ad7f47011c7510
7
+ data.tar.gz: d731a41a12e03aa9f9e3353a896fefaa93c5719bba6a9029439ffa2f17e10cea20e5e7aa8383e136c549d215095cec5d03daf6edb6720b16b79610627064454d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.20.0.pre)
4
+ sportradar-api (0.20.0)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -2,7 +2,7 @@ module Sportradar
2
2
  module Api
3
3
  module Mma
4
4
  class Fight < Data
5
- attr_accessor :response, :id, :season, :start_time, :start_time_confirmed, :sport_event_context, :coverage, :venue, :status, :match_status, :winner_id, :final_round, :final_round_length, :end_method, :winner, :scheduled_length, :weight_class, :title_fight
5
+ attr_accessor :response, :id, :season, :start_time, :start_time_confirmed, :sport_event_context, :coverage, :venue, :status, :match_status, :winner_id, :final_round, :final_round_length, :end_method, :winner, :scheduled_length, :weight_class, :title_fight, :statistics
6
6
 
7
7
  def initialize(data, **opts)
8
8
  @response = data
@@ -21,6 +21,9 @@ module Sportradar
21
21
  end
22
22
 
23
23
  def update(data, **opts)
24
+ if data["summaries"]
25
+ update(data["summaries"][0])
26
+ end
24
27
  if data["sport_event"]
25
28
  update(data["sport_event"])
26
29
  end
@@ -48,6 +51,7 @@ module Sportradar
48
51
 
49
52
 
50
53
  update_fighters(data) if data['competitors']
54
+ update_statistics(data['statistics']) if data["statistics"]
51
55
 
52
56
  self
53
57
  end
@@ -77,8 +81,22 @@ module Sportradar
77
81
  create_data(@fighters_hash, data['competitors'], klass: Fighter, api: api, fight: self)
78
82
  end
79
83
  end
84
+
85
+ def update_statistics(data)
86
+ @statistics['totals'] = structure_stats(data["totals"]) if data["totals"]
87
+ if data['periods']
88
+ data['periods'].each do |round|
89
+ @statistics[round['number']] = structure_stats(round)
90
+ end
91
+ end
92
+ end
93
+
94
+ def structure_stats(data)
95
+ data['competitors'].map { |comp_data| [comp_data['id'], comp_data.merge(comp_data.delete('statistics'))] }.to_h
96
+ end
97
+
80
98
  def api
81
- @api ||= Sportradar::Api::Mma.new
99
+ @api ||= Sportradar::Api::Mma::Api.new
82
100
  end
83
101
 
84
102
 
@@ -65,7 +65,7 @@ module Sportradar
65
65
  self
66
66
  end
67
67
  def api
68
- @api ||= Sportradar::Api::Mma.new
68
+ @api ||= Sportradar::Api::Mma::Api.new
69
69
  end
70
70
 
71
71
 
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.20.0.pre"
3
+ VERSION = "0.20.0"
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.20.0.pre
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-22 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -459,9 +459,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
459
459
  version: '0'
460
460
  required_rubygems_version: !ruby/object:Gem::Requirement
461
461
  requirements:
462
- - - ">"
462
+ - - ">="
463
463
  - !ruby/object:Gem::Version
464
- version: 1.3.1
464
+ version: '0'
465
465
  requirements: []
466
466
  rubygems_version: 3.0.3.1
467
467
  signing_key: