Sha256: d75b2c7d076079b83e77d71239af00cdd7913d57595e22fcf856c8c1270a886f

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 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
        %r{(?:.*)(?:wistia.com|wi.st|wistia.net)
           \/(?:embed\/)?(?:medias\/)?(?:iframe\/)?(.+)}x
      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

8 entries across 8 versions & 1 rubygems

Version Path
video_info-3.1.0 lib/video_info/providers/wistia.rb
video_info-3.0.2 lib/video_info/providers/wistia.rb
video_info-3.0.1 lib/video_info/providers/wistia.rb
video_info-3.0.0 lib/video_info/providers/wistia.rb
video_info-2.8.0 lib/video_info/providers/wistia.rb
video_info-2.7.1 lib/video_info/providers/wistia.rb
video_info-2.7 lib/video_info/providers/wistia.rb
video_info-2.6.1 lib/video_info/providers/wistia.rb