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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api/mma/fight.rb +20 -2
- data/lib/sportradar/api/mma/fighter.rb +1 -1
- data/lib/sportradar/api/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efdb1c2b6c7dfaab41b0f12a3ce3f36ba5c887a9165f4e9f55cf93da6e06ffc0
|
4
|
+
data.tar.gz: fae52f1e64953e51d8329dcb8273de67cd83e156fe8f0c3b33200abe37c1fd34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbb4cdd8825d33afa1b392641884a3cbd954769e257a31142ed5ea22a6c3b6ec495bd9472ff7af0317693cdd9e5f168187de3cb36fa8ffc461ad7f47011c7510
|
7
|
+
data.tar.gz: d731a41a12e03aa9f9e3353a896fefaa93c5719bba6a9029439ffa2f17e10cea20e5e7aa8383e136c549d215095cec5d03daf6edb6720b16b79610627064454d
|
data/Gemfile.lock
CHANGED
@@ -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
|
|
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
|
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-
|
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:
|
464
|
+
version: '0'
|
465
465
|
requirements: []
|
466
466
|
rubygems_version: 3.0.3.1
|
467
467
|
signing_key:
|