lib/sportradar/api/images.rb in sportradar-api-0.10.24 vs lib/sportradar/api/images.rb in sportradar-api-0.10.25

- old
+ new

@@ -1,15 +1,16 @@ module Sportradar module Api class Images < Request - attr_accessor :sport, :league, :access_level, :nfl_premium - def initialize( sport, access_level: 't', league: nil, nfl_premium: false) + attr_accessor :sport, :league, :access_level, :nfl_premium, :usat_premium + def initialize( sport, access_level: 't', league: nil, nfl_premium: false, usat_premium: false ) raise Sportradar::Api::Error::InvalidSport unless allowed_sports.include? sport @sport = sport raise Sportradar::Api::Error::InvalidLeague unless soccer_leagues.include?(league) || league.nil? @league = league @nfl_premium = nfl_premium + @usat_premium = usat_premium raise Sportradar::Api::Error::InvalidAccessLevel unless allowed_access_levels.include? access_level @access_level = access_level end def player_manifests(year = Date.today.year) @@ -17,11 +18,11 @@ if year != Date.today.year response = get request_url("#{league}/#{image_type}/players/#{year}/manifest") else response = get request_url("#{league}/#{image_type}/players/manifest") end - elsif nfl_premium + elsif nfl_premium || usat_premium response = get request_url("#{image_type}/players/#{year}/manifest") else response = get request_url("players/#{image_type}/manifests/all_assets") end if response.success? && response["assetlist"] @@ -82,10 +83,14 @@ else if nfl_premium && access_level == 'p' Sportradar::Api.api_key_params("images_nfl_official_premium", "production") elsif nfl_premium Sportradar::Api.api_key_params("images_nfl_official_premium") + elsif sport == 'mlb' && usat_premium && access_level == 'p' + Sportradar::Api.api_key_params("images_mlb_premium", "production") + elsif sport == 'mlb' && usat_premium + Sportradar::Api.api_key_params("images_mlb_premium") elsif access_level == 'p' Sportradar::Api.api_key_params("images_#{sport}", "production") else Sportradar::Api.api_key_params("images_#{sport}") end @@ -97,18 +102,20 @@ end def provider if nfl_premium 'ap_premium' + elsif usat_premium + 'usat_premium' elsif uses_v2_api? 'usat' elsif uses_v3_api? 'reuters' end end def version - if uses_v3_api? || nfl_premium + if uses_v3_api? || nfl_premium || usat_premium 3 elsif uses_v2_api? Sportradar::Api.version('images') end end