Class: Video::Blip

Inherits:
Video
  • Object
show all
Defined in:
lib/videoclip/videos/blip.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(uri) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/videoclip/videos/blip.rb', line 4

def self.match?(uri)
  (uri.host =~ /^(?:www\.)?blip\.tv$/i) && (uri.path =~ /^\/file\/\d+/)
end

Instance Method Details

#assign(uri) ⇒ Object



8
9
10
11
12
# File 'lib/videoclip/videos/blip.rb', line 8

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

#embed(style = nil) ⇒ Object



14
15
16
# File 'lib/videoclip/videos/blip.rb', line 14

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