lib/sportradar/api/baseball/mlb.rb in sportradar-api-0.11.0 vs lib/sportradar/api/baseball/mlb.rb in sportradar-api-0.11.1

- old
+ new

@@ -8,10 +8,15 @@ @league = 'mlb' raise Sportradar::Api::Error::InvalidAccessLevel unless allowed_access_levels.include? access_level @access_level = access_level end + def sim! + @version = 5 + super + end + def get_data(url) data = get request_url(url) if data.is_a?(Sportradar::Api::Error) puts request_url(url) puts @@ -36,20 +41,10 @@ else 't' end end - def league_hierarchy - response = get request_url("league/hierarchy") - if response.success? - Sportradar::Api::Baseball::Mlb::Hierarchy.new(response.to_h, api: self) - else - response - end - end - alias :hierarchy :league_hierarchy - def content_format 'json' end private @@ -57,22 +52,24 @@ def request_url(path) "/mlb-#{access_level}#{version}/#{path}" end def api_key - if access_level != 't' + if !['t', 'sim'].include?(access_level) Sportradar::Api.api_key_params('mlb', 'production') + elsif 'sim' == access_level + Sportradar::Api.api_key_params('mlb', 'simulation') else Sportradar::Api.api_key_params('mlb') end end def version - Sportradar::Api.version('mlb') + @version || Sportradar::Api.version('mlb') end def allowed_access_levels - %w[p t] + %w[p t sim] end def allowed_seasons ["pre", "reg", "pst"] end