tmdb-api 0.0.4 → 0.0.5

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.
@@ -0,0 +1,103 @@
1
+ {
2
+ "crew":
3
+ [
4
+ {
5
+ "id": 7469,
6
+ "name": "Jim Uhls",
7
+ "department": "Writing",
8
+ "job": "Author",
9
+ "profile_path": null
10
+ },
11
+ {
12
+ "id": 7474,
13
+ "name": "Ross Grayson Bell",
14
+ "department": "Production",
15
+ "job": "Producer",
16
+ "profile_path": null
17
+ },
18
+ {
19
+ "id": 7475,
20
+ "name": "Ceán Chaffin",
21
+ "department": "Production",
22
+ "job": "Producer",
23
+ "profile_path": null
24
+ },
25
+ {
26
+ "id": 1254,
27
+ "name": "Art Linson",
28
+ "department": "Production",
29
+ "job": "Producer",
30
+ "profile_path": "/dEtVivCXxQBtIzmJcUNupT1AB4H.jpg"
31
+ },
32
+ {
33
+ "id": 7477,
34
+ "name": "John King",
35
+ "department": "Sound",
36
+ "job": "Original Music Composer",
37
+ "profile_path": null
38
+ },
39
+ {
40
+ "id": 7478,
41
+ "name": "Michael Simpson",
42
+ "department": "Sound",
43
+ "job": "Original Music Composer",
44
+ "profile_path": null
45
+ },
46
+ {
47
+ "id": 7479,
48
+ "name": "Jeff Cronenweth",
49
+ "department": "Camera",
50
+ "job": "Director of Photography",
51
+ "profile_path": null
52
+ },
53
+ {
54
+ "id": 7480,
55
+ "name": "James Haygood",
56
+ "department": "Editing",
57
+ "job": "Editor",
58
+ "profile_path": null
59
+ },
60
+ {
61
+ "id": 7481,
62
+ "name": "Laray Mayfield",
63
+ "department": "Production",
64
+ "job": "Casting",
65
+ "profile_path": null
66
+ },
67
+ {
68
+ "id": 1303,
69
+ "name": "Alex McDowell",
70
+ "department": "Art",
71
+ "job": "Production Design",
72
+ "profile_path": null
73
+ },
74
+ {
75
+ "id": 7763,
76
+ "name": "Ren Klyce",
77
+ "department": "Sound",
78
+ "job": "Sound Editor",
79
+ "profile_path": null
80
+ },
81
+ {
82
+ "id": 7764,
83
+ "name": "Richard Hymns",
84
+ "department": "Sound",
85
+ "job": "Sound Editor",
86
+ "profile_path": null
87
+ },
88
+ {
89
+ "id": 7467,
90
+ "name": "David Fincher",
91
+ "department": "Directing",
92
+ "job": "Director",
93
+ "profile_path": "/dcBHejOsKvzVZVozWJAPzYthb8X.jpg"
94
+ },
95
+ {
96
+ "id": 7468,
97
+ "name": "Chuck Palahniuk",
98
+ "department": "Writing",
99
+ "job": "Novel",
100
+ "profile_path": "/8nOJDJ6SqwV2h7PjdLBDTvIxXvx.jpg"
101
+ }
102
+ ]
103
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": 550,
3
+ "quicktime": [],
4
+ "youtube": [{
5
+ "name": "Trailer 1",
6
+ "size": "HD",
7
+ "source": "SUXWAEX2jlg",
8
+ "type": "trailer"
9
+ }]
10
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "adult": false,
3
+ "also_known_as":
4
+ [
5
+ "Sir Ian McKellan",
6
+ "Sir Ian McKellen",
7
+ "Ian Murray McKellen"
8
+ ],
9
+ "biography": "Sir Ian Murray McKellen is an English actor. He has received a Tony Award and two Academy Award nominations. His work has spanned genres from Shakespearean and modern theatre to popular fantasy and science fiction. He is known to many for roles such as Gandalf in the Lord of the Rings film trilogy and as Magneto in the X-Men films. In 1988, McKellen came out and announced he was gay. He became a founding member of Stonewall, one of the United Kingdom's most influential LGBT rights groups, of which he remains a prominent spokesman. He was made a Commander of the Order of the British Empire (CBE) in 1979, and knighted in the 1991 New Year Honours for his outstanding work and contributions to theatre. In the 2008 New Year Honours he was made a Companion of Honour (CH) for services to drama and to equality.",
10
+ "birthday": "1939-05-25",
11
+ "deathday": "",
12
+ "homepage": "http://www.mckellen.com/",
13
+ "id": 1327,
14
+ "imdb_id": "nm0005212",
15
+ "name": "Ian McKellen",
16
+ "place_of_birth": "Burnley, England",
17
+ "popularity": 16.0104684226102,
18
+ "profile_path": "/c51mP46oPgAgFf7bFWVHlScZynM.jpg"
19
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": 8557,
3
+ "profiles": [
4
+ {
5
+ "file_path": "/j77Z3f2m0e211ocFhPJu5ZiO12R.jpg",
6
+ "width": 290,
7
+ "height": 290,
8
+ "iso_639_1": null,
9
+ "aspect_ratio": 1.0
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "page": 1,
3
+ "results": [
4
+ {
5
+ "adult": false,
6
+ "id": 8784,
7
+ "name": "Daniel Craig",
8
+ "profile_path": "/wWMdqiqW6unT6TnXydQbOtYffeO.jpg"
9
+ },
10
+ {
11
+ "adult": false,
12
+ "id": 20005,
13
+ "name": "Moira Kelly",
14
+ "profile_path": "/4cDCNxqYgJ0ueUqIpM4lUBnBb5f.jpg"
15
+ },
16
+ {
17
+ "adult": false,
18
+ "id": 17282,
19
+ "name": "Takashi Miike",
20
+ "profile_path": "/sAuA3MamBI87lB9rirbdqgcuOu0.jpg"
21
+ },
22
+ {
23
+ "adult": false,
24
+ "id": 62,
25
+ "name": "Bruce Willis",
26
+ "profile_path": "/szRtf6oUR9cT6whTbRc5sCQGi8a.jpg"
27
+ }
28
+ ],
29
+ "total_pages": 13,
30
+ "total_results": 243
31
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "page": 3,
3
+ "results": [
4
+ {
5
+ "adult": false,
6
+ "id": 1149851,
7
+ "name": "Maurizio Forestieri",
8
+ "profile_path": "/cqg6n5wMERepaoMr3Ak5wH9Myuw.jpg"
9
+ },
10
+ {
11
+ "adult": false,
12
+ "id": 24829,
13
+ "name": "Jean-Guy Fechner",
14
+ "profile_path": "/kWwHjF14w30SMuC8V4W2GofIMvE.jpg"
15
+ },
16
+ {
17
+ "adult": false,
18
+ "id": 524,
19
+ "name": "Natalie Portman",
20
+ "profile_path": "/d30Z0EKHJcDMYaJfLr2X6rVoUrI.jpg"
21
+ },
22
+ {
23
+ "adult": false,
24
+ "id": 14999,
25
+ "name": "George A. Romero",
26
+ "profile_path": "/q1XONnZT4ccRVGd9gSAv0F0D8te.jpg"
27
+ },
28
+ {
29
+ "adult": false,
30
+ "id": 17067,
31
+ "name": "Karoline Herfurth",
32
+ "profile_path": "/8HVqhIaLQA3MOTO88Ncn6VOCzdp.jpg"
33
+ }
34
+ ],
35
+ "total_pages": 13,
36
+ "total_results": 243
37
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "page": 1,
3
+ "results": [
4
+ {
5
+ "adult": false,
6
+ "id": 108,
7
+ "name": "Peter Jackson",
8
+ "popularity": 3.411923015718,
9
+ "profile_path": "/8MN8C1w1wuEHMxdvDqHP5bDFMh.jpg"
10
+ },
11
+ {
12
+ "adult": false,
13
+ "id": 187329,
14
+ "name": "Peter Jackson",
15
+ "popularity": 0.7,
16
+ "profile_path": null
17
+ },
18
+ {
19
+ "adult": false,
20
+ "id": 1141786,
21
+ "name": "Peter E. Jackson",
22
+ "popularity": 0.7,
23
+ "profile_path": null
24
+ }
25
+ ],
26
+ "total_pages": 1,
27
+ "total_results": 3
28
+ }
@@ -183,6 +183,61 @@ describe TMDb::Movie do
183
183
  end
184
184
  end
185
185
 
186
+ describe '.cast' do
187
+ it 'returns the cast for a specific movie' do
188
+ stub_get('/movie/550/casts')
189
+ .to_return(json_response('movie/cast.json'))
190
+
191
+ cast = TMDb::Movie.cast(550)
192
+
193
+ expect(cast).to have(31).items
194
+
195
+ expect(cast.first).to eq(
196
+ {
197
+ "id"=>819,
198
+ "name"=>"Edward Norton",
199
+ "character"=>"The Narrator",
200
+ "order"=>0,
201
+ "cast_id"=>4,
202
+ "profile_path"=>"/588Hrov6wwM9WcU88nJHlw2iufN.jpg"
203
+ })
204
+ end
205
+
206
+ it 'raises with a bad request' do
207
+ stub_get('/movie/invalid-id/casts').to_return(status: 404)
208
+
209
+ expect { TMDb::Movie.cast('invalid-id') }
210
+ .to raise_error ArgumentError
211
+ end
212
+ end
213
+
214
+ describe '.crew' do
215
+ it 'returns the crew for a specific movie' do
216
+ stub_get('/movie/550/casts')
217
+ .to_return(json_response('movie/crew.json'))
218
+
219
+ crew = TMDb::Movie.crew(550)
220
+
221
+ expect(crew).to have(14).items
222
+
223
+ expect(crew.first).to eq(
224
+ {
225
+ "id"=>7469,
226
+ "name"=>"Jim Uhls",
227
+ "department"=>"Writing",
228
+ "job"=>"Author",
229
+ "profile_path"=>nil
230
+ })
231
+ end
232
+
233
+ it 'raises with a bad request' do
234
+ stub_get('/movie/invalid-id/casts').to_return(status: 404)
235
+
236
+ expect { TMDb::Movie.crew('invalid-id') }
237
+ .to raise_error ArgumentError
238
+ end
239
+ end
240
+
186
241
  describe '.images' do
187
242
  it 'returns the images (posters and backdrops) for a specific movie ID' do
188
243
  stub_get('/movie/598/images')
@@ -272,6 +327,29 @@ describe TMDb::Movie do
272
327
  end
273
328
  end
274
329
 
330
+ describe '.trailers' do
331
+ it 'return trailers for a specific movie id' do
332
+ stub_get('/movie/550/trailers').to_return(json_response('movie/trailers.json'))
333
+
334
+ trailers = TMDb::Movie.trailers(550)
335
+
336
+ expect(trailers['youtube']).to eq([
337
+ {
338
+ "name" => "Trailer 1",
339
+ "size" => "HD",
340
+ "source" => "SUXWAEX2jlg",
341
+ "type" => "trailer"
342
+ }
343
+ ])
344
+ end
345
+
346
+ it 'raises with a bad request' do
347
+ stub_get('/movie/550/trailers').to_return(status: 404)
348
+
349
+ expect { TMDb::Movie.trailers(550) }.to raise_error ArgumentError
350
+ end
351
+ end
352
+
275
353
  describe '.releases' do
276
354
  it 'returns the release for a specific movie' do
277
355
  stub_get('/movie/598/releases').to_return(json_response('movie/releases.json'))
@@ -0,0 +1,106 @@
1
+ require "spec_helper"
2
+
3
+ describe TMDb::Person do
4
+ describe '.find' do
5
+ before do
6
+ stub_get('/person/1327').to_return(json_response('person/find.json'))
7
+ end
8
+
9
+ let!(:person) { TMDb::Person.find(1327) }
10
+
11
+ it 'returns "adult" attribute' do
12
+ expect(person.adult).to eq(false)
13
+ end
14
+
15
+ it 'returns "also_known_as" as array of strings' do
16
+ expect(person.also_known_as).to match_array([
17
+ 'Sir Ian McKellan',
18
+ 'Sir Ian McKellen',
19
+ 'Ian Murray McKellen'
20
+ ])
21
+ end
22
+
23
+ it 'return "biography" attribute' do
24
+ expect(person.biography).to start_with("Sir Ian Murray McKellen is an English actor.")
25
+ end
26
+
27
+ it 'returns "birthday" attribute' do
28
+ expect(person.birthday).to eq('1939-05-25')
29
+ end
30
+
31
+ it 'returns "deathday" attribute' do
32
+ expect(person.deathday).to eq('')
33
+ end
34
+
35
+ it 'returns "homepage" attribute' do
36
+ expect(person.homepage).to eq('http://www.mckellen.com/')
37
+ end
38
+
39
+ it 'returns "id" attribute' do
40
+ expect(person.id).to eq(1327)
41
+ end
42
+
43
+ it 'returns "imdb_id" attribute' do
44
+ expect(person.imdb_id).to eq('nm0005212')
45
+ end
46
+
47
+ it 'returns "name" attribute' do
48
+ expect(person.name).to eq('Ian McKellen')
49
+ end
50
+
51
+ it 'returns "place_of_birth" attribute' do
52
+ expect(person.place_of_birth).to eq('Burnley, England')
53
+ end
54
+
55
+ it 'returns "popularity" attribute' do
56
+ expect(person.popularity).to eq(16.0104684226102)
57
+ end
58
+
59
+ it 'returns "profile_path" attribute' do
60
+ expect(person.profile_path).to eq('/c51mP46oPgAgFf7bFWVHlScZynM.jpg')
61
+ end
62
+
63
+ it 'raises with a bad request' do
64
+ stub_get('/person/666').to_return(status: 404)
65
+ expect { TMDb::Person.find(666) }.to raise_error(ArgumentError)
66
+ end
67
+ end
68
+
69
+ describe '.images' do
70
+ it 'gets the images given an person ID' do
71
+ stub_get('/person/8557/images').to_return(json_response('person/images.json'))
72
+
73
+ images = TMDb::Person.images(8557)
74
+
75
+ expect(images['profiles'].first).to eq({
76
+ "file_path" => '/j77Z3f2m0e211ocFhPJu5ZiO12R.jpg',
77
+ "width" => 290,
78
+ "height" => 290,
79
+ "iso_639_1" => nil,
80
+ "aspect_ratio" => 1.0
81
+ })
82
+ end
83
+
84
+ it 'raises with a bad request' do
85
+ stub_get('/person/666/images').to_return(status: 404)
86
+ expect { TMDb::Person.images(666) }.to raise_error ArgumentError
87
+ end
88
+ end
89
+
90
+ describe '.popular' do
91
+ it 'gets a list of popular people' do
92
+ stub_get('/person/popular').to_return(json_response('person/popular.json'))
93
+
94
+ popular = TMDb::Person.popular
95
+
96
+ expect(popular.first.adult).to eq(false)
97
+ expect(popular.first.name).to eq('Daniel Craig')
98
+ expect(popular.first.profile_path).to eq('/wWMdqiqW6unT6TnXydQbOtYffeO.jpg')
99
+ end
100
+
101
+ it 'raises with a bad request' do
102
+ stub_get('/person/popular').with(query: { page: 200 }).to_return(status: 404)
103
+ expect{ TMDb::Person.popular(page: 200) }.to raise_error ArgumentError
104
+ end
105
+ end
106
+ end