lib/sportradar/api/soccer.rb in sportradar-api-0.1.25 vs lib/sportradar/api/soccer.rb in sportradar-api-0.1.26

- old
+ new

@@ -1,15 +1,14 @@ module Sportradar module Api class Soccer < Request attr_accessor :league, :access_level, :simulation - def initialize(league = "na", access_level = "t", simulation = false) + def initialize(league = "na", access_level = "t") 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 @@ -32,16 +31,18 @@ Sportradar::Api::Soccer::Boxscore.new response end # match_id = "357607e9-87cd-4848-b53e-0485d9c1a3bc" def match_summary(match_id) + check_simulation(match_id) response = get request_url("matches/#{match_id}/summary") Sportradar::Api::Soccer::Summary.new response end # match_id = "357607e9-87cd-4848-b53e-0485d9c1a3bc" def match_boxscore(match_id) + check_simulation(match_id) response = get request_url("matches/#{match_id}/boxscore") Sportradar::Api::Soccer::Boxscore.new response end # team_id = "b78b9f61-0697-4347-a1b6-b7685a130eb1" @@ -74,9 +75,13 @@ def simulation_match "22653ed5-0b2c-4e30-b10c-c6d51619b52b" end private + + def check_simulation(match_id) + @simulation = true if match_id == simulation_match + end def request_url(path) if simulation "/soccer-sim2/wc/#{path}" else