mdarby-acts_as_video_fu 1.1 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,17 +3,17 @@ module Mdarby
3
3
  module Acts_as_video_fu_helper
4
4
 
5
5
  def display_video(obj)
6
- klass(obj).embed_html
6
+ video_klass(obj).embed_html
7
7
  end
8
8
 
9
9
  def thumbnail_url(obj)
10
- klass(obj).thumbnail_url
10
+ video_klass(obj).thumbnail_url
11
11
  end
12
12
 
13
13
 
14
14
  private
15
15
 
16
- def klass(obj)
16
+ def video_klass(obj)
17
17
  obj.type.new(obj)
18
18
  end
19
19
 
data/lib/vimeo.rb CHANGED
@@ -1,3 +1,5 @@
1
+ class VimeoError < StandardError; end
2
+
1
3
  class Vimeo
2
4
  include HTTParty
3
5
  format :json
@@ -7,6 +9,12 @@ class Vimeo
7
9
  def initialize(obj)
8
10
  @clip_id = obj.video_url.split('/').last
9
11
  @response = self.class.get('/api/oembed.json', :query => {:url => "http://vimeo.com/#{@clip_id}"})
12
+
13
+ raise blank_error(obj) if @response.blank?
14
+ end
15
+
16
+ def blank_error(obj)
17
+ raise VimeoError, "Vimeo returned a blank response for this video: #{obj.video_url}"
10
18
  end
11
19
 
12
20
  def thumbnail_url
@@ -17,4 +25,4 @@ class Vimeo
17
25
  @response["html"]
18
26
  end
19
27
 
20
- end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdarby-acts_as_video_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.1"
4
+ version: "1.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
@@ -9,17 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-14 00:00:00 -08:00
12
+ date: 2009-03-06 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 0.2.2
23
+ version: 0.3.1
23
24
  version:
24
25
  description: Rails plugin that easily allows you to show video streams on your site.
25
26
  email: matt@matt-darby.com