Class: Yt::Annotations::Card
Overview
A Card annotation is different from a Note annotation in the way data is represented in the XML under a new ‘data’ key with JSON-formatted content.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#ends_at, #link, #starts_at, #text
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Card
constructor
A new instance of Card.
Constructor Details
#initialize(data = {}) ⇒ Card
Returns a new instance of Card.
10 11 12 13 14 15 16 |
# File 'lib/yt/annotations/card.rb', line 10 def initialize(data = {}) json = JSON.parse data['data'] @text = text_in json @starts_at = json['start_ms'] / 1000.0 @ends_at = ends_at_in json @link = to_link data, json end |