movies_client 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/movies_client.rb +16 -1
- data/lib/movies_client/movies_object.rb +4 -0
- data/lib/movies_client/version.rb +1 -1
- data/test/movies_client_test.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTAyYzk3NWI4Y2ZjNWEwMDdmN2M0ZWEwODg0NDdmNGQ2MDAzNzkyMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZThhMTUxOGQ1YmY4MDQ5ZmRmNTQ2ZDdjYmUyMTdhMGIwNTA4NjRjNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDg4NjNhNDk4YjdiNmQ0OWQ2ZjFlYTU0MzQ2ZmFlYzRiNmVlOTBkMDBmNjk0
|
10
|
+
OTNmMDMxNThjYWYwZTg0OTFmMWQ5NDY1NjIzODQyMzc2MGNiYjg1Zjc4ZmU1
|
11
|
+
MGE2OGNlMzhkNmQ5NGIxNzI2NGM0ZWNiZDkzNDFmOTZhMDA1ZDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGE2ODQyNDRjNDQ2NjgzNGFjNjQyZDdhOTlmZWJlZDQzZjE3NmY3MGNkMTNl
|
14
|
+
NTM0N2JjNWZhOTU2OTVjNDRhMzJjMWQzYTQ4ZWZkODM1NWI1OTBkMzNiOWNh
|
15
|
+
MmYyMjM1ZGI1ZGRiYTVkYWJmMjc2NzQ2NTc4OTdhZWM1YWFhYTY=
|
data/lib/movies_client.rb
CHANGED
@@ -309,6 +309,18 @@ module MoviesClient
|
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
+
def self.get_trailer(id)
|
313
|
+
Tmdb::Api.key(@config[:key])
|
314
|
+
Tmdb::Api.language("fr")
|
315
|
+
trailer = Tmdb::Movie.trailers(id)
|
316
|
+
link = ''
|
317
|
+
unless trailer["youtube"][0].nil?
|
318
|
+
source = trailer["youtube"][0]["source"]
|
319
|
+
link = 'https://www.youtube.com/watch?v='+source.to_s
|
320
|
+
end
|
321
|
+
link
|
322
|
+
end
|
323
|
+
|
312
324
|
def self.get_credits(id)
|
313
325
|
Tmdb::Api.key(@config[:key])
|
314
326
|
Tmdb::Api.language("fr")
|
@@ -325,7 +337,6 @@ module MoviesClient
|
|
325
337
|
end
|
326
338
|
end
|
327
339
|
@credits.store(:credit, cred)
|
328
|
-
puts @credits
|
329
340
|
@credits
|
330
341
|
end
|
331
342
|
|
@@ -362,6 +373,7 @@ module MoviesClient
|
|
362
373
|
movie = MoviesClient.get_movie_details(id)
|
363
374
|
casting = MoviesClient.get_movie_casts(id)
|
364
375
|
credits = MoviesClient.get_credits(id)
|
376
|
+
trailer = MoviesClient.get_trailer(id)
|
365
377
|
result[:id] = id
|
366
378
|
result[:title] = movie.title
|
367
379
|
result[:title_list] = k
|
@@ -372,6 +384,9 @@ module MoviesClient
|
|
372
384
|
unless movie.release_date == ''
|
373
385
|
result[:release_date] = movie.release_date
|
374
386
|
end
|
387
|
+
unless trailer == ''
|
388
|
+
result[:trailer] = trailer
|
389
|
+
end
|
375
390
|
unless movie.genres.nil?
|
376
391
|
result[:genre] = movie.genres.collect { |g| g[:name] }
|
377
392
|
end
|
data/test/movies_client_test.rb
CHANGED
@@ -92,6 +92,13 @@ class MoviesClientTest < Test::Unit::TestCase
|
|
92
92
|
assert_equal 'Tyler Durden', @cast[1][:role]
|
93
93
|
end
|
94
94
|
|
95
|
+
should 'get the trailer of a movie from his id' do
|
96
|
+
MoviesClient.configure_api_key('7f0b035c164b74d6eec69ebcd8ff8d12')
|
97
|
+
link = MoviesClient.get_trailer(550)
|
98
|
+
|
99
|
+
assert_equal 'https://www.youtube.com/watch?v=1UqSD-jSC58', link
|
100
|
+
end
|
101
|
+
|
95
102
|
should 'get the credits of a movie from his id' do
|
96
103
|
MoviesClient.configure_api_key('7f0b035c164b74d6eec69ebcd8ff8d12')
|
97
104
|
@cred = MoviesClient.get_credits(550)
|