Sha256: 7947352ee564da5ebd10810c67d35ad2a902456cb48c3a3eda9909017d7c1a6a

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

class VideoInfo
  module Providers
    class Wistia < Provider
      def self.usable?(url)
        url =~ /(.*)(wistia.com|wistia.net|wi.st)/
      end

      def provider
        'Wistia'
      end

      %w[title duration width height].each do |method|
        define_method(method) { data[method] }
      end

      %w[description keywords view_count date].each do |method|
        define_method(method) { nil }
      end

      def embed_url
        "//fast.wistia.net/embed/iframe/#{video_id}"
      end

      def thumbnail_small
        data['thumbnail_url']
      end

      def thumbnail_medium
        data['thumbnail_url']
      end

      def thumbnail_large
        data['thumbnail_url']
      end

      private

      def _url_regex
        /(?:.*)(?:wistia.com|wi.st|wistia.net)\/(?:embed\/)?(?:medias\/)?(?:iframe\/)?(.+)/
      end

      def _api_base
        'fast.wistia.com'
      end

      def _api_path
        "/oembed?url=http%3A%2F%2Fhome.wistia.com%2Fmedias%2F#{video_id}"
      end

      def _api_url
        "http://#{_api_base}#{_api_path}"
      end

      def _default_iframe_attributes
        {}
      end

      def _default_url_attributes
        {}
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
video_info-2.6.0 lib/video_info/providers/wistia.rb
video_info-2.5.0 lib/video_info/providers/wistia.rb
video_info-2.4.2 lib/video_info/providers/wistia.rb
video_info-2.4.1 lib/video_info/providers/wistia.rb
video_info-2.4.0 lib/video_info/providers/wistia.rb