Sha256: f8d60034c37c57e40a28826b0abb0918e461b7a751752819edec48f3b96788a5

Contents?: true

Size: 607 Bytes

Versions: 12

Compression:

Stored size: 607 Bytes

Contents

require 'yt/annotations/card'

module Yt
  module Annotations
    # A Branding annotation is similar to a card, except that it does not have
    # text, only a channel-linked image displayed in the bottom-right corner.
    class Branding < Card
    private
      def text_in(data)
        ''
      end

      def ends_at_in(data)
        data['end_ms'] / 1000.0
      end

      def to_link(data, json)
        return unless url = data.fetch('action', {})['url']
        new_window = url['target'] != 'current'
        {url: url['value'], new_window: new_window, type: :channel}
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
yt-annotations-2.0.0 lib/yt/annotations/branding.rb
yt-annotations-1.4.2 lib/yt/annotations/branding.rb
yt-annotations-1.4.1 lib/yt/annotations/branding.rb
yt-annotations-1.4.0 lib/yt/annotations/branding.rb
yt-annotations-1.3.2 lib/yt/annotations/branding.rb
yt-annotations-1.3.1 lib/yt/annotations/branding.rb
yt-annotations-1.3.0 lib/yt/annotations/branding.rb
yt-annotations-1.2.3 lib/yt/annotations/branding.rb
yt-annotations-1.2.2 lib/yt/annotations/branding.rb
yt-annotations-1.2.1 lib/yt/annotations/branding.rb
yt-annotations-1.2.0 lib/yt/annotations/branding.rb
yt-annotations-1.1.0 lib/yt/annotations/branding.rb