Class: Vimeo
Instance Method Summary collapse
- #blank_error(obj) ⇒ Object
- #embed_html ⇒ Object
-
#initialize(obj) ⇒ Vimeo
constructor
A new instance of Vimeo.
- #thumbnail_url ⇒ Object
Constructor Details
#initialize(obj) ⇒ Vimeo
Returns a new instance of Vimeo.
9 10 11 12 13 14 |
# File 'lib/vimeo.rb', line 9 def initialize(obj) @clip_id = obj.video_url.split('/').last @response = self.class.get('/api/oembed.json', :query => {:url => "http://vimeo.com/#{@clip_id}"}) raise blank_error(obj) if @response.blank? end |
Instance Method Details
#blank_error(obj) ⇒ Object
16 17 18 |
# File 'lib/vimeo.rb', line 16 def blank_error(obj) raise VimeoError, "Vimeo returned a blank response for this video: #{obj.video_url}" end |
#embed_html ⇒ Object
24 25 26 |
# File 'lib/vimeo.rb', line 24 def @response["html"] end |
#thumbnail_url ⇒ Object
20 21 22 |
# File 'lib/vimeo.rb', line 20 def thumbnail_url @response["thumbnail_url"] end |