Class: Yt::Annotations::Promotion
- Defined in:
- lib/yt/annotations/promotion.rb
Overview
A Promotion annotation. The CTA overlay is used more for paid campaigns because the video has to be attached to an adsense account to be used.
Instance Attribute Summary
Attributes inherited from Base
#ends_at, #link, #starts_at, #text
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Promotion
constructor
A new instance of Promotion.
Constructor Details
#initialize(data = {}) ⇒ Promotion
Returns a new instance of Promotion.
10 11 12 13 14 15 16 |
# File 'lib/yt/annotations/promotion.rb', line 10 def initialize(data = {}) json = JSON.parse data['data'] @text = text_in json @starts_at = json['start_ms'].to_i / 1000.0 @ends_at = json['end_ms'].to_i / 1000.0 @link = to_link data.fetch('action', {})['url'], data end |