# encoding: UTF-8 require 'open-uri' require 'rack' module Spontaneous::Field class WebVideo class Vine < Provider def self.match(field, url) case url when /vine\.co\/v\/([^\/&]+)/ video_id = $1 new(field, :video_id => video_id, :provider => id).metadata else nil end end def metadata @attributes.update(download_metadata) end def download_metadata {} end def to_html(options = {}) params = player_attributes(options) attributes = hash_to_attributes(params[:attr]) %() end def as_json(options = {}) player_attributes(options) end def player_attributes(options = {}) o = player_options(options) dim = o.delete(:width) attributes = { :type => "text/html", :frameborder => "0", :width => dim, :height => dim } attributes.update(:webkitAllowFullScreen => "yes", :allowFullScreen => "yes") if o[:fullscreen] attributes[:src] = src_with_options(o) {:tagname => "iframe", :tag => "