lib/sportradar/api/images.rb in sportradar-api-0.10.51 vs lib/sportradar/api/images.rb in sportradar-api-0.10.52
- old
+ new
@@ -1,9 +1,9 @@
module Sportradar
module Api
class Images < Request
- attr_accessor :sport, :league, :access_level, :nfl_premium, :usat_premium, :event_id, :date
+ attr_accessor :sport, :league, :access_level, :nfl_premium, :usat_premium, :event_id, :date, :live_image_request
def initialize( sport, access_level: 't', league: nil, nfl_premium: false, usat_premium: false, event_id: nil, date: nil )
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
@@ -65,10 +65,11 @@
# Event manifests will respont to either date or event_id
def event_manifests
# /[league]/[image_type]/events/[year]/[month]/[day]/manifest.[format]?api_key={your_api_key}
raise Sportradar::Api::Error::InvalidType unless date.present? || event_id.present?
+ @live_image_request = true
if event_id.present?
response = get request_url("actionshots/events/game/#{event_id}/manifest")
elsif date.present?
response = get request_url("actionshots/events/#{date}/manifest")
end
@@ -112,9 +113,13 @@
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 live_image_request && access_level == 'p'
+ Sportradar::Api.api_key_params("live_images_#{sport}", "production")
+ elsif live_image_request
+ Sportradar::Api.api_key_params("live_images_#{sport}")
elsif access_level == 'p'
Sportradar::Api.api_key_params("images_#{sport}", "production")
else
Sportradar::Api.api_key_params("images_#{sport}")
end