youtube_images 1.0.0 → 1.0.1
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/.travis.yml +8 -0
- data/README.md +3 -1
- data/lib/youtube_images.rb +1 -1
- data/lib/youtube_images/version.rb +1 -1
- data/spec/youtube_images_spec.rb +16 -11
- metadata +5 -4
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Getting Started
|
1
|
+
# Getting Started [](https://travis-ci.org/rahult/youtube_images) [](https://codeclimate.com/github/rahult/youtube_images)
|
2
2
|
|
3
3
|
**YouTube Images** can be used to extract thumbnails/images for a given youtube video ID or URL without a developer ID. It uses a URL constructor instead of an API
|
4
4
|
|
@@ -24,6 +24,8 @@ For example if you want to fetch the default thumbnail for youtube URL you can d
|
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
YouTubeImages::For("http://www.youtube.com/watch?v=5zVaFjSxAZs")[:default]
|
27
|
+
# or
|
28
|
+
YouTubeImages::For("5zVaFjSxAZs")[:default]
|
27
29
|
```
|
28
30
|
|
29
31
|
## Advanced Usage
|
data/lib/youtube_images.rb
CHANGED
data/spec/youtube_images_spec.rb
CHANGED
@@ -2,16 +2,17 @@ require 'minitest/autorun'
|
|
2
2
|
require 'minitest/pride'
|
3
3
|
require "youtube_images"
|
4
4
|
|
5
|
-
|
5
|
+
def image_hash_for(id)
|
6
|
+
@images_hash = {
|
7
|
+
default: "http://img.youtube.com/vi/#{id}/default.jpg",
|
8
|
+
medium: "http://img.youtube.com/vi/#{id}/hqdefault.jpg",
|
9
|
+
high: "http://img.youtube.com/vi/#{id}/mqdefault.jpg",
|
10
|
+
maximum: "http://img.youtube.com/vi/#{id}/maxresdefault.jpg"
|
11
|
+
}
|
12
|
+
end
|
6
13
|
|
7
|
-
|
8
|
-
|
9
|
-
default: "http://img.youtube.com/vi/onghF8NYbPw/default.jpg",
|
10
|
-
medium: "http://img.youtube.com/vi/onghF8NYbPw/hqdefault.jpg",
|
11
|
-
high: "http://img.youtube.com/vi/onghF8NYbPw/mqdefault.jpg",
|
12
|
-
maximum: "http://img.youtube.com/vi/onghF8NYbPw/maxresdefault.jpg"
|
13
|
-
}
|
14
|
-
end
|
14
|
+
|
15
|
+
describe YouTubeImages do
|
15
16
|
|
16
17
|
describe "when asked about images for a invalid youtube video" do
|
17
18
|
|
@@ -28,7 +29,11 @@ describe YouTubeImages do
|
|
28
29
|
describe "when asked about images for a youtube ID" do
|
29
30
|
|
30
31
|
it "must respond with an image" do
|
31
|
-
YouTubeImages::For("onghF8NYbPw").must_equal
|
32
|
+
YouTubeImages::For("onghF8NYbPw").must_equal image_hash_for("onghF8NYbPw")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "must respond with an image" do
|
36
|
+
YouTubeImages::For("wrHU-DSirsw").must_equal image_hash_for("wrHU-DSirsw")
|
32
37
|
end
|
33
38
|
|
34
39
|
end
|
@@ -36,7 +41,7 @@ describe YouTubeImages do
|
|
36
41
|
describe "when asked about images for a youtube URL" do
|
37
42
|
|
38
43
|
it "must respond with an image" do
|
39
|
-
YouTubeImages::For("http://www.youtube.com/watch?v=onghF8NYbPw").must_equal
|
44
|
+
YouTubeImages::For("http://www.youtube.com/watch?v=onghF8NYbPw").must_equal image_hash_for("onghF8NYbPw")
|
40
45
|
end
|
41
46
|
|
42
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youtube_images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- .gitignore
|
55
55
|
- .ruby-gemset
|
56
56
|
- .ruby-version
|
57
|
+
- .travis.yml
|
57
58
|
- Gemfile
|
58
59
|
- LICENSE.txt
|
59
60
|
- README.md
|
@@ -77,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
78
|
version: '0'
|
78
79
|
segments:
|
79
80
|
- 0
|
80
|
-
hash:
|
81
|
+
hash: -1557985715866532097
|
81
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
83
|
none: false
|
83
84
|
requirements:
|
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
87
|
version: '0'
|
87
88
|
segments:
|
88
89
|
- 0
|
89
|
-
hash:
|
90
|
+
hash: -1557985715866532097
|
90
91
|
requirements: []
|
91
92
|
rubyforge_project:
|
92
93
|
rubygems_version: 1.8.25
|