lib/sportradar/api/images.rb in sportradar-api-0.1.38 vs lib/sportradar/api/images.rb in sportradar-api-0.9.0
- old
+ new
@@ -16,27 +16,39 @@
if league
response = get request_url("#{league}/#{image_type}/players/#{year}/manifest")
else
response = get request_url("players/#{image_type}/manifests/all_assets")
end
- Sportradar::Api::Images::AssetList.new response["assetlist"] if response.success? && response["assetlist"]
+ if response.success? && response["assetlist"]
+ Sportradar::Api::Images::AssetList.new response["assetlist"]
+ else
+ response
+ end
end
alias_method :all_players, :player_manifests
# Coach Manifests
def coach_manifests
raise Sportradar::Api::Error::InvalidLeague unless league.nil?
response = get request_url("coaches/#{image_type}/manifests/all_assets")
- Sportradar::Api::Images::AssetList.new response["assetlist"] if response.success? && response["assetlist"]
+ if response.success? && response["assetlist"]
+ Sportradar::Api::Images::AssetList.new response["assetlist"]
+ else
+ response
+ end
end
alias_method :all_coaches, :coach_manifests
def venue_manifests
raise Sportradar::Api::Error::InvalidLeague unless league.nil?
response = get request_url("venues/manifests/all_assets")
- Sportradar::Api::Images::AssetList.new response["assetlist"] if response.success? && response["assetlist"]
+ if response.success? && response["assetlist"]
+ Sportradar::Api::Images::AssetList.new response["assetlist"]
+ else
+ response
+ end
end
alias_method :all_venues, :venue_manifests
# The Player Images, Coach Images, Venue Images APIs aren't really meant to be used directly, the manifests return an href path of an image we can pass it into the image_url method to get the entire image url
def image_url(href)
@@ -119,12 +131,13 @@
def soccer_leagues
['bundesliga', 'epl', 'serie-a', 'la-liga', 'ligue-1']
end
- def additional_content_sports
- ['mlb', 'nba', 'nfl', 'nhl']
- end
+ # Was going to use this to prevent access to venues/coaches for sports that aren't this
+ # def additional_content_sports
+ # ['mlb', 'nba', 'nfl', 'nhl']
+ # end
end
end
end