module Sportmonks

Attributes

configuration[RW]

Public Class Methods

aggregated_top_scorer_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 146
def aggregated_top_scorer_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/topscorers/season/#{season_id}/aggregated", options)
end
bookmaker(bookmaker_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 182
def bookmaker(bookmaker_id, options = {})
  Sportmonks::Api.api_get("bookmakers/#{bookmaker_id}", options)
end
bookmakers(options = {}) click to toggle source
# File lib/sportmonks.rb, line 178
def bookmakers(options = {})
  Sportmonks::Api.api_get("bookmakers", options)
end
coach(coach_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 207
def coach(coach_id, options = {})
  Sportmonks::Api.api_get("coaches/#{coach_id}", options)
end
commentaries_by_fixture(fixture_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 114
def commentaries_by_fixture(fixture_id, options = {})
  Sportmonks::Api.api_get("/commentaries/fixture/#{fixture_id}", options)
end
configure() { |configuration| ... } click to toggle source
# File lib/sportmonks.rb, line 5
def configure
  self.configuration ||= Configuration.new
  yield(configuration)
end
continent(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 14
def continent(id, options = {})
  Sportmonks::Api.api_get("/continents/#{id}", options)
end
continents(options = {}) click to toggle source
# File lib/sportmonks.rb, line 10
def continents(options = {})
  Sportmonks::Api.api_get("/continents", options)
end
countries(options = {}) click to toggle source
# File lib/sportmonks.rb, line 18
def countries(options = {})
  Sportmonks::Api.api_get("/countries", options)
end
country(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 22
def country(id, options = {})
  Sportmonks::Api.api_get("/countries/#{id}", options)
end
fixture(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 42
def fixture(id, options = {})
  Sportmonks::Api.api_get("/fixtures/#{id}", options)
end
fixtures(ids, options = {}) click to toggle source
# File lib/sportmonks.rb, line 46
def fixtures(ids, options = {})
  ids_param = ids.join(",")
  Sportmonks::Api.api_get("/fixtures/multi/#{ids_param}", options)
end
fixtures_between(from, to, league_ids = [], options = {}) click to toggle source
# File lib/sportmonks.rb, line 56
def fixtures_between(from, to, league_ids = [], options = {})
  from_str = format_date(from)
  to_str = format_date(to)
  leagues_param = format_league_ids(league_ids)

  if leagues_param
    Sportmonks::Api.api_get(
      "/fixtures/between/#{from_str}/#{to_str}",
      options.merge({leagues: leagues_param})
    )
  else
    Sportmonks::Api.api_get("/fixtures/between/#{from_str}/#{to_str}", options)
  end
end
fixtures_between_by_team(from, to, team_id, league_ids = [], options = {}) click to toggle source
# File lib/sportmonks.rb, line 71
def fixtures_between_by_team(from, to, team_id, league_ids = [], options = {})
  from_str = format_date(from)
  to_str = format_date(to)
  leagues_param = format_league_ids(league_ids)

  if leagues_param
    Sportmonks::Api.api_get(
      "/fixtures/between/#{from_str}/#{to_str}/#{team_id}",
      options.merge({leagues: leagues_param})
    )
  else
    Sportmonks::Api.api_get("/fixtures/between/#{from_str}/#{to_str}/#{team_id}", options)
  end
end
fixtures_by_date(date, options = {}) click to toggle source
# File lib/sportmonks.rb, line 51
def fixtures_by_date(date, options = {})
  date_str = format_date(date)
  Sportmonks::Api.api_get("/fixtures/date/#{date_str}", options)
end
head_2_head(team1_id, team2_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 122
def head_2_head(team1_id, team2_id, options = {})
  Sportmonks::Api.api_get("/head2head/#{team1_id}/#{team2_id}", options)
end
highlights(options = {}) click to toggle source
# File lib/sportmonks.rb, line 118
def highlights(options = {})
  Sportmonks::Api.api_get("/highlights", options)
end
in_play_odds_by_fixure(fixture_id, options = {}) click to toggle source

notice that this api is for bet365 only

# File lib/sportmonks.rb, line 195
def in_play_odds_by_fixure(fixture_id, options = {})
  Sportmonks::Api.api_get("odds/inplay/fixture/#{fixture_id}", options)
end
league(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 30
def league(id, options = {})
  Sportmonks::Api.api_get("/leagues/#{id}", options)
end
leagues(options = {}) click to toggle source
# File lib/sportmonks.rb, line 26
def leagues(options = {})
  Sportmonks::Api.api_get("/leagues", options)
end
live_scores(league_ids = [], options = {}) click to toggle source
# File lib/sportmonks.rb, line 94
def live_scores(league_ids = [], options = {})
  leagues_param = format_league_ids(league_ids)

  if leagues_param
    Sportmonks::Api.api_get("/livescores", options.merge({leagues: leagues_param}))
  else
    Sportmonks::Api.api_get("/livescores", options)
  end
end
live_scores_in_play(league_ids = [], options = {}) click to toggle source
# File lib/sportmonks.rb, line 104
def live_scores_in_play(league_ids = [], options = {})
  leagues_param = format_league_ids(league_ids)

  if leagues_param
    Sportmonks::Api.api_get("/livescores/now", options.merge({leagues: leagues_param}))
  else
    Sportmonks::Api.api_get("/livescores/now", options)
  end
end
market(market_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 190
def market(market_id, options = {})
  Sportmonks::Api.api_get("markets/#{market_id}", options)
end
markets(options = {}) click to toggle source
# File lib/sportmonks.rb, line 186
def markets(options = {})
  Sportmonks::Api.api_get("markets", options)
end
odds_by_fixure(fixture_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 170
def odds_by_fixure(fixture_id, options = {})
  Sportmonks::Api.api_get("odds/fixture/#{fixture_id}", options)
end
odds_by_fixure_and_bookmaker(fixture_id, bookmaker_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 166
def odds_by_fixure_and_bookmaker(fixture_id, bookmaker_id, options = {})
  Sportmonks::Api.api_get("odds/fixture/#{fixture_id}/bookmaker/#{bookmaker_id}", options)
end
odds_by_fixure_and_market(fixture_id, market_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 174
def odds_by_fixure_and_market(fixture_id, market_id, options = {})
  Sportmonks::Api.api_get("odds/fixture/#{fixture_id}/market/#{market_id}", options)
end
player(player_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 199
def player(player_id, options = {})
  Sportmonks::Api.api_get("players/#{player_id}", options)
end
round(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 158
def round(id, options = {})
  Sportmonks::Api.api_get("/rounds/#{id}", options)
end
rounds_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 162
def rounds_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/rounds/season/#{season_id}", options)
end
season(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 38
def season(id, options = {})
  Sportmonks::Api.api_get("/seasons/#{id}", options)
end
seasons(options = {}) click to toggle source
# File lib/sportmonks.rb, line 34
def seasons(options = {})
  Sportmonks::Api.api_get("/seasons", options)
end
squad_by_season_and_team(season_id, team_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 203
def squad_by_season_and_team(season_id, team_id, options = {})
  Sportmonks::Api.api_get("squad/season/#{season_id}/team/#{team_id}", options)
end
stages(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 90
def stages(id, options = {})
  Sportmonks::Api.api_get("/stages/#{id}", options)
end
stages_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 86
def stages_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/stages/season/#{season_id}", options)
end
standings_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 130
def standings_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/standings/season/#{season_id}", options)
end
team(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 134
def team(id, options = {})
  Sportmonks::Api.api_get("/teams/#{id}", options)
end
teams_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 138
def teams_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/teams/season/#{season_id}", options)
end
top_scorer_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 142
def top_scorer_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/topscorers/season/#{season_id}", options)
end
tv_stations_by_fixture(fixture_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 126
def tv_stations_by_fixture(fixture_id, options = {})
  Sportmonks::Api.api_get("/tvstations/fixture/#{fixture_id}", options)
end
venue(id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 150
def venue(id, options = {})
  Sportmonks::Api.api_get("/venues/#{id}", options)
end
venues_by_season(season_id, options = {}) click to toggle source
# File lib/sportmonks.rb, line 154
def venues_by_season(season_id, options = {})
  Sportmonks::Api.api_get("/venues/season/#{season_id}", options)
end

Private Class Methods

format_date(date) click to toggle source
# File lib/sportmonks.rb, line 213
def format_date(date)
  date.strftime("%Y-%m-%d")
end
format_league_ids(league_ids) click to toggle source
# File lib/sportmonks.rb, line 217
def format_league_ids(league_ids)
  if league_ids.size > 0
    league_ids.join(",")
  else
    nil
  end
end