lib/sportradar/api/soccer.rb in sportradar-api-0.1.7 vs lib/sportradar/api/soccer.rb in sportradar-api-0.1.8

- old
+ new

@@ -1,14 +1,15 @@ module Sportradar module Api class Soccer < Request - attr_accessor :league, :access_level - def initialize(league = "na", access_level = "t") + attr_accessor :league, :access_level, :simulation + def initialize(league = "na", access_level = "t", simulation = false) raise Sportradar::Api::Error::InvalidAccessLevel unless allowed_access_levels.include? access_level raise Sportradar::Api::Error::InvalidLeague unless allowed_leagues.include? league @league = league @access_level = access_level + @simulation = simulation end def schedule response = get request_url("matches/schedule") Sportradar::Api::Soccer::Schedule.new response @@ -68,13 +69,21 @@ def team_standings response = get request_url("teams/standing") Sportradar::Api::Soccer::Standing.new response["standings"] if response.success? && response["standings"] end + def simulation_match + "22653ed5-0b2c-4e30-b10c-c6d51619b52b" + end + private def request_url(path) - "/soccer-#{access_level}#{version}/#{league}/#{path}" + if simulation + "/soccer-sim2/wc/#{path}" + else + "/soccer-#{access_level}#{version}/#{league}/#{path}" + end end def api_key Sportradar::Api.api_key_params("soccer_#{league}") end