Module: Sportradar::Api::Soccer

Defined in:
lib/sportradar/api/soccer.rb,
lib/sportradar/api/soccer/api.rb,
lib/sportradar/api/soccer/fact.rb,
lib/sportradar/api/soccer/team.rb,
lib/sportradar/api/soccer/event.rb,
lib/sportradar/api/soccer/group.rb,
lib/sportradar/api/soccer/match.rb,
lib/sportradar/api/soccer/venue.rb,
lib/sportradar/api/soccer/lineup.rb,
lib/sportradar/api/soccer/player.rb,
lib/sportradar/api/soccer/season.rb,
lib/sportradar/api/soccer/scoring.rb,
lib/sportradar/api/soccer/standing.rb,
lib/sportradar/api/soccer/team_group.rb,
lib/sportradar/api/soccer/tournament.rb,
lib/sportradar/api/soccer/competition.rb

Defined Under Namespace

Classes: Api, Competition, Event, Fact, Group, Lineup, Match, Player, Scoring, Season, Standing, Team, TeamGroup, Tournament, Venue

Class Method Summary collapse

Class Method Details

.apiObject



38
39
40
# File 'lib/sportradar/api/soccer.rb', line 38

def self.api
  @api ||= Sportradar::Api::Soccer::Api.new
end

.get_competitionsObject



25
26
27
28
# File 'lib/sportradar/api/soccer.rb', line 25

def self.get_competitions
  data = api.get_data(path_competitions).to_h
  parse_competitions(data)
end

.parse_competitions(data) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/sportradar/api/soccer.rb', line 30

def self.parse_competitions(data)
  if data['competitions']
    data['competitions'].map do |hash|
      Competition.new(hash, api: api)
    end
  end
end

.parse_results(arr) ⇒ Object



21
22
23
# File 'lib/sportradar/api/soccer.rb', line 21

def self.parse_results(arr)
  arr.map { |hash| hash["sport_event"].merge(hash["sport_event_status"]) }
end

.path_competitionsObject

url path helpers



43
44
45
# File 'lib/sportradar/api/soccer.rb', line 43

def self.path_competitions
  "competitions"
end