lib/sportradar/api/soccer/competition.rb in sportradar-api-0.19.3 vs lib/sportradar/api/soccer/competition.rb in sportradar-api-0.19.4
- old
+ new
@@ -50,11 +50,28 @@
if current_season&.year&.split('/')&.last
2000 + current_season.year.split('/').last.to_i
end
end
+ def hierarchy
+ self.get_seasons
+ season = self.latest_season
+ season.get_competitors
+ season.competitors
+ end
+
+ def teams
+ season = self.latest_season
+ season.get_competitors if season.competitors.empty?
+ season.competitors
+ end
+
def current_season
seasons.detect(&:current?)
+ end
+
+ def latest_season
+ seasons.max_by(&:end_date)
end
def standings(type = nil)
if type
@standings_hash[type]