imdb 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/MIT-LICENSE +21 -0
- data/README.md +97 -0
- data/imdb.gemspec +1 -1
- data/lib/imdb.rb +1 -1
- data/lib/imdb/base.rb +36 -36
- data/lib/imdb/episode.rb +2 -2
- data/lib/imdb/movie_list.rb +6 -10
- data/lib/imdb/search.rb +4 -4
- data/lib/imdb/season.rb +3 -3
- data/lib/imdb/serie.rb +2 -3
- data/lib/imdb/top_250.rb +1 -1
- data/lib/imdb/version.rb +1 -1
- data/spec/fixtures/locations +1167 -0
- data/spec/fixtures/plotsummary +1063 -897
- data/spec/fixtures/search_kannethirey_thondrinal +344 -346
- data/spec/fixtures/search_killed_wife +344 -346
- data/spec/fixtures/search_star_trek +344 -346
- data/spec/fixtures/synopsis +457 -446
- data/spec/fixtures/thewalkingdead-s1 +740 -555
- data/spec/fixtures/thewalkingdead-s1e2 +505 -480
- data/spec/fixtures/top_250 +10749 -1082
- data/spec/fixtures/tt0036855 +553 -519
- data/spec/fixtures/tt0083987 +563 -512
- data/spec/fixtures/tt0095016 +518 -536
- data/spec/fixtures/tt0110912 +572 -512
- data/spec/fixtures/tt0111161 +559 -508
- data/spec/fixtures/tt0117731 +542 -510
- data/spec/fixtures/tt0166222 +969 -872
- data/spec/fixtures/tt0242653 +530 -524
- data/spec/fixtures/tt0330508 +845 -717
- data/spec/fixtures/tt0468569 +533 -543
- data/spec/fixtures/tt1401252 +472 -449
- data/spec/fixtures/tt1520211 +562 -542
- data/spec/imdb/movie_spec.rb +13 -5
- data/spec/imdb/search_spec.rb +4 -4
- data/spec/imdb/series_spec.rb +1 -1
- data/spec/imdb/top_250_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -0
- metadata +12 -9
- data/README.rdoc +0 -114
data/spec/imdb/movie_spec.rb
CHANGED
@@ -33,7 +33,7 @@ describe "Imdb::Movie" do
|
|
33
33
|
char.should include("Hostage")
|
34
34
|
end
|
35
35
|
|
36
|
-
it "should associates the cast members to the
|
36
|
+
it "should associates the cast members to the characters" do
|
37
37
|
cast = @movie.cast_members
|
38
38
|
char = @movie.cast_characters
|
39
39
|
cast_char = @movie.cast_members_characters
|
@@ -51,11 +51,11 @@ describe "Imdb::Movie" do
|
|
51
51
|
|
52
52
|
describe 'fetching a list of imdb actor ids for the cast members' do
|
53
53
|
it 'should not require arguments' do
|
54
|
-
|
54
|
+
expect { @movie.cast_member_ids }.not_to raise_error
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should not allow arguments' do
|
58
|
-
|
58
|
+
expect { @movie.cast_member_ids(:foo) }.to raise_error(ArgumentError)
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should return the imdb actor number for each cast member' do
|
@@ -142,7 +142,7 @@ describe "Imdb::Movie" do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
it "should find number of votes" do
|
145
|
-
@movie.votes.should be_within(10000).of(
|
145
|
+
@movie.votes.should be_within(10000).of(397054)
|
146
146
|
end
|
147
147
|
|
148
148
|
it "should find the title" do
|
@@ -170,6 +170,14 @@ describe "Imdb::Movie" do
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
+
it "should find multiple filming locations" do
|
174
|
+
filming_locations = @movie.filming_locations
|
175
|
+
filming_locations.should be_an(Array)
|
176
|
+
filming_locations.size.should eql(4)
|
177
|
+
filming_locations[0].should match(/.*, USA$/i)
|
178
|
+
|
179
|
+
end
|
180
|
+
|
173
181
|
it "should provide a convenience method to search" do
|
174
182
|
movies = Imdb::Movie.search("Star Trek: TOS")
|
175
183
|
movies.should respond_to(:each)
|
@@ -186,7 +194,7 @@ describe "Imdb::Movie" do
|
|
186
194
|
describe "plot" do
|
187
195
|
it "should find a correct plot when HTML links are present" do
|
188
196
|
movie = Imdb::Movie.new("0083987")
|
189
|
-
movie.plot.should eql("Biography of Mohandas K. Gandhi, the lawyer who became the famed leader of the Indian revolts against the British rule through his philosophy of
|
197
|
+
movie.plot.should eql("Biography of Mohandas K. Gandhi, the lawyer who became the famed leader of the Indian revolts against the British rule through his philosophy of nonviolent protest.")
|
190
198
|
end
|
191
199
|
|
192
200
|
it "should not have a 'more' link in the plot" do
|
data/spec/imdb/search_spec.rb
CHANGED
@@ -10,8 +10,8 @@ describe "Imdb::Search with multiple search results" do
|
|
10
10
|
@search.query.should == "Star Trek: TOS"
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should find
|
14
|
-
@search.movies.size.should eql(
|
13
|
+
it "should find 4 results" do
|
14
|
+
@search.movies.size.should eql(4)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should return Imdb::Movie objects only" do
|
@@ -30,9 +30,9 @@ end
|
|
30
30
|
describe "Imdb::Search with an exact match and no poster" do
|
31
31
|
|
32
32
|
it "should not raise an exception" do
|
33
|
-
|
33
|
+
expect {
|
34
34
|
@search = Imdb::Search.new("Kannethirey Thondrinal").movies
|
35
|
-
}.
|
35
|
+
}.not_to raise_error
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should return the movie id correctly" do
|
data/spec/imdb/series_spec.rb
CHANGED
data/spec/imdb/top_250_spec.rb
CHANGED
@@ -4,18 +4,18 @@ describe Imdb::Top250 do
|
|
4
4
|
before(:each) do
|
5
5
|
@movies = Imdb::Top250.new.movies
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
it "should be a list of movies" do
|
9
9
|
@movies.each { |movie| movie.should be_an_instance_of(Imdb::Movie) }
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should return the top 250 movies from IMDB.com" do
|
13
13
|
@movies.size.should == 250
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should provide array like access to the movies" do
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
17
|
+
@movies[0].title.should == "1. The Shawshank Redemption"
|
18
|
+
@movies[1].title.should == "2. The Godfather"
|
19
|
+
@movies[2].title.should == "3. The Godfather: Part II"
|
20
20
|
end
|
21
21
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -26,6 +26,7 @@ IMDB_SAMPLES = {
|
|
26
26
|
"http://akas.imdb.com:80/title/tt0095016/combined" => "tt0095016",
|
27
27
|
"http://akas.imdb.com/title/tt0095016/synopsis" => "synopsis",
|
28
28
|
"http://akas.imdb.com/title/tt0095016/plotsummary" => "plotsummary",
|
29
|
+
"http://akas.imdb.com/title/tt0095016/locations" => "locations",
|
29
30
|
"http://akas.imdb.com:80/title/tt0242653/combined" => "tt0242653",
|
30
31
|
"http://akas.imdb.com/title/tt0166222/?fr=c2M9MXxsbT01MDB8ZmI9dXx0dD0xfG14PTIwfGh0bWw9MXxjaD0xfGNvPTF8cG49MHxmdD0xfGt3PTF8cXM9SSBraWxsZWQgbXkgbGVzYmlhbiB3aWZlfHNpdGU9YWthfHE9SSBraWxsZWQgbXkgbGVzYmlhbiB3aWZlfG5tPTE_;fc=1;ft=7" => "tt0166222",
|
31
32
|
"http://akas.imdb.com:80/chart/top" => "top_250",
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariejan de Vroom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,8 +107,9 @@ files:
|
|
107
107
|
- .travis.yml
|
108
108
|
- Gemfile
|
109
109
|
- History.txt
|
110
|
+
- MIT-LICENSE
|
110
111
|
- Manifest.txt
|
111
|
-
- README.
|
112
|
+
- README.md
|
112
113
|
- Rakefile
|
113
114
|
- bin/imdb
|
114
115
|
- config/website.yml
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- script/console
|
129
130
|
- script/destroy
|
130
131
|
- script/generate
|
132
|
+
- spec/fixtures/locations
|
131
133
|
- spec/fixtures/plotsummary
|
132
134
|
- spec/fixtures/search_kannethirey_thondrinal
|
133
135
|
- spec/fixtures/search_killed_wife
|
@@ -177,11 +179,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
179
|
version: '0'
|
178
180
|
requirements: []
|
179
181
|
rubyforge_project: imdb
|
180
|
-
rubygems_version: 2.0.
|
182
|
+
rubygems_version: 2.0.3
|
181
183
|
signing_key:
|
182
184
|
specification_version: 4
|
183
185
|
summary: Easily access the publicly available information on IMDB.
|
184
186
|
test_files:
|
187
|
+
- spec/fixtures/locations
|
185
188
|
- spec/fixtures/plotsummary
|
186
189
|
- spec/fixtures/search_kannethirey_thondrinal
|
187
190
|
- spec/fixtures/search_killed_wife
|
data/README.rdoc
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
= imdb
|
2
|
-
|
3
|
-
{<img src="https://travis-ci.org/ariejan/imdb.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ariejan/imdb]
|
4
|
-
|
5
|
-
home :: http://github.com/ariejan/imdb
|
6
|
-
rdoc :: http://ariejan.github.com/imdb/
|
7
|
-
bugs :: http://github.com/ariejan/imdb/issues
|
8
|
-
|
9
|
-
== Description
|
10
|
-
|
11
|
-
This gem allows you to easy access publicly available data from IMDB.
|
12
|
-
|
13
|
-
== Features
|
14
|
-
|
15
|
-
IMDB currently features the following:
|
16
|
-
|
17
|
-
* Querying details movie info
|
18
|
-
* Searching for movies
|
19
|
-
* Command-line utility included.
|
20
|
-
|
21
|
-
== Synopsis
|
22
|
-
|
23
|
-
Movies:
|
24
|
-
|
25
|
-
i = Imdb::Movie.new("0095016")
|
26
|
-
|
27
|
-
i.title
|
28
|
-
#=> "Die Hard"
|
29
|
-
i.cast_members.first
|
30
|
-
#=> "Bruce Willis"
|
31
|
-
|
32
|
-
Series:
|
33
|
-
|
34
|
-
serie = Imdb::Serie.new("1520211")
|
35
|
-
|
36
|
-
serie.title
|
37
|
-
#=> "\"The Walking Dead\""
|
38
|
-
|
39
|
-
serie.rating
|
40
|
-
#=> 8.8
|
41
|
-
|
42
|
-
serie.seasons.size
|
43
|
-
#=> 3
|
44
|
-
|
45
|
-
serie.seaon(1).episodes.size
|
46
|
-
#=> 6
|
47
|
-
|
48
|
-
series.season(1).episode(2).title
|
49
|
-
#=> "Guts"
|
50
|
-
|
51
|
-
Searching:
|
52
|
-
|
53
|
-
i = Imdb::Search.new("Star Trek")
|
54
|
-
|
55
|
-
i.movies.size
|
56
|
-
#=> 97
|
57
|
-
|
58
|
-
Using the command line utility is quite easy:
|
59
|
-
|
60
|
-
$ imdb Star Trek
|
61
|
-
|
62
|
-
or to get movie info
|
63
|
-
|
64
|
-
$ imdb 0095016
|
65
|
-
|
66
|
-
== Installation
|
67
|
-
|
68
|
-
$ gem install imdb
|
69
|
-
|
70
|
-
== Documentation
|
71
|
-
|
72
|
-
This README and generated RDoc documentation are available from http://ariejan.github.com/imdb/
|
73
|
-
|
74
|
-
== Running tests
|
75
|
-
|
76
|
-
You'll need rspec and fakeweb installed to run the specs.
|
77
|
-
|
78
|
-
$ bundle install
|
79
|
-
$ bundle exec rake spec
|
80
|
-
|
81
|
-
Although not recommended, you may run the specs against the live imdb.com
|
82
|
-
website. This will make a lot of calls to imdb.com, use it wisely.
|
83
|
-
|
84
|
-
$ LIVE_TEST=true bundle exec rake spec
|
85
|
-
|
86
|
-
To update the packaged fixtures files with actual imdb.com samples, use the
|
87
|
-
fixtures:refresh rake task
|
88
|
-
|
89
|
-
$ bundle exec rake fixtures:refresh
|
90
|
-
|
91
|
-
== License
|
92
|
-
|
93
|
-
(The MIT License)
|
94
|
-
|
95
|
-
Copyright (c) 2009 Ariejan de Vroom
|
96
|
-
|
97
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
98
|
-
a copy of this software and associated documentation files (the
|
99
|
-
'Software'), to deal in the Software without restriction, including
|
100
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
101
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
102
|
-
permit persons to whom the Software is furnished to do so, subject to
|
103
|
-
the following conditions:
|
104
|
-
|
105
|
-
The above copyright notice and this permission notice shall be
|
106
|
-
included in all copies or substantial portions of the Software.
|
107
|
-
|
108
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
109
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
110
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
111
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
112
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
113
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
114
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|