conred 0.2.7 → 0.2.8
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.
- data/lib/conred/version.rb +1 -1
- data/lib/conred/video.rb +6 -6
- data/spec/conred_spec/video_spec.rb +5 -1
- metadata +1 -1
data/lib/conred/version.rb
CHANGED
data/lib/conred/video.rb
CHANGED
@@ -45,15 +45,15 @@ module Conred
|
|
45
45
|
include Video
|
46
46
|
|
47
47
|
def self.url_format_is_valid? url
|
48
|
-
/^(http:\/\/)*(www\.)*(youtube.com|youtu.be)/ =~ url
|
48
|
+
/^(http|https)*(:\/\/)*(www\.)*(youtube.com|youtu.be)/ =~ url
|
49
49
|
end
|
50
50
|
|
51
51
|
def api_uri
|
52
|
-
"
|
52
|
+
"//gdata.youtube.com/feeds/api/videos/#{@video_id}"
|
53
53
|
end
|
54
54
|
|
55
55
|
def video_link
|
56
|
-
"
|
56
|
+
"//www.youtube.com/embed/#{@video_id}?wmode=transparent"
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
@@ -72,15 +72,15 @@ module Conred
|
|
72
72
|
include Video
|
73
73
|
|
74
74
|
def self.url_format_is_valid? url
|
75
|
-
/^(http:\/\/)*(www\.)*(vimeo.com)/ =~ url
|
75
|
+
/^(http|https)*(:\/\/)*(www\.)*(vimeo.com)/ =~ url
|
76
76
|
end
|
77
77
|
|
78
78
|
def api_uri
|
79
|
-
"
|
79
|
+
"//vimeo.com/api/v2/video/#{@video_id}.json"
|
80
80
|
end
|
81
81
|
|
82
82
|
def video_link
|
83
|
-
"
|
83
|
+
"//player.vimeo.com/video/#{@video_id}"
|
84
84
|
end
|
85
85
|
|
86
86
|
private
|
@@ -4,16 +4,19 @@ describe Conred do
|
|
4
4
|
describe Conred::Video do
|
5
5
|
|
6
6
|
let(:short_youtube_url) {Conred::Video.new(:video_url=>"http://youtu.be/SZt5RFzqEfY")}
|
7
|
+
let(:https_youtube_url) {Conred::Video.new(:video_url=>"https://youtu.be/SZt5RFzqEfY")}
|
7
8
|
let(:short_youtube_url_with_www) {Conred::Video.new(:video_url=>"www.youtu.be/SZt5RFzqEfY")}
|
8
9
|
let(:long_youtube_url_with_features) {Conred::Video.new(:video_url=>"http://www.youtube.com/watch?NR=1&feature=endscreen&v=Lrj5Kxdzouc")}
|
9
10
|
let(:short_youtube_url_without_http_and_www) {Conred::Video.new(:video_url=>"youtu.be/SZt5RFzqEfY")}
|
10
11
|
|
11
12
|
let(:vimeo_url) {Conred::Video.new(:video_url=>"http://vimeo.com/12311233")}
|
13
|
+
let(:https_vimeo_url) {Conred::Video.new(:video_url=>"http://vimeo.com/12311233")}
|
12
14
|
let(:evil_vimeo) {Conred::Video.new(:video_url=>"eeevil vimeo www.vimeo.com/12311233")}
|
13
15
|
let(:vimeo_without_http) {Conred::Video.new(:video_url=>"vimeo.com/12311233")}
|
14
16
|
|
15
17
|
it "should match youtube video" do
|
16
18
|
short_youtube_url.should be_youtube_video
|
19
|
+
https_youtube_url.should be_youtube_video
|
17
20
|
short_youtube_url_with_www.should be_youtube_video
|
18
21
|
long_youtube_url_with_features.should be_youtube_video
|
19
22
|
short_youtube_url_without_http_and_www.should be_youtube_video
|
@@ -27,6 +30,7 @@ describe Conred do
|
|
27
30
|
it "should match vimeo video" do
|
28
31
|
vimeo_url.should_not be_youtube_video
|
29
32
|
vimeo_without_http.should be_vimeo_video
|
33
|
+
https_vimeo_url.should be_vimeo_video
|
30
34
|
vimeo_url.should be_vimeo_video
|
31
35
|
end
|
32
36
|
|
@@ -61,7 +65,7 @@ describe Conred do
|
|
61
65
|
|
62
66
|
it "should make a request to the proper uri" do
|
63
67
|
non_existing_video = Conred::Video.new(:video_url=>"http://www.youtube.com/watch?v=Lrj5Kxdzoux")
|
64
|
-
non_existing_video.api_uri.should eq("
|
68
|
+
non_existing_video.api_uri.should eq("//gdata.youtube.com/feeds/api/videos/Lrj5Kxdzoux")
|
65
69
|
end
|
66
70
|
|
67
71
|
it "should be true if response is 200" do
|