mdarby-acts_as_video_fu 1.2 → 1.3

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.
Files changed (3) hide show
  1. data/lib/acts_as_video_fu.rb +14 -14
  2. data/lib/you_tube.rb +1 -1
  3. metadata +2 -2
@@ -2,18 +2,18 @@ module Mdarby
2
2
  module Acts #:nodoc:
3
3
  module Acts_as_video_fu #:nodoc:
4
4
 
5
- VIMEO_RE = /^http:\/\/(www\.vimeo|vimeo)\.com\/[0-9]*$/
6
- YOUTUBE_RE = /^http:\/\/(www\.youtube|youtube)\.com\/watch\?v=[^&]*$/
5
+ VIMEO_RE = /^http:\/\/(www\.vimeo|vimeo)\.com\/[0-9]*$/
6
+ YOUTUBE_RE = /^http:\/\/(www\.youtube|youtube)\.com\/watch\?v=[^&]*(&.*){0,}$/
7
7
 
8
8
  def self.included(base)
9
9
  base.extend ClassMethods
10
10
  end
11
11
 
12
- module ClassMethods
13
- def acts_as_video_fu
12
+ module ClassMethods
13
+ def acts_as_video_fu
14
14
  include Mdarby::Acts::Acts_as_video_fu::InstanceMethods
15
- extend Mdarby::Acts::Acts_as_video_fu::SingletonMethods
16
-
15
+ extend Mdarby::Acts::Acts_as_video_fu::SingletonMethods
16
+
17
17
  before_save :validate
18
18
  end
19
19
  end
@@ -22,33 +22,33 @@ module Mdarby
22
22
  end
23
23
 
24
24
  module InstanceMethods
25
-
25
+
26
26
  def type
27
27
  return YouTube if youtube?
28
28
  return Vimeo if vimeo?
29
29
  return false
30
30
  end
31
-
31
+
32
32
  def youtube?
33
33
  YOUTUBE_RE =~ video_url
34
34
  end
35
-
35
+
36
36
  def vimeo?
37
37
  VIMEO_RE =~ video_url
38
38
  end
39
-
40
-
39
+
40
+
41
41
  private
42
-
42
+
43
43
  def validate
44
44
  raise "#{self.class.to_s}#video_url doesn't exist!" unless respond_to?(:video_url)
45
-
45
+
46
46
  unless video_url.blank?
47
47
  errors.add_to_base("Video URL has whitespace") if video_url.strip!
48
48
  errors.add_to_base("Video URL is not recognized") unless type
49
49
  end
50
50
  end
51
-
51
+
52
52
  end
53
53
  end
54
54
  end
data/lib/you_tube.rb CHANGED
@@ -11,7 +11,7 @@ class YouTube
11
11
  end
12
12
 
13
13
  def thumbnail_url
14
- @response["entry"]["group"]["thumbnail"][0]["url"]
14
+ @response["entry"]["media:group"]["media:thumbnail"][0]["url"]
15
15
  end
16
16
 
17
17
  def embed_html
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.2"
4
+ version: "1.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-06 00:00:00 -08:00
12
+ date: 2009-03-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency