Class: Vimeo

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/vimeo.rb

Instance Method Summary collapse

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

Raises:



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_htmlObject



24
25
26
# File 'lib/vimeo.rb', line 24

def embed_html
  @response["html"]
end

#thumbnail_urlObject



20
21
22
# File 'lib/vimeo.rb', line 20

def thumbnail_url
  @response["thumbnail_url"]
end