Sha256: 7acfa0fe8a7f1b9d8426c17029e3473dd4a23424983677474f4632ad5edd0c60

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

require 'yt'
require 'yt/annotations'

module Yt
  module Audit
    # Audit any info card of a video
    # @param [String] video_id the video to audit.
    # @return true if the video has any info card.
    # @raise [NoMethodError] if video_id is not a valid video.
    def self.has_info_cards?(video_id)
      Yt::Annotations.for(video_id).any? do |annotation|
        annotation.is_a? Yt::Annotations::Card
      end
    end

    # Audit brand anchoring of a video
    # @param [String] video_id the video to audit.
    # @param [String] brand name of the video to audit.
    # @return true if the video title includes brand name.
    # @raise [Yt::Errors::NoItems] if video_id is not a valid video.
    def self.has_brand_anchoring?(video_id, brand)
      video_title = Yt::Video.new(id: video_id).title
      video_title.upcase.include? brand.upcase
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yt-audit-0.1.1 lib/yt/audit.rb