conred 0.2.8 → 0.3.0
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/Gemfile +3 -1
- data/README.md +0 -3
- data/conred.gemspec +1 -3
- data/lib/conred/version.rb +1 -1
- data/lib/conred/video.rb +6 -6
- data/spec/conred_spec/video_spec.rb +1 -5
- metadata +3 -35
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
[](https://codeclimate.com/github/janjiss/conred)
|
2
|
-
[](https://travis-ci.org/janjiss/conred)
|
3
|
-
|
4
1
|
# Conred
|
5
2
|
|
6
3
|
In every project we have common things like video
|
data/conred.gemspec
CHANGED
@@ -8,10 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = %q{ConcepticHQ reusable code}
|
9
9
|
gem.homepage = "http://github.com/janjiss/conred"
|
10
10
|
|
11
|
-
gem.add_dependency "haml"
|
12
11
|
gem.add_development_dependency "rspec"
|
13
|
-
gem.
|
14
|
-
gem.add_development_dependency "actionpack"
|
12
|
+
gem.add_dependency "actionpack"
|
15
13
|
|
16
14
|
gem.files = `git ls-files`.split($\)
|
17
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
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
|
48
|
+
/^(http:\/\/)*(www\.)*(youtube.com|youtu.be)/ =~ url
|
49
49
|
end
|
50
50
|
|
51
51
|
def api_uri
|
52
|
-
"
|
52
|
+
"http://gdata.youtube.com/feeds/api/videos/#{@video_id}"
|
53
53
|
end
|
54
54
|
|
55
55
|
def video_link
|
56
|
-
"
|
56
|
+
"http://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
|
75
|
+
/^(http:\/\/)*(www\.)*(vimeo.com)/ =~ url
|
76
76
|
end
|
77
77
|
|
78
78
|
def api_uri
|
79
|
-
"
|
79
|
+
"http://vimeo.com/api/v2/video/#{@video_id}.json"
|
80
80
|
end
|
81
81
|
|
82
82
|
def video_link
|
83
|
-
"
|
83
|
+
"http://player.vimeo.com/video/#{@video_id}"
|
84
84
|
end
|
85
85
|
|
86
86
|
private
|
@@ -4,19 +4,16 @@ 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")}
|
8
7
|
let(:short_youtube_url_with_www) {Conred::Video.new(:video_url=>"www.youtu.be/SZt5RFzqEfY")}
|
9
8
|
let(:long_youtube_url_with_features) {Conred::Video.new(:video_url=>"http://www.youtube.com/watch?NR=1&feature=endscreen&v=Lrj5Kxdzouc")}
|
10
9
|
let(:short_youtube_url_without_http_and_www) {Conred::Video.new(:video_url=>"youtu.be/SZt5RFzqEfY")}
|
11
10
|
|
12
11
|
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")}
|
14
12
|
let(:evil_vimeo) {Conred::Video.new(:video_url=>"eeevil vimeo www.vimeo.com/12311233")}
|
15
13
|
let(:vimeo_without_http) {Conred::Video.new(:video_url=>"vimeo.com/12311233")}
|
16
14
|
|
17
15
|
it "should match youtube video" do
|
18
16
|
short_youtube_url.should be_youtube_video
|
19
|
-
https_youtube_url.should be_youtube_video
|
20
17
|
short_youtube_url_with_www.should be_youtube_video
|
21
18
|
long_youtube_url_with_features.should be_youtube_video
|
22
19
|
short_youtube_url_without_http_and_www.should be_youtube_video
|
@@ -30,7 +27,6 @@ describe Conred do
|
|
30
27
|
it "should match vimeo video" do
|
31
28
|
vimeo_url.should_not be_youtube_video
|
32
29
|
vimeo_without_http.should be_vimeo_video
|
33
|
-
https_vimeo_url.should be_vimeo_video
|
34
30
|
vimeo_url.should be_vimeo_video
|
35
31
|
end
|
36
32
|
|
@@ -65,7 +61,7 @@ describe Conred do
|
|
65
61
|
|
66
62
|
it "should make a request to the proper uri" do
|
67
63
|
non_existing_video = Conred::Video.new(:video_url=>"http://www.youtube.com/watch?v=Lrj5Kxdzoux")
|
68
|
-
non_existing_video.api_uri.should eq("
|
64
|
+
non_existing_video.api_uri.should eq("http://gdata.youtube.com/feeds/api/videos/Lrj5Kxdzoux")
|
69
65
|
end
|
70
66
|
|
71
67
|
it "should be true if response is 200" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conred
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: haml
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: rspec
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,22 +27,6 @@ dependencies:
|
|
43
27
|
- - ! '>='
|
44
28
|
- !ruby/object:Gem::Version
|
45
29
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rake
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
30
|
- !ruby/object:Gem::Dependency
|
63
31
|
name: actionpack
|
64
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +35,7 @@ dependencies:
|
|
67
35
|
- - ! '>='
|
68
36
|
- !ruby/object:Gem::Version
|
69
37
|
version: '0'
|
70
|
-
type: :
|
38
|
+
type: :runtime
|
71
39
|
prerelease: false
|
72
40
|
version_requirements: !ruby/object:Gem::Requirement
|
73
41
|
none: false
|