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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGRhMzlmYjY3MDUyNGE2NmRmY2ZiOGEzMmY2Y2Y0NzUwMGZmNzcwNw==
4
+ OTAyYzk3NWI4Y2ZjNWEwMDdmN2M0ZWEwODg0NDdmNGQ2MDAzNzkyMQ==
5
5
  data.tar.gz: !binary |-
6
- OWQ1NDVlMWUyMGVkZDI5MjVkMDVmNTFhNjA4NzA4YzU1YWEyOGYyOQ==
6
+ ZThhMTUxOGQ1YmY4MDQ5ZmRmNTQ2ZDdjYmUyMTdhMGIwNTA4NjRjNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmRkYTI2YmFlNGI0MDYwZTM2MDMxYTI2NzY2YmI2ZmZlNGUwYjkxMTM2NTQ2
10
- MWVkY2Q1N2MzYzI2OGYyYWUwMjAwODZiZmUwZjkyODgxNDY0YjczZDI1NmY1
11
- OWZkY2E0MjA5NGVlOTBkNDk1NTM1MzU4YTRiZTY1ZjYwYTMzN2M=
9
+ ZDg4NjNhNDk4YjdiNmQ0OWQ2ZjFlYTU0MzQ2ZmFlYzRiNmVlOTBkMDBmNjk0
10
+ OTNmMDMxNThjYWYwZTg0OTFmMWQ5NDY1NjIzODQyMzc2MGNiYjg1Zjc4ZmU1
11
+ MGE2OGNlMzhkNmQ5NGIxNzI2NGM0ZWNiZDkzNDFmOTZhMDA1ZDM=
12
12
  data.tar.gz: !binary |-
13
- YjFlNzYzMDkzYTUxMWMxMDU2NGIwZTIwOWRlYWI5ODM1ZTY0Y2Y2NDk2YjYy
14
- ZDg3NTgxZTc3MWUyN2VmN2Q0MDZhZjI5YWU5ODI4YzliYmVhMTIwMjlmMTBj
15
- YmNiMTE1ZTQ2Y2IwZmI1YzgwNzAxYjhlNzM5NzFhMDE1MzgwMjQ=
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
@@ -84,6 +84,10 @@ class MoviesObject
84
84
  @result[movie.to_s][:release_date]
85
85
  end
86
86
 
87
+ def trailer(movie)
88
+ @result[movie.to_s][:trailer]
89
+ end
90
+
87
91
  def director(movie)
88
92
  @result[movie.to_s][:credits][:credit]["Director"]
89
93
  end
@@ -1,3 +1,3 @@
1
1
  module MoviesClient
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movies_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jeanbaptistevilain