Module: VistarClient::API::UnifiedServing
Overview
Unified Ad Serving API for loop-based content scheduling.
This module implements the Vistar Media Unified Ad Serving API which provides scheduled loops of content for digital signage playlists. It combines direct scheduled content, programmatic ad opportunities, and loop-based content into a unified sequence.
The API returns a loop of slots (typically 24 hours) that can be played repeatedly. Each slot has a type: advertisement, content, or programmatic.
Instance Method Summary collapse
-
#get_loop(venue_id:, display_time: nil, with_metadata: false) ⇒ Hash
Get scheduled loop of content slots for digital signage playlist.
-
#submit_loop_tracking(tracking_url:, display_time: nil) ⇒ Faraday::Response
Submit tracking URL for loop slot completion.
Instance Method Details
#get_loop(venue_id:, display_time: nil, with_metadata: false) ⇒ Hash
Get scheduled loop of content slots for digital signage playlist.
Returns a sequence of slots (advertisement, content, programmatic) that form a repeating loop until end_time. The response includes both slots[] and assets[] for efficient pre-caching.
Recommended: Request new loops at least every 30 minutes, even if end_time is far in the future.
80 81 82 83 84 85 86 87 |
# File 'lib/vistar_client/api/unified_serving.rb', line 80 def get_loop(venue_id:, display_time: nil, with_metadata: false) validate_get_loop_params!(venue_id, display_time, ) payload = build_get_loop_payload(venue_id, display_time, ) response = connection.post('/v1beta2/loop', payload) response.body end |
#submit_loop_tracking(tracking_url:, display_time: nil) ⇒ Faraday::Response
Submit tracking URL for loop slot completion.
Convenience method to hit tracking URLs with proper display_time appending. Always appends display_time query parameter for accurate tracking, even if the slot was displayed at a different time than scheduled.
Tracking URLs don’t expire, making this suitable for offline devices that may submit tracking data later (up to 30 days in the past).
122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/vistar_client/api/unified_serving.rb', line 122 def submit_loop_tracking(tracking_url:, display_time: nil) raise ArgumentError, 'tracking_url is required' if tracking_url.nil? || tracking_url.to_s.empty? display_time ||= Time.now.to_i # Append display_time query parameter separator = tracking_url.include?('?') ? '&' : '?' url = "#{tracking_url}#{separator}display_time=#{display_time}" # Use Connection#get_request for tracking URLs connection.get_request(url) end |