Sha256: 27ffa6a645ce18e2c8b5f8ba345c0775264a005fb6502dd7ed0c98c1685df866
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
module LaserLemon module Videoclip class Video::Blip < Video def self.match?(uri) (uri.host =~ /^(?:www\.)?blip\.tv$/i) && (uri.path =~ /^\/file\/\d+$/) end def assign(uri) @url = "http://blip.tv#{uri.path}" response = Net::HTTP.get(URI.parse(@url + '?skin=api')) @key = parse_response(response, %w(response payload asset embedLookup)) end def embed(style = nil) %(<embed src="http://blip.tv/play/#{@key}" type="application/x-shockwave-flash" width="#{width(style)}" height="#{height(style)}" allowscriptaccess="always" allowfullscreen="true"></embed>) end protected def chrome_height 30 end def parse_response(response, path, default = nil) begin path.collect!(&:to_s) destination = path.pop path.inject(Hash.from_xml(response)){|h,p| h.fetch(p, {}) }.fetch(destination, default) rescue default end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
videoclip-0.2.6 | lib/videoclip/videos/blip.rb |
videoclip-0.2.5 | lib/videoclip/videos/blip.rb |
videoclip-0.2.4 | lib/videoclip/videos/blip.rb |