themoviedb 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -5
- data/lib/themoviedb/api.rb +5 -5
- data/lib/themoviedb/collection.rb +1 -1
- data/lib/themoviedb/company.rb +1 -1
- data/lib/themoviedb/configuration.rb +8 -8
- data/lib/themoviedb/episode.rb +3 -3
- data/lib/themoviedb/find.rb +6 -6
- data/lib/themoviedb/genre.rb +5 -5
- data/lib/themoviedb/job.rb +1 -1
- data/lib/themoviedb/keyword.rb +20 -0
- data/lib/themoviedb/movie.rb +15 -9
- data/lib/themoviedb/person.rb +3 -3
- data/lib/themoviedb/resource.rb +1 -1
- data/lib/themoviedb/search.rb +22 -20
- data/lib/themoviedb/season.rb +3 -3
- data/lib/themoviedb/tv.rb +6 -6
- data/lib/themoviedb/version.rb +2 -1
- data/lib/themoviedb.rb +6 -6
- data/spec/company_spec.rb +30 -32
- data/spec/find_spec.rb +14 -16
- data/spec/invalid_api_key_spec.rb +13 -14
- data/spec/keyword_spec.rb +66 -0
- data/spec/movie_spec.rb +134 -133
- data/spec/person_spec.rb +60 -63
- data/spec/spec_helper.rb +13 -17
- data/spec/tv_spec.rb +175 -177
- data/spec/vcr/keyword/detail.yml +56 -0
- data/spec/vcr/keyword/movies_for_id.yml +334 -0
- data/spec/vcr/movie/detail.yml +22 -56
- data/themoviedb.gemspec +1 -7
- metadata +50 -100
data/spec/movie_spec.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
|
2
|
-
require 'rspec'
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'vcr'
|
1
|
+
require "spec_helper"
|
5
2
|
|
6
|
-
describe Tmdb::Movie do
|
3
|
+
RSpec.describe Tmdb::Movie do
|
7
4
|
@fields = [:id, :adult, :backdrop_path, :belongs_to_collection,
|
8
|
-
:budget, :genres, :homepage, :imdb_id, :original_title,
|
5
|
+
:budget, :genres, :homepage, :imdb_id, :original_language, :original_title,
|
9
6
|
:overview, :popularity, :poster_path, :production_companies,
|
10
7
|
:production_countries, :release_date, :revenue, :runtime,
|
11
8
|
:spoken_languages, :status, :tagline, :title, :vote_average,
|
@@ -16,296 +13,300 @@ describe Tmdb::Movie do
|
|
16
13
|
it { should respond_to field }
|
17
14
|
end
|
18
15
|
|
19
|
-
describe
|
16
|
+
describe "For a movie" do
|
20
17
|
before(:each) do
|
21
18
|
@movie = Tmdb::Movie
|
22
19
|
end
|
23
20
|
|
24
|
-
it
|
25
|
-
VCR.use_cassette
|
21
|
+
it "should return the latest movies" do
|
22
|
+
VCR.use_cassette "movie/return_latest_movie" do
|
26
23
|
expect(@movie.latest).to be_truthy
|
27
24
|
end
|
28
25
|
end
|
29
26
|
|
30
|
-
it
|
31
|
-
VCR.use_cassette
|
27
|
+
it "should return the upcoming movies" do
|
28
|
+
VCR.use_cassette "movie/return_upcoming_movie" do
|
32
29
|
expect(@movie.upcoming).to be_truthy
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
|
-
it
|
37
|
-
VCR.use_cassette
|
33
|
+
it "should show movies that are now playing" do
|
34
|
+
VCR.use_cassette "movie/now_playing" do
|
38
35
|
expect(@movie.now_playing).to be_truthy
|
39
36
|
end
|
40
37
|
end
|
41
38
|
|
42
|
-
it
|
43
|
-
VCR.use_cassette
|
39
|
+
it "should return popular movies" do
|
40
|
+
VCR.use_cassette "movie/popular" do
|
44
41
|
expect(@movie.popular).to be_truthy
|
45
42
|
end
|
46
43
|
end
|
47
44
|
|
48
|
-
it
|
49
|
-
VCR.use_cassette
|
45
|
+
it "should return top rated movies" do
|
46
|
+
VCR.use_cassette "movie/top_rated" do
|
50
47
|
expect(@movie.top_rated).to be_truthy
|
51
48
|
end
|
52
49
|
end
|
53
50
|
|
54
|
-
it
|
55
|
-
VCR.use_cassette
|
51
|
+
it "should return alternative titles for an ID" do
|
52
|
+
VCR.use_cassette "movie/alternative_titles_for_id" do
|
56
53
|
expect(@movie.alternative_titles(5)).to be_truthy
|
57
54
|
end
|
58
55
|
end
|
59
56
|
|
60
|
-
it
|
61
|
-
VCR.use_cassette
|
57
|
+
it "should return cast information for an ID" do
|
58
|
+
VCR.use_cassette "movie/cast_information_for_id" do
|
62
59
|
expect(@movie.casts(5)).to be_truthy
|
63
60
|
end
|
64
61
|
end
|
65
62
|
|
66
|
-
it
|
67
|
-
VCR.use_cassette
|
63
|
+
it "should return crew for an ID" do
|
64
|
+
VCR.use_cassette "movie/crew_for_id" do
|
68
65
|
expect(@movie.crew(5)).to be_truthy
|
69
66
|
end
|
70
67
|
end
|
71
68
|
|
72
|
-
it
|
73
|
-
VCR.use_cassette
|
69
|
+
it "should return keywords for an ID" do
|
70
|
+
VCR.use_cassette "movie/keywords_for_id" do
|
74
71
|
expect(@movie.keywords(5)).to be_truthy
|
75
72
|
end
|
76
73
|
end
|
77
74
|
|
78
|
-
it
|
79
|
-
VCR.use_cassette
|
75
|
+
it "should return releases for an ID" do
|
76
|
+
VCR.use_cassette "movie/releases_for_id" do
|
80
77
|
expect(@movie.releases(5)).to be_truthy
|
81
78
|
end
|
82
79
|
end
|
83
80
|
|
84
|
-
it
|
85
|
-
VCR.use_cassette
|
81
|
+
it "should return trailers for an ID" do
|
82
|
+
VCR.use_cassette "movie/trailers_for_id" do
|
86
83
|
expect(@movie.trailers(5)).to be_truthy
|
87
84
|
end
|
88
85
|
end
|
89
86
|
|
90
|
-
it
|
91
|
-
VCR.use_cassette
|
87
|
+
it "should return translations for an ID" do
|
88
|
+
VCR.use_cassette "movie/translations_for_id" do
|
92
89
|
expect(@movie.translations(5)).to be_truthy
|
93
90
|
end
|
94
91
|
end
|
95
92
|
|
96
|
-
it
|
97
|
-
VCR.use_cassette
|
93
|
+
it "should return similar_movies for an ID" do
|
94
|
+
VCR.use_cassette "movie/similar_for_id" do
|
98
95
|
expect(@movie.similar_movies(5)).to be_truthy
|
99
96
|
end
|
100
97
|
end
|
101
98
|
|
102
|
-
it
|
103
|
-
VCR.use_cassette
|
99
|
+
it "should return the list the movie belongs to" do
|
100
|
+
VCR.use_cassette "movie/movie_belongs_for_id" do
|
104
101
|
expect(@movie.lists(5)).to be_truthy
|
105
102
|
end
|
106
103
|
end
|
107
104
|
|
108
|
-
it
|
109
|
-
VCR.use_cassette
|
105
|
+
it "should return the changes made" do
|
106
|
+
VCR.use_cassette "movie/changes_made" do
|
110
107
|
expect(@movie.changes(5)).to be_truthy
|
111
108
|
end
|
112
109
|
end
|
113
110
|
|
114
|
-
it
|
115
|
-
VCR.use_cassette
|
111
|
+
it "should return credits for an ID" do
|
112
|
+
VCR.use_cassette "movie/credits_for_id" do
|
116
113
|
expect(@movie.credits(5)).to be_truthy
|
117
114
|
end
|
118
115
|
end
|
119
116
|
end
|
120
117
|
|
121
|
-
describe
|
118
|
+
describe "For a movie detail" do
|
122
119
|
before(:each) do
|
123
|
-
VCR.use_cassette
|
120
|
+
VCR.use_cassette "movie/detail" do
|
124
121
|
@movie = Tmdb::Movie.detail(22_855)
|
125
122
|
end
|
126
123
|
end
|
127
124
|
|
128
|
-
it
|
129
|
-
expect(@movie[
|
125
|
+
it "should return a id" do
|
126
|
+
expect(@movie["id"]).to eq 22_855
|
130
127
|
end
|
131
128
|
|
132
|
-
it
|
133
|
-
expect(@movie[
|
129
|
+
it "should return a adult" do
|
130
|
+
expect(@movie["adult"]).to eq false
|
134
131
|
end
|
135
132
|
|
136
|
-
it
|
137
|
-
expect(@movie[
|
133
|
+
it "should return a backdrop_path" do
|
134
|
+
expect(@movie["backdrop_path"]).to eq "/aMyEMGuW2NV3A0whuEM7VKp6M73.jpg"
|
138
135
|
end
|
139
136
|
|
140
|
-
it
|
141
|
-
expect(@movie[
|
137
|
+
it "should return a belongs_to_collection" do
|
138
|
+
expect(@movie["belongs_to_collection"]["name"]).to eq "Superman / Batman (Animated) Collection"
|
142
139
|
end
|
143
140
|
|
144
|
-
it
|
145
|
-
expect(@movie[
|
141
|
+
it "should return a budget" do
|
142
|
+
expect(@movie["budget"]).to eq 0
|
146
143
|
end
|
147
144
|
|
148
|
-
it
|
149
|
-
expect(@movie[
|
145
|
+
it "should return genres" do
|
146
|
+
expect(@movie["genres"]).not_to eq []
|
150
147
|
end
|
151
148
|
|
152
|
-
it
|
153
|
-
expect(@movie[
|
149
|
+
it "should return homepage" do
|
150
|
+
expect(@movie["homepage"]).to eq "https://www.warnerbros.com/supermanbatman-public-enemies"
|
154
151
|
end
|
155
152
|
|
156
|
-
it
|
157
|
-
expect(@movie[
|
153
|
+
it "should return a imdb_id" do
|
154
|
+
expect(@movie["imdb_id"]).to eq "tt1398941"
|
158
155
|
end
|
159
156
|
|
160
|
-
it
|
161
|
-
expect(@movie[
|
157
|
+
it "should return an original_language" do
|
158
|
+
expect(@movie["original_language"]).to eq "en"
|
162
159
|
end
|
163
160
|
|
164
|
-
it
|
165
|
-
expect(@movie[
|
161
|
+
it "should return a original_title" do
|
162
|
+
expect(@movie["original_title"]).to eq "Superman/Batman: Public Enemies"
|
166
163
|
end
|
167
164
|
|
168
|
-
it
|
169
|
-
expect(@movie[
|
165
|
+
it "should return a overview" do
|
166
|
+
expect(@movie["overview"]).to eq "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."
|
170
167
|
end
|
171
168
|
|
172
|
-
it
|
173
|
-
expect(@movie[
|
169
|
+
it "should return popularity" do
|
170
|
+
expect(@movie["popularity"]).to eq 10.200109
|
174
171
|
end
|
175
172
|
|
176
|
-
it
|
177
|
-
expect(@movie[
|
173
|
+
it "should return poster_path" do
|
174
|
+
expect(@movie["poster_path"]).to eq "/bJBZxzFHfTAOtBg8fOCCaBmh4hF.jpg"
|
178
175
|
end
|
179
176
|
|
180
|
-
it
|
181
|
-
expect(@movie[
|
177
|
+
it "should return production_companies" do
|
178
|
+
expect(@movie["production_companies"]).not_to eq []
|
182
179
|
end
|
183
180
|
|
184
|
-
it
|
185
|
-
expect(@movie[
|
181
|
+
it "should return production_countries" do
|
182
|
+
expect(@movie["production_countries"]).not_to eq []
|
186
183
|
end
|
187
184
|
|
188
|
-
it
|
189
|
-
expect(@movie[
|
185
|
+
it "should return release_date" do
|
186
|
+
expect(@movie["release_date"]).to eq "2009-09-29"
|
190
187
|
end
|
191
188
|
|
192
|
-
it
|
193
|
-
expect(@movie[
|
189
|
+
it "should return revenue" do
|
190
|
+
expect(@movie["revenue"]).to eq 0
|
194
191
|
end
|
195
192
|
|
196
|
-
it
|
197
|
-
expect(@movie[
|
193
|
+
it "should return a runtime" do
|
194
|
+
expect(@movie["runtime"]).to eq 67
|
198
195
|
end
|
199
196
|
|
200
|
-
it
|
201
|
-
expect(@movie[
|
197
|
+
it "should return spoken_languages" do
|
198
|
+
expect(@movie["spoken_languages"].first["name"]).to eq "English"
|
202
199
|
end
|
203
200
|
|
204
|
-
it
|
205
|
-
expect(@movie[
|
201
|
+
it "should return status" do
|
202
|
+
expect(@movie["status"]).to eq "Released"
|
206
203
|
end
|
207
204
|
|
208
|
-
it
|
209
|
-
expect(@movie[
|
205
|
+
it "should return vote_average" do
|
206
|
+
expect(@movie["vote_average"]).to eq 6.8
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should return vote_count" do
|
210
|
+
expect(@movie["vote_count"]).to eq 199
|
210
211
|
end
|
211
212
|
end
|
212
213
|
|
213
|
-
describe
|
214
|
+
describe "For a movie detail with appended response" do
|
214
215
|
let(:append_fields) do
|
215
|
-
%w
|
216
|
-
trailers translations reviews lists changes
|
216
|
+
%w[ alternative_titles credits images keywords releases
|
217
|
+
trailers translations reviews lists changes ].join(",")
|
217
218
|
end
|
218
219
|
before(:each) do
|
219
|
-
VCR.use_cassette
|
220
|
+
VCR.use_cassette "movie/detail_with_appended_response" do
|
220
221
|
@movie = Tmdb::Movie.detail(22_855, append_to_response: append_fields)
|
221
222
|
end
|
222
223
|
end
|
223
224
|
|
224
|
-
it
|
225
|
-
expect(@movie[
|
226
|
-
expect(@movie[
|
225
|
+
it "should return alternative_titles" do
|
226
|
+
expect(@movie["alternative_titles"]["titles"].size).to eq 4
|
227
|
+
expect(@movie["alternative_titles"]["titles"].first["title"]).to eq "Superman und Batman Public Enemies"
|
227
228
|
end
|
228
229
|
|
229
|
-
it
|
230
|
-
expect(@movie[
|
231
|
-
expect(@movie[
|
232
|
-
expect(@movie[
|
233
|
-
expect(@movie[
|
230
|
+
it "should return credits" do
|
231
|
+
expect(@movie["credits"]["cast"].size).to eq 20
|
232
|
+
expect(@movie["credits"]["cast"].first["id"]).to eq 34_947
|
233
|
+
expect(@movie["credits"]["crew"].size).to eq 3
|
234
|
+
expect(@movie["credits"]["crew"].first["id"]).to eq 90_367
|
234
235
|
end
|
235
236
|
|
236
|
-
it
|
237
|
-
expect(@movie[
|
238
|
-
expect(@movie[
|
239
|
-
expect(@movie[
|
240
|
-
expect(@movie[
|
237
|
+
it "should return images" do
|
238
|
+
expect(@movie["images"]["backdrops"].size).to eq 6
|
239
|
+
expect(@movie["images"]["backdrops"].first["file_path"]).to eq "/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg"
|
240
|
+
expect(@movie["images"]["posters"].size).to eq 9
|
241
|
+
expect(@movie["images"]["posters"].first["file_path"]).to eq "/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg"
|
241
242
|
end
|
242
243
|
|
243
|
-
it
|
244
|
-
expect(@movie[
|
245
|
-
expect(@movie[
|
244
|
+
it "should return keywords" do
|
245
|
+
expect(@movie["keywords"]["keywords"].size).to eq 2
|
246
|
+
expect(@movie["keywords"]["keywords"].first["id"]).to eq 9715
|
246
247
|
end
|
247
248
|
|
248
|
-
it
|
249
|
-
expect(@movie[
|
250
|
-
expect(@movie[
|
249
|
+
it "should return releases" do
|
250
|
+
expect(@movie["releases"]["countries"].size).to eq 1
|
251
|
+
expect(@movie["releases"]["countries"].first["release_date"]).to eq "2009-09-29"
|
251
252
|
end
|
252
253
|
|
253
|
-
it
|
254
|
-
expect(@movie[
|
255
|
-
expect(@movie[
|
256
|
-
expect(@movie[
|
254
|
+
it "should return trailers" do
|
255
|
+
expect(@movie["trailers"]["quicktime"]).to eq []
|
256
|
+
expect(@movie["trailers"]["youtube"].size).to eq 1
|
257
|
+
expect(@movie["trailers"]["youtube"].first["name"]).to eq "Official Preview Trailer"
|
257
258
|
end
|
258
259
|
|
259
|
-
it
|
260
|
-
expect(@movie[
|
261
|
-
expect(@movie[
|
260
|
+
it "should return translations" do
|
261
|
+
expect(@movie["translations"]["translations"].size).to eq 13
|
262
|
+
expect(@movie["translations"]["translations"].first["name"]).to eq "English"
|
262
263
|
end
|
263
264
|
|
264
|
-
it
|
265
|
-
expect(@movie[
|
265
|
+
it "should return reviews" do
|
266
|
+
expect(@movie["reviews"]["results"]).to eq []
|
266
267
|
end
|
267
268
|
|
268
|
-
it
|
269
|
-
expect(@movie[
|
270
|
-
expect(@movie[
|
269
|
+
it "should return lists" do
|
270
|
+
expect(@movie["lists"]["results"].size).to eq 4
|
271
|
+
expect(@movie["lists"]["results"].first["id"]).to eq "51d6b52219c295172912ff1e"
|
271
272
|
end
|
272
273
|
|
273
|
-
it
|
274
|
-
expect(@movie[
|
274
|
+
it "should return changes" do
|
275
|
+
expect(@movie["changes"]["changes"]).to eq []
|
275
276
|
end
|
276
277
|
end
|
277
278
|
|
278
|
-
describe
|
279
|
+
describe "For a movies images" do
|
279
280
|
before(:each) do
|
280
|
-
VCR.use_cassette
|
281
|
+
VCR.use_cassette "movie/images" do
|
281
282
|
@movie = Tmdb::Movie.images(22_855)
|
282
283
|
end
|
283
284
|
end
|
284
285
|
|
285
|
-
it
|
286
|
-
@movie[
|
286
|
+
it "should return backdrops" do
|
287
|
+
@movie["backdrops"].length == 4
|
287
288
|
end
|
288
289
|
|
289
|
-
it
|
290
|
-
expect(@movie[
|
290
|
+
it "should return posters" do
|
291
|
+
expect(@movie["posters"]).to be_truthy
|
291
292
|
end
|
292
293
|
end
|
293
294
|
|
294
|
-
describe
|
295
|
+
describe "For other languages" do
|
295
296
|
before(:each) do
|
296
|
-
Tmdb::Api.language(
|
297
|
-
VCR.use_cassette
|
297
|
+
Tmdb::Api.language("de")
|
298
|
+
VCR.use_cassette "movie/language_german" do
|
298
299
|
@movie = Tmdb::Movie.detail(562)
|
299
300
|
end
|
300
301
|
Tmdb::Api.language(nil)
|
301
302
|
end
|
302
303
|
|
303
|
-
it
|
304
|
-
expect(@movie[
|
304
|
+
it "should return the german name" do
|
305
|
+
expect(@movie["title"]).to eq "Stirb Langsam"
|
305
306
|
end
|
306
307
|
|
307
|
-
it
|
308
|
-
expect(@movie[
|
308
|
+
it "should return the german description" do
|
309
|
+
expect(@movie["overview"]).to eq "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..."
|
309
310
|
end
|
310
311
|
end
|
311
312
|
end
|