themoviedb-jzg 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/themoviedb-jzg.rb +12 -0
- data/lib/themoviedb-jzg/api.rb +38 -0
- data/lib/themoviedb-jzg/collection.rb +25 -0
- data/lib/themoviedb-jzg/company.rb +27 -0
- data/lib/themoviedb-jzg/configuration.rb +50 -0
- data/lib/themoviedb-jzg/episode.rb +37 -0
- data/lib/themoviedb-jzg/find.rb +31 -0
- data/lib/themoviedb-jzg/genre.rb +63 -0
- data/lib/themoviedb-jzg/job.rb +26 -0
- data/lib/themoviedb-jzg/movie.rb +161 -0
- data/lib/themoviedb-jzg/person.rb +86 -0
- data/lib/themoviedb-jzg/resource.rb +58 -0
- data/lib/themoviedb-jzg/search.rb +79 -0
- data/lib/themoviedb-jzg/season.rb +37 -0
- data/lib/themoviedb-jzg/tv.rb +82 -0
- data/lib/themoviedb-jzg/version.rb +3 -0
- data/spec/company_spec.rb +97 -0
- data/spec/find_spec.rb +31 -0
- data/spec/movie_spec.rb +316 -0
- data/spec/person_spec.rb +145 -0
- data/spec/tv_spec.rb +458 -0
- data/themoviedb-jzg.gemspec +52 -0
- metadata +154 -0
data/spec/find_spec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
describe Tmdb::Find do
|
6
|
+
|
7
|
+
describe "For a search" do
|
8
|
+
before(:each) do
|
9
|
+
@find = Tmdb::Find
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return results for imdb_id" do
|
13
|
+
VCR.use_cassette 'find/search_imdb' do
|
14
|
+
find = @find.imdb_id("tt1375666")
|
15
|
+
find.movie_results.should be_true
|
16
|
+
find.person_results.should be_true
|
17
|
+
find.tv_results.should be_true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return results for tvdb_id" do
|
22
|
+
VCR.use_cassette 'find/search_tvdb' do
|
23
|
+
find = @find.tvdb_id("81189")
|
24
|
+
find.tv_results.first.name.should == 'Breaking Bad'
|
25
|
+
find.tv_results.should be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/movie_spec.rb
ADDED
@@ -0,0 +1,316 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'rspec'
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
describe Tmdb::Movie do
|
7
|
+
|
8
|
+
@fields = [:id,:adult,:backdrop_path,:belongs_to_collection,
|
9
|
+
:budget,:genres,:homepage,:imdb_id,:original_title,
|
10
|
+
:overview,:popularity,:poster_path,:production_companies,
|
11
|
+
:production_countries,:release_date,:revenue,:runtime,
|
12
|
+
:spoken_languages,:status,:tagline,:title,:vote_average,
|
13
|
+
:vote_count,:alternative_titles,:credits,:images,:keywords,
|
14
|
+
:releases,:trailers,:translations,:reviews,:lists]
|
15
|
+
|
16
|
+
@fields.each do |field|
|
17
|
+
it { should respond_to field }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "For a movie" do
|
21
|
+
before(:each) do
|
22
|
+
@movie = Tmdb::Movie
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return the latest movies" do
|
26
|
+
VCR.use_cassette 'movie/return_latest_movie' do
|
27
|
+
@movie.latest.should be_true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return the upcoming movies" do
|
32
|
+
VCR.use_cassette 'movie/return_upcoming_movie' do
|
33
|
+
@movie.upcoming.should be_true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should show movies that are now playing" do
|
38
|
+
VCR.use_cassette 'movie/now_playing' do
|
39
|
+
@movie.now_playing.should be_true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return popular movies" do
|
44
|
+
VCR.use_cassette 'movie/popular' do
|
45
|
+
@movie.popular.should be_true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return top rated movies" do
|
50
|
+
VCR.use_cassette 'movie/top_rated' do
|
51
|
+
@movie.top_rated.should be_true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should return alternative titles for an ID" do
|
56
|
+
VCR.use_cassette 'movie/alternative_titles_for_id' do
|
57
|
+
@movie.alternative_titles(5).should be_true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return cast information for an ID" do
|
62
|
+
VCR.use_cassette 'movie/cast_information_for_id' do
|
63
|
+
@movie.casts(5).should be_true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return crew for an ID" do
|
68
|
+
VCR.use_cassette 'movie/crew_for_id' do
|
69
|
+
@movie.crew(5).should be_true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return keywords for an ID" do
|
74
|
+
VCR.use_cassette 'movie/keywords_for_id' do
|
75
|
+
@movie.keywords(5).should be_true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should return releases for an ID" do
|
80
|
+
VCR.use_cassette 'movie/releases_for_id' do
|
81
|
+
@movie.releases(5).should be_true
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should return trailers for an ID" do
|
86
|
+
VCR.use_cassette 'movie/trailers_for_id' do
|
87
|
+
@movie.trailers(5).should be_true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should return translations for an ID" do
|
92
|
+
VCR.use_cassette 'movie/translations_for_id' do
|
93
|
+
@movie.translations(5).should be_true
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should return similar_movies for an ID" do
|
98
|
+
VCR.use_cassette 'movie/similar_for_id' do
|
99
|
+
@movie.similar_movies(5).should be_true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should return the list the movie belongs to" do
|
104
|
+
VCR.use_cassette 'movie/movie_belongs_for_id' do
|
105
|
+
@movie.lists(5).should be_true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should return the changes made" do
|
110
|
+
VCR.use_cassette 'movie/changes_made' do
|
111
|
+
@movie.changes(5).should be_true
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should return credits for an ID" do
|
116
|
+
VCR.use_cassette 'movie/credits_for_id' do
|
117
|
+
@movie.credits(5).should be_true
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "For a movie detail" do
|
123
|
+
|
124
|
+
before(:each) do
|
125
|
+
VCR.use_cassette 'movie/detail' do
|
126
|
+
@movie = Tmdb::Movie.detail(22855)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should return a id" do
|
131
|
+
@movie.id.should == 22855
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should return a adult" do
|
135
|
+
@movie.adult.should == false
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should return a backdrop_path" do
|
139
|
+
@movie.backdrop_path.should == "/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg"
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should return a belongs_to_collection" do
|
143
|
+
@movie.belongs_to_collection.name.should == "DC Universe Animated Original Movies"
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should return a budget" do
|
147
|
+
@movie.budget.should == 0
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should return genres" do
|
151
|
+
@movie.genres.should_not == []
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should return homepage" do
|
155
|
+
@movie.homepage.should == "http://www.warnervideo.com/supermanbatmandvd/"
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should return a imdb_id" do
|
159
|
+
@movie.imdb_id.should == "tt1398941"
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should return a original_title" do
|
163
|
+
@movie.original_title.should == "Superman/Batman: Public Enemies"
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should return a overview" do
|
167
|
+
@movie.overview.should == "United States President Lex Luthor uses the oncoming trajectory of a Kryptonite meteor to frame Superman and declare a $1 billion bounty on the heads of the Man of Steel and his ‘partner in crime’, Batman. Heroes and villains alike launch a relentless pursuit of Superman and Batman, who must unite—and recruit help—to try and stave off the action-packed onslaught, stop the meteor Luthors plot."
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should return popularity" do
|
171
|
+
@movie.popularity.should == 1.15974723131612
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should return poster_path" do
|
175
|
+
@movie.poster_path.should == "/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg"
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should return production_companies" do
|
179
|
+
@movie.production_companies.should_not == []
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return production_countries" do
|
183
|
+
@movie.production_countries.should_not == []
|
184
|
+
end
|
185
|
+
|
186
|
+
it "should return release_date" do
|
187
|
+
@movie.release_date.should == "2009-09-29"
|
188
|
+
end
|
189
|
+
|
190
|
+
it "should return revenue" do
|
191
|
+
@movie.revenue.should == 0
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should return a runtime" do
|
195
|
+
@movie.runtime.should == 67
|
196
|
+
end
|
197
|
+
|
198
|
+
it "should return spoken_languages" do
|
199
|
+
@movie.spoken_languages.first.name.should == "English"
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should return status" do
|
203
|
+
@movie.status.should == "Released"
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should return vote_average" do
|
207
|
+
@movie.vote_average.should == 7.4
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should return vote_count" do
|
211
|
+
@movie.vote_count.should == 23
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe 'For a movie detail with appended response' do
|
216
|
+
let(:append_fields) { %w{ alternative_titles credits images keywords releases
|
217
|
+
trailers translations reviews lists changes }.join(',') }
|
218
|
+
before(:each) do
|
219
|
+
VCR.use_cassette 'movie/detail_with_appended_response' do
|
220
|
+
@movie = Tmdb::Movie.detail(22855, append_to_response: append_fields)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'should return alternative_titles' do
|
225
|
+
@movie.alternative_titles.titles.size.should == 4
|
226
|
+
@movie.alternative_titles.titles.first.title.should == 'Superman und Batman Public Enemies'
|
227
|
+
end
|
228
|
+
|
229
|
+
it 'should return credits' do
|
230
|
+
@movie.credits.cast.size.should == 20
|
231
|
+
@movie.credits.cast.first.id.should == 34947
|
232
|
+
@movie.credits.crew.size.should == 3
|
233
|
+
@movie.credits.crew.first.id.should == 90367
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'should return images' do
|
237
|
+
@movie.images.backdrops.size.should == 6
|
238
|
+
@movie.images.backdrops.first.file_path.should == '/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg'
|
239
|
+
@movie.images.posters.size.should == 9
|
240
|
+
@movie.images.posters.first.file_path.should == '/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg'
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'should return keywords' do
|
244
|
+
@movie.keywords.keywords.size.should == 2
|
245
|
+
@movie.keywords.keywords.first.id.should == 9715
|
246
|
+
end
|
247
|
+
|
248
|
+
it 'should return releases' do
|
249
|
+
@movie.releases.countries.size.should == 1
|
250
|
+
@movie.releases.countries.first.release_date.should == '2009-09-29'
|
251
|
+
end
|
252
|
+
|
253
|
+
it 'should return trailers' do
|
254
|
+
@movie.trailers.quicktime.should == []
|
255
|
+
@movie.trailers.youtube.size.should == 1
|
256
|
+
@movie.trailers.youtube.first.name.should == 'Official Preview Trailer'
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'should return translations' do
|
260
|
+
@movie.translations.translations.size.should == 13
|
261
|
+
@movie.translations.translations.first.name.should == 'English'
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'should return reviews' do
|
265
|
+
@movie.reviews.results.should == []
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'should return lists' do
|
269
|
+
@movie.lists.results.size.should == 4
|
270
|
+
@movie.lists.results.first.id.should == '51d6b52219c295172912ff1e'
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'should return changes' do
|
274
|
+
@movie.changes.changes.should == []
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
describe "For a movies images" do
|
279
|
+
|
280
|
+
before(:each) do
|
281
|
+
VCR.use_cassette 'movie/images' do
|
282
|
+
@movie = Tmdb::Movie.images(22855)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should return backdrops" do
|
287
|
+
@movie.backdrops.length == 4
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should return posters" do
|
291
|
+
@movie.posters.should be_true
|
292
|
+
end
|
293
|
+
|
294
|
+
end
|
295
|
+
|
296
|
+
describe "For other languages" do
|
297
|
+
|
298
|
+
before(:each) do
|
299
|
+
Tmdb::Api.language("de")
|
300
|
+
VCR.use_cassette 'movie/language_german' do
|
301
|
+
@movie = Tmdb::Movie.detail(562)
|
302
|
+
end
|
303
|
+
Tmdb::Api.language(nil)
|
304
|
+
end
|
305
|
+
|
306
|
+
it "should return the german name" do
|
307
|
+
@movie.title.should == "Stirb Langsam"
|
308
|
+
end
|
309
|
+
|
310
|
+
it "should return the german description" do
|
311
|
+
@movie.overview.should == "Eigentlich möchte der New Yorker Polizist John McClane dieses Weihnachten nur seine Noch-Ehefrau Holly, welche in Los Angeles in einer großen, erfolgreichen Firma Karriere gemacht hat, besuchen und das Fest mit den beiden gemeinsamen Kinder verbringen. Als die Feierlichkeiten im Nakatomi Plaza beginnen sollen, stürmt eine Gruppe von Terroristen das Hochhaus und nur John McClane schafft es ihnen zu entwischen. Lediglich bewaffnet mit ein paar Zigaretten und einem Walkie-Talkie, wodurch er den Funk der Geiselnehmer mithören kann, und mit Waffen, welche die Terroristen gelegentlich so rumliegen lassen, muss John nun nicht nur sein eigenes Leben retten, sondern möglichst auch das aller anderen Beteiligten. Und so beschließt er, die äußerst brutale Truppe auszumerzen und sich einen Terroristen nach dem anderen vorzuknöpfen. Während draußen dann schon die Polizei und das FBI stümperhaft versucht, das Gebäude zu stürmen, kämpft McClane ohne Schuhe gegen die 12 Aggressoren..."
|
312
|
+
end
|
313
|
+
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
data/spec/person_spec.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'rspec'
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
describe Tmdb::Person do
|
7
|
+
@fields = [:id,:name,:place_of_birth,:also_known_as,
|
8
|
+
:adult,:biography,:birthday,:deathday,:homepage,
|
9
|
+
:profile_path,:movie_credits,:tv_credits,:combined_credits,
|
10
|
+
:images,:changes]
|
11
|
+
|
12
|
+
@fields.each do |field|
|
13
|
+
it { should respond_to field }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "For person p" do
|
17
|
+
before(:each) do
|
18
|
+
@person = Tmdb::Person
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return the popular people" do
|
22
|
+
VCR.use_cassette 'person/popular' do
|
23
|
+
@person.popular.should be_true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should return the latest person" do
|
28
|
+
VCR.use_cassette 'person/latest' do
|
29
|
+
@person.latest.should be_true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should return credits for a person ID" do
|
34
|
+
VCR.use_cassette 'person/credits' do
|
35
|
+
@person.credits(5292).should be_true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return changes for a person ID" do
|
40
|
+
VCR.use_cassette 'person/changes' do
|
41
|
+
@person.changes(5292).should be_true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "For a person detail" do
|
47
|
+
before(:each) do
|
48
|
+
VCR.use_cassette 'person/detail' do
|
49
|
+
@person = Tmdb::Person.detail(5292)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return a id" do
|
54
|
+
@person.id.should == 5292
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return a name" do
|
58
|
+
@person.name.should == "Denzel Washington"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return a adult" do
|
62
|
+
@person.adult.should == false
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return a biography" do
|
66
|
+
@person.biography.should == "From Wikipedia, the free encyclopedia.\n\nDenzel Hayes Washington, Jr. (born December 28, 1954) is an American actor, screenwriter, director and film producer. He first rose to prominence when he joined the cast of the medical drama St. Elsewhere, playing Dr. Philip Chandler for six years. He has received much critical acclaim for his work in film since the 1990s, including for his portrayals of real-life figures, such as Steve Biko, Malcolm X, Rubin \"Hurricane\" Carter, Melvin B. Tolson, Frank Lucas, and Herman Boone.\n\nWashington has received two Academy Awards, two Golden Globe awards, a Tony Award. He is notable for winning the Best Supporting Actor for Glory in 1989; and the Academy Award for Best Actor in 2001 for his role in the film Training Day\n\nDescription above from the Wikipedia article Denzel Washington, licensed under CC-BY-SA, full list of contributors on Wikipedia."
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should return a birthday" do
|
70
|
+
@person.birthday.should == "1954-12-28"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return a deathday" do
|
74
|
+
@person.deathday.should == ""
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should return a homepage" do
|
78
|
+
@person.homepage.should == ""
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should return a place of birth" do
|
82
|
+
@person.place_of_birth.should == "Mount Vernon, New York, USA"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should return a profile path" do
|
86
|
+
@person.profile_path.should == "/khMf8LLTtppUwuZqqnigD2nAy26.jpg"
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should return an array with also known as names" do
|
90
|
+
@person.also_known_as.should == []
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe 'For a person detail with appended response' do
|
95
|
+
let(:append_fields) { %w{ movie_credits tv_credits combined_credits images changes }.join(',') }
|
96
|
+
|
97
|
+
before(:each) do
|
98
|
+
VCR.use_cassette 'person/detail_with_appended_response' do
|
99
|
+
@person = Tmdb::Person.detail(5292, append_to_response: append_fields)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should return movie credits' do
|
104
|
+
@person.movie_credits.cast.size.should == 47
|
105
|
+
@person.movie_credits.cast.first.id.should == 388
|
106
|
+
@person.movie_credits.crew.size.should == 4
|
107
|
+
@person.movie_credits.crew.first.id.should == 13435
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should return tv credits' do
|
111
|
+
@person.tv_credits.cast.size.should == 17
|
112
|
+
@person.tv_credits.cast.first.id.should == 1709
|
113
|
+
@person.tv_credits.crew.size.should == 3
|
114
|
+
@person.tv_credits.crew.first.id.should == 18881
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should return combined credits' do
|
118
|
+
@person.combined_credits.cast.size.should == 64
|
119
|
+
@person.combined_credits.cast.first.id.should == 388
|
120
|
+
@person.combined_credits.crew.size.should == 7
|
121
|
+
@person.combined_credits.crew.first.id.should == 13435
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should return images' do
|
125
|
+
@person.images.profiles.size.should == 6
|
126
|
+
@person.images.profiles.first.file_path.should == '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'should return changes' do
|
130
|
+
@person.changes.changes.should == []
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe "For images of a person" do
|
135
|
+
before(:each) do
|
136
|
+
VCR.use_cassette 'person/images' do
|
137
|
+
@person_images = Tmdb::Person.images(5292)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should return profiles" do
|
142
|
+
@person_images.profiles.length == 6
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|