sportradar-api 0.20.0.pre → 0.20.0.pre2

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: 9a4d74bbc98d4c89505d04f448536bc7ec81fff059ca2a2d4099bb52aec5be0a
4
+ data.tar.gz: 8c4f9b76a6f8abc00a6ec0b674c8b09a34cb91a16151622998a7378b74c7e557
5
5
  SHA512:
6
- metadata.gz: fd54b0aa75e0f0c7679b41012357455ef6788192946b7725061782e728c1faa77f935ddbb2791eea741476898082b24996225a1bfe781c0f9c79b3319340aa40
7
- data.tar.gz: cc3d800dc061431e86eafd74c6fcdc4111c23199cdc3f0a196d7c618d900f988ad1abd78752587d5ea761499fef94079925fc59292c1a07c141f06ac6021d958
6
+ metadata.gz: 19e8efe729085c89fe2845e8b3758b76589c947d267917bf1291d390ce2818c60b37a4d66e3ff327848b66ec74ab88c984f26570faf72a79766b7f4b9fce1847
7
+ data.tar.gz: 5b46459f020f0321e1b5af4ba50c31722a7d35d751a833d12af1216b5271febf7374268bfc598ad2820cb12233586eec16d7b35506395232afa9a4254643e573
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.pre2)
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
@@ -48,6 +48,7 @@ module Sportradar
48
48
 
49
49
 
50
50
  update_fighters(data) if data['competitors']
51
+ update_statistics(data['statistics']) if data["statistics"]
51
52
 
52
53
  self
53
54
  end
@@ -77,6 +78,20 @@ module Sportradar
77
78
  create_data(@fighters_hash, data['competitors'], klass: Fighter, api: api, fight: self)
78
79
  end
79
80
  end
81
+
82
+ def update_statistics(data)
83
+ @statistics['totals'] = structure_stats(data["totals"]) if data["totals"]
84
+ if data['periods']
85
+ data['periods'].each do |round|
86
+ @statistics[round['number']] = structure_stats(round)
87
+ end
88
+ end
89
+ end
90
+
91
+ def structure_stats(data)
92
+ data['competitors'].map { |comp_data| [comp_data['id'], comp_data.merge(comp_data.delete('statistics'))] }.to_h
93
+ end
94
+
80
95
  def api
81
96
  @api ||= Sportradar::Api::Mma.new
82
97
  end
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.20.0.pre"
3
+ VERSION = "0.20.0.pre2"
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.pre2
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-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler