refinerycms-vimeo-videos 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ module Admin
|
|
4
4
|
include ::RefinerycmsVimeoVideos::Account
|
5
5
|
|
6
6
|
def authorization
|
7
|
-
|
7
|
+
|
8
8
|
if not authorized? and ready_to_authorize?
|
9
9
|
|
10
10
|
# begin authorization process
|
@@ -14,7 +14,6 @@ module Admin
|
|
14
14
|
request_token = base.get_request_token
|
15
15
|
session[:oauth_secret] = request_token.secret
|
16
16
|
|
17
|
-
debugger
|
18
17
|
redirect_to base.authorize_url
|
19
18
|
|
20
19
|
elsif ready_to_authorize?
|
@@ -32,7 +31,7 @@ module Admin
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def callback
|
35
|
-
|
34
|
+
|
36
35
|
# vimeo will redirect us here upon successful authorization
|
37
36
|
base = Vimeo::Advanced::Base.new(
|
38
37
|
account[:consumer_key],
|
@@ -20,7 +20,7 @@ class VimeoMetaCache < ActiveRecord::Base
|
|
20
20
|
"http://www.vimeo.com/#{self.vid}"
|
21
21
|
end
|
22
22
|
|
23
|
-
def update_cache
|
23
|
+
def update_cache images = false
|
24
24
|
cache true, images
|
25
25
|
self.save
|
26
26
|
end
|
@@ -28,7 +28,7 @@ class VimeoMetaCache < ActiveRecord::Base
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def cache force = false, images = false
|
31
|
-
if self.title
|
31
|
+
if !self.title? or !self.image_id? or !self.description? or force
|
32
32
|
|
33
33
|
video = Vimeo::Advanced::Video.new(
|
34
34
|
account[:consumer_key],
|
@@ -41,17 +41,17 @@ class VimeoMetaCache < ActiveRecord::Base
|
|
41
41
|
# If we force an update, we need to specifically force images as well by
|
42
42
|
# calling this method with force and images true.
|
43
43
|
|
44
|
-
if
|
44
|
+
if images or !image_id?
|
45
45
|
# Save fetched image url
|
46
46
|
vimeo_thumb_url = video_info["thumbnails"]["thumbnail"].last["_content"]
|
47
47
|
self.create_image(:image => URLTempfile.new(vimeo_thumb_url))
|
48
48
|
end
|
49
49
|
|
50
50
|
# Save fetched title
|
51
|
-
self.title = video_info["title"] if self.title
|
51
|
+
self.title = video_info["title"] if !self.title? or force
|
52
52
|
|
53
53
|
# Save fetched description
|
54
|
-
self.description = video_info[
|
54
|
+
self.description = "<p>#{video_info['description']}</p>" if !self.description? or force
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -4,7 +4,7 @@ require "refinerycms_vimeo_videos/version"
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{refinerycms-vimeo-videos}
|
7
|
-
s.version = %q{0.1.
|
7
|
+
s.version = %q{0.1.6}
|
8
8
|
s.description = 'Ruby on Rails Vimeo Videos engine for Refinery CMS'
|
9
9
|
s.date = %q{2011-04-25}
|
10
10
|
s.summary = 'Vimeo Videos engine for Refinery CMS'
|