Class: Thumbnailer::Vimeo

Inherits:
Base
  • Object
show all
Defined in:
lib/thumbnailer/sites/vimeo.rb

Instance Attribute Summary

Attributes inherited from Base

#embed_url, #small_thumb_image, #thumb_image

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Vimeo

Returns a new instance of Vimeo.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/thumbnailer/sites/vimeo.rb', line 3

def initialize(uri)
  video_id = uri.path.split('/')[1]
  doc = XML::Parser.string(open("http://vimeo.com/api/v2/video/#{video_id}.xml").read).parse.find("//videos/video/*")
  doc.each {
    |item|
    case item.name
      when "id"
        @embed_url = "http://vimeo.com/moogaloop.swf?clip_id=#{item.content}"
      when "thumbnail_small"
        @small_thumb_image = item.content
      when "thumbnail_medium"
        @thumb_image = item.content
    end
  }
end