Class: Sportradar::Api::LiveImages
- Defined in:
- lib/sportradar/api/live_images.rb
Instance Attribute Summary collapse
-
#access_level ⇒ Object
Returns the value of attribute access_level.
-
#sport ⇒ Object
Returns the value of attribute sport.
Attributes inherited from Request
#qps_allotted, #qps_current, #quota_allotted, #quota_current
Instance Method Summary collapse
- #daily_manifest(date = Date.today) ⇒ Object (also: #all_images)
-
#image_url(href) ⇒ Object
The Event 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.
-
#initialize(sport, access_level = 't') ⇒ LiveImages
constructor
A new instance of LiveImages.
Methods inherited from Request
#get, #get_data, #get_request_info, #parse_usage, #sim!, #usage
Constructor Details
#initialize(sport, access_level = 't') ⇒ LiveImages
Returns a new instance of LiveImages.
6 7 8 9 10 11 |
# File 'lib/sportradar/api/live_images.rb', line 6 def initialize( sport, access_level = 't') raise Sportradar::Api::Error::InvalidSport unless allowed_sports.include? sport @sport = sport raise Sportradar::Api::Error::InvalidAccessLevel unless allowed_access_levels.include? access_level @access_level = access_level end |
Instance Attribute Details
#access_level ⇒ Object
Returns the value of attribute access_level.
4 5 6 |
# File 'lib/sportradar/api/live_images.rb', line 4 def access_level @access_level end |
#sport ⇒ Object
Returns the value of attribute sport.
4 5 6 |
# File 'lib/sportradar/api/live_images.rb', line 4 def sport @sport end |
Instance Method Details
#daily_manifest(date = Date.today) ⇒ Object Also known as: all_images
13 14 15 16 17 18 19 20 |
# File 'lib/sportradar/api/live_images.rb', line 13 def daily_manifest(date = Date.today ) response = get request_url("#{image_type }/#{date.to_s}/manifests/all_assets") if response.success? && response["assetlist"] Sportradar::Api::Images::AssetList.new response["assetlist"] else response end end |
#image_url(href) ⇒ Object
The Event 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
24 25 26 27 |
# File 'lib/sportradar/api/live_images.rb', line 24 def image_url(href) href.slice!(0) if href.chars.first == '/' # remove initial '/' set_base request_url(href) + api_key_query_string end |