tmdb-api 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +73 -20
- data/lib/{tmdb.rb → tmdb-api.rb} +6 -5
- data/lib/tmdb-api/base.rb +43 -0
- data/lib/tmdb-api/changes.rb +21 -0
- data/lib/tmdb-api/httparty.rb +10 -0
- data/lib/{tmdb → tmdb-api}/movie.rb +35 -39
- data/lib/{tmdb → tmdb-api}/searchable.rb +12 -10
- data/lib/tmdb-api/version.rb +3 -0
- data/spec/fixtures/changes/{movie_changes.json → movies.json} +0 -0
- data/spec/fixtures/{alternative_titles.json → movie/alternative_titles.json} +0 -0
- data/spec/fixtures/{find_movie_by_id.json → movie/find.json} +0 -0
- data/spec/fixtures/{movie_images.json → movie/images.json} +0 -0
- data/spec/fixtures/{movie_keywords.json → movie/keywords.json} +0 -0
- data/spec/fixtures/{movie_releases.json → movie/releases.json} +0 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/tmdb-api/change_spec.rb +26 -0
- data/spec/tmdb-api/movie_spec.rb +312 -0
- data/spec/tmdb-api/searchable_spec.rb +33 -0
- data/spec/{tmdb → tmdb-api}/tmdb_spec.rb +0 -0
- data/{tmdb.gemspec → tmdb-api.gemspec} +4 -4
- metadata +34 -58
- data/lib/tmdb/changes.rb +0 -22
- data/lib/tmdb/fetcher.rb +0 -30
- data/lib/tmdb/version.rb +0 -3
- data/spec/fixtures/alternative_titles_by_country.json +0 -9
- data/spec/fixtures/changes/movie_changes_page_2.json +0 -407
- data/spec/fixtures/changes/movie_changes_start_date.json +0 -407
- data/spec/fixtures/find_movie.json +0 -19
- data/spec/fixtures/find_movie_by_id_and_language.json +0 -66
- data/spec/fixtures/invalid_id.json +0 -4
- data/spec/fixtures/movie/upcoming_page_2.json +0 -251
- data/spec/fixtures/movie_images_by_language.json +0 -42
- data/spec/fixtures/no_results.json +0 -6
- data/spec/fixtures/search_movie_by_name_and_adult_filter.json +0 -55
- data/spec/fixtures/search_movie_by_name_and_page.json +0 -247
- data/spec/fixtures/search_movie_by_name_and_year.json +0 -19
- data/spec/tmdb/changes_spec.rb +0 -52
- data/spec/tmdb/movie/upcoming_spec.rb +0 -28
- data/spec/tmdb/movie_spec.rb +0 -473
- data/spec/tmdb/searchable_spec.rb +0 -9
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"page": 1,
|
3
|
-
"results": [
|
4
|
-
{
|
5
|
-
"adult": false,
|
6
|
-
"backdrop_path": "/gM3KKiN80qbJgKHjPnmAfwxSicG.jpg",
|
7
|
-
"id": 603,
|
8
|
-
"original_title": "The Matrix",
|
9
|
-
"release_date": "1999-03-30",
|
10
|
-
"poster_path": "/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg",
|
11
|
-
"popularity": 7.94015698023987,
|
12
|
-
"title": "The Matrix",
|
13
|
-
"vote_average": 8.5,
|
14
|
-
"vote_count": 364
|
15
|
-
}
|
16
|
-
],
|
17
|
-
"total_pages": 1,
|
18
|
-
"total_results": 1
|
19
|
-
}
|
data/spec/tmdb/changes_spec.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TMDb::Changes do
|
4
|
-
describe '.movies' do
|
5
|
-
it 'returns the changed movies' do
|
6
|
-
stub_get('/movie/changes').to_return(json_response('changes/movie_changes.json'))
|
7
|
-
|
8
|
-
changes = TMDb::Changes.movies
|
9
|
-
|
10
|
-
expect(changes['results']).to have(100).items
|
11
|
-
expect(changes['total_results']).to eql(4645)
|
12
|
-
expect(changes['total_pages']).to eql(47)
|
13
|
-
expect(changes['page']).to eql(1)
|
14
|
-
expect(changes['results'].first).to eql({
|
15
|
-
'id' => 128149,
|
16
|
-
'adult' => false
|
17
|
-
})
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'returns the changed movies of page 2' do
|
21
|
-
stub_get('/movie/changes').with(query: { page: 2 }).
|
22
|
-
to_return(json_response('changes/movie_changes_page_2.json'))
|
23
|
-
|
24
|
-
changes = TMDb::Changes.movies(page: 2)
|
25
|
-
|
26
|
-
expect(changes['results']).to have(100).items
|
27
|
-
expect(changes['total_results']).to eql(4648)
|
28
|
-
expect(changes['total_pages']).to eql(47)
|
29
|
-
expect(changes['page']).to eql(2)
|
30
|
-
expect(changes['results'].first).to eql({
|
31
|
-
'id' => 163536,
|
32
|
-
'adult' => false
|
33
|
-
})
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns the changed movies filtered by start_date' do
|
37
|
-
stub_get('/movie/changes').with(query: { start_date: '2013-07-05' }).
|
38
|
-
to_return(json_response('changes/movie_changes_start_date.json'))
|
39
|
-
|
40
|
-
changes = TMDb::Changes.movies(start_date: '2013-07-05')
|
41
|
-
|
42
|
-
expect(changes['results']).to have(100).items
|
43
|
-
expect(changes['total_results']).to eql(773)
|
44
|
-
expect(changes['total_pages']).to eql(8)
|
45
|
-
expect(changes['page']).to eql(1)
|
46
|
-
expect(changes['results'].first).to eql({
|
47
|
-
'id' => 205372,
|
48
|
-
'adult' => false
|
49
|
-
})
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TMDb::Movie do
|
4
|
-
describe '.upcoming' do
|
5
|
-
it 'returns the upcoming movies' do
|
6
|
-
stub_get('/movie/upcoming').to_return(json_response('movie/upcoming.json'))
|
7
|
-
|
8
|
-
upcoming = TMDb::Movie.upcoming
|
9
|
-
|
10
|
-
expect(upcoming).to have(20).movies
|
11
|
-
expect(upcoming.first.id).to eql(68726)
|
12
|
-
expect(upcoming.first.title).to eql('Pacific Rim')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'returns the upcoming movies of page 2' do
|
16
|
-
stub_get('/movie/upcoming').with(query: { page: 2 }).
|
17
|
-
to_return(json_response('movie/upcoming_page_2.json'))
|
18
|
-
|
19
|
-
upcoming = TMDb::Movie.upcoming(page: 2)
|
20
|
-
|
21
|
-
# TODO: find a way to return the page number, total_pages and total_results
|
22
|
-
# expect(page).to eql(2)
|
23
|
-
expect(upcoming).to have(20).movies
|
24
|
-
expect(upcoming.first.id).to eql(185407)
|
25
|
-
expect(upcoming.first.title).to eql('Israel: A Home Movie / Kach Ra’inu')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/spec/tmdb/movie_spec.rb
DELETED
@@ -1,473 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe TMDb::Movie do
|
4
|
-
describe ".search" do
|
5
|
-
it "searches movies given only the movie name" do
|
6
|
-
stub_get('/search/movie').with(query: { query: 'The Lord of the Rings' })
|
7
|
-
.to_return(json_response('search_movie_by_name.json'))
|
8
|
-
|
9
|
-
movies = TMDb::Movie.search("The Lord of the Rings")
|
10
|
-
|
11
|
-
expect(movies).to have(7).items
|
12
|
-
|
13
|
-
expect(movies.first.adult).to eq(false)
|
14
|
-
expect(movies.first.backdrop_path).to eq("/pIUvQ9Ed35wlWhY2oU6OmwEsmzG.jpg")
|
15
|
-
expect(movies.first.id).to eq(120)
|
16
|
-
expect(movies.first.original_title).to eq("The Lord of the Rings: The Fellowship of the Ring")
|
17
|
-
expect(movies.first.release_date).to eq("2001-12-19")
|
18
|
-
expect(movies.first.poster_path).to eq("/9HG6pINW1KoFTAKY3LdybkoOKAm.jpg")
|
19
|
-
expect(movies.first.popularity).to eq(10.895025450078979)
|
20
|
-
expect(movies.first.title).to eq("The Lord of the Rings: The Fellowship of the Ring")
|
21
|
-
expect(movies.first.vote_average).to eq(8.3)
|
22
|
-
expect(movies.first.vote_count).to eq(187)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "searches movies given movie name and year" do
|
26
|
-
stub_get('/search/movie').with(query: { query: 'Matrix', year: 1999 })
|
27
|
-
.to_return(json_response('search_movie_by_name_and_year.json'))
|
28
|
-
|
29
|
-
movies = TMDb::Movie.search('Matrix', year: 1999)
|
30
|
-
|
31
|
-
expect(movies).to have(1).item
|
32
|
-
|
33
|
-
expect(movies.first.adult).to eq(false)
|
34
|
-
expect(movies.first.backdrop_path).to eq("/gM3KKiN80qbJgKHjPnmAfwxSicG.jpg")
|
35
|
-
expect(movies.first.id).to eq(603)
|
36
|
-
expect(movies.first.original_title).to eq("The Matrix")
|
37
|
-
expect(movies.first.release_date).to eq("1999-03-30")
|
38
|
-
expect(movies.first.poster_path).to eq("/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg")
|
39
|
-
expect(movies.first.popularity).to eq(7.94015698023987)
|
40
|
-
expect(movies.first.title).to eq("The Matrix")
|
41
|
-
expect(movies.first.vote_average).to eq(8.5)
|
42
|
-
expect(movies.first.vote_count).to eq(364)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "searches movies given movie name and page number" do
|
46
|
-
stub_get('/search/movie').with(query: { query: 'Fight', page: 2 })
|
47
|
-
.to_return(json_response('search_movie_by_name_and_page.json'))
|
48
|
-
|
49
|
-
movies = TMDb::Movie.search('Fight', page: 2)
|
50
|
-
|
51
|
-
expect(movies).to have(20).items
|
52
|
-
|
53
|
-
expect(movies.first.adult).to eq(false)
|
54
|
-
expect(movies.first.backdrop_path).to eq("/sNqj5kwBRxz91xJWFxgYRsdXuyp.jpg")
|
55
|
-
expect(movies.first.id).to eq(119199)
|
56
|
-
expect(movies.first.original_title).to eq("Arena of the Street Fighter")
|
57
|
-
expect(movies.first.release_date).to eq("2012-07-26")
|
58
|
-
expect(movies.first.poster_path).to eq("/8OFWwM7MeqZDXsLsZm4q6vLU1zB.jpg")
|
59
|
-
expect(movies.first.popularity).to eq(0.4)
|
60
|
-
expect(movies.first.title).to eq("Arena of the Street Fighter")
|
61
|
-
expect(movies.first.vote_average).to eq(0.5)
|
62
|
-
expect(movies.first.vote_count).to eq(1)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "searches movies given movie name and adult filter" do
|
66
|
-
stub_get('/search/movie').with(query: { query: 'Gang Bang 5', include_adult: true.to_s })
|
67
|
-
.to_return(json_response('search_movie_by_name_and_adult_filter.json'))
|
68
|
-
|
69
|
-
movies = TMDb::Movie.search('Gang Bang 5', include_adult: true.to_s)
|
70
|
-
|
71
|
-
expect(movies).to have(4).items
|
72
|
-
|
73
|
-
expect(movies.first.adult).to eq(true)
|
74
|
-
expect(movies.first.backdrop_path).to eq(nil)
|
75
|
-
expect(movies.first.id).to eq(68025)
|
76
|
-
expect(movies.first.original_title).to eq("Gang Bang 5")
|
77
|
-
expect(movies.first.release_date).to eq(nil)
|
78
|
-
expect(movies.first.poster_path).to eq("/j2rfswcwXNSzYKORb5tJQO7u4UY.jpg")
|
79
|
-
expect(movies.first.popularity).to eq(0.4)
|
80
|
-
expect(movies.first.title).to eq("Gang Bang 5")
|
81
|
-
expect(movies.first.vote_average).to eq(0)
|
82
|
-
expect(movies.first.vote_count).to eq(0)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "returns an empty array when no movies found" do
|
86
|
-
stub_get('/search/movie').with(query: { query: 'Inexistent Movie' })
|
87
|
-
.to_return(json_response('no_results.json'))
|
88
|
-
|
89
|
-
movies = TMDb::Movie.search('Inexistent Movie')
|
90
|
-
|
91
|
-
expect(movies).to match_array([])
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe ".find" do
|
96
|
-
it "find a movie given your ID" do
|
97
|
-
stub_get('/movie/24').to_return(json_response('find_movie_by_id.json'))
|
98
|
-
|
99
|
-
movie = TMDb::Movie.find(24)
|
100
|
-
|
101
|
-
expect(movie.adult).to eq(false)
|
102
|
-
expect(movie.backdrop_path).to eq("/hSaH9tt67bozo9K50sbH0s4YjEc.jpg")
|
103
|
-
expect(movie.belongs_to_collection).to eq(nil)
|
104
|
-
expect(movie.budget).to eq(3300000)
|
105
|
-
expect(movie.genres).to eq([
|
106
|
-
{
|
107
|
-
"id" => 28,
|
108
|
-
"name" => "Action"
|
109
|
-
},
|
110
|
-
{
|
111
|
-
"id" => 80,
|
112
|
-
"name" => "Crime"
|
113
|
-
},
|
114
|
-
{
|
115
|
-
"id" => 18,
|
116
|
-
"name" => "Drama"
|
117
|
-
},
|
118
|
-
{
|
119
|
-
"id" => 10769,
|
120
|
-
"name" => "Foreign"
|
121
|
-
}
|
122
|
-
])
|
123
|
-
expect(movie.homepage).to eq('http://cidadededeus.globo.com/')
|
124
|
-
expect(movie.id).to eq(598)
|
125
|
-
expect(movie.imdb_id).to eq('tt0317248')
|
126
|
-
expect(movie.original_title).to eq("Cidade de Deus")
|
127
|
-
expect(movie.overview).to eq("City of God depicts the raw violence in the ghettos of Rio de Janeiro. In the 1970’s that kids are carrying guns and joining gangs when they should be playing hide-and-seek.")
|
128
|
-
expect(movie.popularity).to eq(1.3497251049225558)
|
129
|
-
expect(movie.poster_path).to eq("/mwDnSQR1CkxuDjSKfgiNT0sIOjM.jpg")
|
130
|
-
expect(movie.production_companies).to eq([
|
131
|
-
{
|
132
|
-
"name" => "O2 Filmes",
|
133
|
-
"id" => 345
|
134
|
-
},
|
135
|
-
{
|
136
|
-
"name" => "VideoFilmes",
|
137
|
-
"id" => 346
|
138
|
-
},
|
139
|
-
{
|
140
|
-
"name" => "Globo filmes",
|
141
|
-
"id" => 10954
|
142
|
-
},
|
143
|
-
{
|
144
|
-
"name" => "Lumiere",
|
145
|
-
"id" => 11444
|
146
|
-
},
|
147
|
-
{
|
148
|
-
"name" => "Wild Bunch",
|
149
|
-
"id" => 856
|
150
|
-
},
|
151
|
-
{
|
152
|
-
"name" => "Hank Levine Film",
|
153
|
-
"id" => 11445
|
154
|
-
},
|
155
|
-
{
|
156
|
-
"name" => "Lereby Productions",
|
157
|
-
"id" => 11446
|
158
|
-
}
|
159
|
-
])
|
160
|
-
expect(movie.production_countries).to eq([
|
161
|
-
{
|
162
|
-
"iso_3166_1" => "BR",
|
163
|
-
"name" => "Brazil"
|
164
|
-
},
|
165
|
-
{
|
166
|
-
"iso_3166_1" => "FR",
|
167
|
-
"name" => "France"
|
168
|
-
}
|
169
|
-
])
|
170
|
-
expect(movie.release_date).to eq("2002-08-31")
|
171
|
-
expect(movie.revenue).to eq(27387381)
|
172
|
-
expect(movie.runtime).to eq(130)
|
173
|
-
expect(movie.spoken_languages).to eq([
|
174
|
-
{
|
175
|
-
"iso_639_1" => "pt",
|
176
|
-
"name" => "Português"
|
177
|
-
}
|
178
|
-
])
|
179
|
-
expect(movie.status).to eq("Released")
|
180
|
-
expect(movie.tagline).to eq("If you run you're dead...if you stay, you're dead again. Period.")
|
181
|
-
expect(movie.title).to eq("City of God")
|
182
|
-
expect(movie.vote_average).to eq(8.2)
|
183
|
-
expect(movie.vote_count).to eq(52)
|
184
|
-
end
|
185
|
-
|
186
|
-
it "find a movie given your ID and language" do
|
187
|
-
stub_get('/movie/550').with(query: { language: 'pt' })
|
188
|
-
.to_return(json_response('find_movie_by_id_and_language.json'))
|
189
|
-
|
190
|
-
movie = TMDb::Movie.find(550, language: 'pt')
|
191
|
-
|
192
|
-
expect(movie.adult).to eq(false)
|
193
|
-
expect(movie.backdrop_path).to eq("/kkS8PKa8c134vXsj2fQkNqOaCXU.jpg")
|
194
|
-
expect(movie.belongs_to_collection).to eq({
|
195
|
-
"id" => 2883,
|
196
|
-
"name" => "Kill Bill Collection",
|
197
|
-
"poster_path" => "/tf1nUtw3LJGUGv1EFFi23iz6ngr.jpg",
|
198
|
-
"backdrop_path" => "/oCLKNACMNrEf4T1EP6BpMXDl5m1.jpg"
|
199
|
-
})
|
200
|
-
expect(movie.budget).to eq(55000000)
|
201
|
-
expect(movie.genres).to eq([
|
202
|
-
{
|
203
|
-
"id" => 28,
|
204
|
-
"name" => "Ação"
|
205
|
-
},
|
206
|
-
{
|
207
|
-
"id" => 80,
|
208
|
-
"name" => "Crime"
|
209
|
-
},
|
210
|
-
{
|
211
|
-
"id" => 53,
|
212
|
-
"name" => "Thriller"
|
213
|
-
}
|
214
|
-
])
|
215
|
-
expect(movie.homepage).to eq('')
|
216
|
-
expect(movie.id).to eq(24)
|
217
|
-
expect(movie.imdb_id).to eq('tt0266697')
|
218
|
-
expect(movie.original_title).to eq("Kill Bill: Vol. 1")
|
219
|
-
expect(movie.overview).to eq("Kill Bill presta uma grande homenagem aos filmes de Kung-fu das décadas de 60 e 70, seus atores e estilos. Dirigido com exímia presteza, a obra foi delicadamente produzida o que dá ao expectador um deleite frente às diversas mudanças de sensibilidade do filme, cenas em preto e branco, seqüências, sombras, ângulos de câmera e intertextualidade com outras mídias como o trecho do filme feito em anime e a sensacional trilha sonora que se tornou um dos deliciosos hábitos viciantes dos filmes de Tarantino. O primeiro volume do filme narra o início da vingança da ex-assassina Black Mamba (cujo nome real só nos é revelado ao final do segundo filme). Ao acordar do coma, Black Mamba percebe que foi a única sobrevivente do extermínio ocorrido no dia de seu casamento e que levara as vidas de todos a quem amava, inclusive do filho que levava no ventre. Ela começa então uma caçada impiedosa aos assassinos, seus ex-companheiros do esquadrão de assassinato Deadly Viper.")
|
220
|
-
expect(movie.popularity).to eq(2.884757761614897)
|
221
|
-
expect(movie.poster_path).to eq("/viscNSLi1rDyMuTytUojf0G2DIy.jpg")
|
222
|
-
expect(movie.production_companies).to eq([
|
223
|
-
{
|
224
|
-
"name" => "Miramax Films",
|
225
|
-
"id" => 14
|
226
|
-
},
|
227
|
-
{
|
228
|
-
"name" => "A Band Apart",
|
229
|
-
"id" => 59
|
230
|
-
}
|
231
|
-
])
|
232
|
-
expect(movie.production_countries).to eq([
|
233
|
-
{
|
234
|
-
"iso_3166_1" => "JP",
|
235
|
-
"name" => "Japan"
|
236
|
-
},
|
237
|
-
{
|
238
|
-
"iso_3166_1" => "US",
|
239
|
-
"name" => "United States of America"
|
240
|
-
}
|
241
|
-
])
|
242
|
-
expect(movie.release_date).to eq("2003-10-09")
|
243
|
-
expect(movie.revenue).to eq(180949000)
|
244
|
-
expect(movie.runtime).to eq(111)
|
245
|
-
expect(movie.spoken_languages).to eq([
|
246
|
-
{
|
247
|
-
"iso_639_1" => "en",
|
248
|
-
"name" => "English"
|
249
|
-
}
|
250
|
-
])
|
251
|
-
expect(movie.status).to eq("Released")
|
252
|
-
expect(movie.tagline).to eq("")
|
253
|
-
expect(movie.title).to eq("Kill Bill - Volume 1")
|
254
|
-
expect(movie.vote_average).to eq(7.6)
|
255
|
-
expect(movie.vote_count).to eq(92)
|
256
|
-
end
|
257
|
-
|
258
|
-
it 'raises error with id not found' do
|
259
|
-
stub_get('/movie/1234').to_return(json_response('invalid_id.json', 404))
|
260
|
-
expect { TMDb::Movie.find(1234) }.to raise_error(ArgumentError)
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
describe "#alternative_titles" do
|
265
|
-
it "returns the alternative titles for a specific movie" do
|
266
|
-
stub_get('/movie/598').to_return(json_response('find_movie_by_id.json'))
|
267
|
-
stub_get('/movie/598/alternative_titles')
|
268
|
-
.to_return(json_response('alternative_titles.json'))
|
269
|
-
|
270
|
-
alternative_titles = TMDb::Movie.alternative_titles(598)
|
271
|
-
|
272
|
-
expect(alternative_titles).to match_array([
|
273
|
-
{
|
274
|
-
"iso_3166_1" => "RU",
|
275
|
-
"title" => "Город бога"
|
276
|
-
},
|
277
|
-
{
|
278
|
-
"iso_3166_1" => "IT",
|
279
|
-
"title" => "City of God - La città di Dio"
|
280
|
-
},
|
281
|
-
{
|
282
|
-
"iso_3166_1" => "BR",
|
283
|
-
"title" => "Cidade de Deus"
|
284
|
-
},
|
285
|
-
{
|
286
|
-
"iso_3166_1" => "FR",
|
287
|
-
"title" => "La cité de Dieu"
|
288
|
-
},
|
289
|
-
{
|
290
|
-
"iso_3166_1" => "DE",
|
291
|
-
"title" => "City of God"
|
292
|
-
},
|
293
|
-
{
|
294
|
-
"iso_3166_1" => "CN",
|
295
|
-
"title" => "上帝之城"
|
296
|
-
},
|
297
|
-
{
|
298
|
-
"iso_3166_1" => "HK",
|
299
|
-
"title" => "无主之城"
|
300
|
-
},
|
301
|
-
{
|
302
|
-
"iso_3166_1" => "US",
|
303
|
-
"title" => "City of God"
|
304
|
-
},
|
305
|
-
{
|
306
|
-
"iso_3166_1" => "TW",
|
307
|
-
"title" => "無法無天"
|
308
|
-
}
|
309
|
-
])
|
310
|
-
end
|
311
|
-
|
312
|
-
it "returns the alternative titles for a specific movie and a specific country" do
|
313
|
-
stub_get('/movie/598').to_return(json_response('find_movie_by_id.json'))
|
314
|
-
stub_get('/movie/598/alternative_titles').with(query: { country: 'br' })
|
315
|
-
.to_return(json_response('alternative_titles_by_country.json'))
|
316
|
-
|
317
|
-
alternative_titles = TMDb::Movie.alternative_titles(598, country: 'br')
|
318
|
-
|
319
|
-
expect(alternative_titles).to match_array([
|
320
|
-
{
|
321
|
-
"iso_3166_1" => "BR",
|
322
|
-
"title" => "Cidade de Deus"
|
323
|
-
}
|
324
|
-
])
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
describe '#images' do
|
329
|
-
it 'returns the images (posters and backdrops) for a specific movie ID' do
|
330
|
-
stub_get('/movie/598').to_return(json_response('find_movie_by_id.json'))
|
331
|
-
stub_get('/movie/598/images')
|
332
|
-
.to_return(json_response('movie_images.json'))
|
333
|
-
|
334
|
-
images = TMDb::Movie.images(598)
|
335
|
-
|
336
|
-
expect(images['backdrops']).to have(7).items
|
337
|
-
expect(images['posters']).to have(16).items
|
338
|
-
|
339
|
-
expect(images['backdrops'].first).to eq(
|
340
|
-
{
|
341
|
-
"file_path" => "/hSaH9tt67bozo9K50sbH0s4YjEc.jpg",
|
342
|
-
"width" => 1532,
|
343
|
-
"height" => 862,
|
344
|
-
"iso_639_1" => nil,
|
345
|
-
"aspect_ratio" => 1.78,
|
346
|
-
"vote_average" => 5.4421768707483,
|
347
|
-
"vote_count" => 7
|
348
|
-
}
|
349
|
-
)
|
350
|
-
|
351
|
-
expect(images['posters'].first).to eq(
|
352
|
-
{
|
353
|
-
"file_path" => "/mwDnSQR1CkxuDjSKfgiNT0sIOjM.jpg",
|
354
|
-
"width" => 1000,
|
355
|
-
"height" => 1500,
|
356
|
-
"iso_639_1" => "en",
|
357
|
-
"aspect_ratio" => 0.67,
|
358
|
-
"vote_average" => 5.384615384615385,
|
359
|
-
"vote_count" => 2
|
360
|
-
}
|
361
|
-
)
|
362
|
-
end
|
363
|
-
|
364
|
-
it 'returns the images (posters and backdrops) for a specific movie ID and a specific language' do
|
365
|
-
stub_get('/movie/598').to_return(json_response('find_movie_by_id.json'))
|
366
|
-
stub_get('/movie/598/images')
|
367
|
-
.to_return(json_response('movie_images_by_language.json'))
|
368
|
-
|
369
|
-
images = TMDb::Movie.images(598)
|
370
|
-
|
371
|
-
expect(images['backdrops']).to have(0).items
|
372
|
-
expect(images['posters']).to have(4).items
|
373
|
-
|
374
|
-
expect(images['posters'].first).to eq(
|
375
|
-
{
|
376
|
-
"file_path" => "/c9qkycW5DFsycCmuPDPnWvpmCJ5.jpg",
|
377
|
-
"width" => 748,
|
378
|
-
"height" => 1102,
|
379
|
-
"iso_639_1" => "pt",
|
380
|
-
"aspect_ratio" => 0.68,
|
381
|
-
"vote_average" => 5.27891156462585,
|
382
|
-
"vote_count" => 7
|
383
|
-
}
|
384
|
-
)
|
385
|
-
end
|
386
|
-
end
|
387
|
-
|
388
|
-
describe '#keywords' do
|
389
|
-
it 'return the plot keywords for a specific movie id' do
|
390
|
-
stub_get('/movie/598').to_return(json_response('find_movie_by_id.json'))
|
391
|
-
stub_get('/movie/598/keywords').to_return(json_response('movie_keywords.json'))
|
392
|
-
|
393
|
-
keywords = TMDb::Movie.keywords(598)
|
394
|
-
|
395
|
-
expect(keywords).to have(7).items
|
396
|
-
|
397
|
-
expect(keywords).to match_array([
|
398
|
-
{
|
399
|
-
"id" => 542,
|
400
|
-
"name" => "street gang"
|
401
|
-
},
|
402
|
-
{
|
403
|
-
"id" => 983,
|
404
|
-
"name" => "brazilian"
|
405
|
-
},
|
406
|
-
{
|
407
|
-
"id" => 1228,
|
408
|
-
"name" => "seventies"
|
409
|
-
},
|
410
|
-
{
|
411
|
-
"id" => 1525,
|
412
|
-
"name" => "puberty"
|
413
|
-
},
|
414
|
-
{
|
415
|
-
"id" => 1687,
|
416
|
-
"name" => "80s"
|
417
|
-
},
|
418
|
-
{
|
419
|
-
"id" => 2394,
|
420
|
-
"name" => "ghetto"
|
421
|
-
},
|
422
|
-
{
|
423
|
-
"id" => 2987,
|
424
|
-
"name" => "gang war"
|
425
|
-
}
|
426
|
-
])
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
describe '#releases' do
|
431
|
-
it 'returns the release date by country for a specific movie id' do
|
432
|
-
stub_get('/movie/598').to_return(json_response('find_movie_by_id.json'))
|
433
|
-
stub_get('/movie/598/releases').to_return(json_response('movie_releases.json'))
|
434
|
-
|
435
|
-
releases = TMDb::Movie.releases(598)
|
436
|
-
|
437
|
-
expect(releases).to have(6).items
|
438
|
-
|
439
|
-
expect(releases).to match_array([
|
440
|
-
{
|
441
|
-
"iso_3166_1" => "RU",
|
442
|
-
"certification" => "",
|
443
|
-
"release_date" => "2002-02-05"
|
444
|
-
},
|
445
|
-
{
|
446
|
-
"iso_3166_1" => "US",
|
447
|
-
"certification" => "R",
|
448
|
-
"release_date" => "2002-08-31"
|
449
|
-
},
|
450
|
-
{
|
451
|
-
"iso_3166_1" => "BR",
|
452
|
-
"certification" => "",
|
453
|
-
"release_date" => "2002-08-30"
|
454
|
-
},
|
455
|
-
{
|
456
|
-
"iso_3166_1" => "CA",
|
457
|
-
"certification" => "",
|
458
|
-
"release_date" => "2002-09-06"
|
459
|
-
},
|
460
|
-
{
|
461
|
-
"iso_3166_1" => "GB",
|
462
|
-
"certification" => "18",
|
463
|
-
"release_date" => "2002-11-08"
|
464
|
-
},
|
465
|
-
{
|
466
|
-
"iso_3166_1" => "DE",
|
467
|
-
"certification" => "16",
|
468
|
-
"release_date" => "2003-05-08"
|
469
|
-
}
|
470
|
-
])
|
471
|
-
end
|
472
|
-
end
|
473
|
-
end
|