themoviedb 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +459 -0
  3. data/lib/themoviedb.rb +4 -5
  4. data/lib/themoviedb/api.rb +4 -5
  5. data/lib/themoviedb/collection.rb +6 -7
  6. data/lib/themoviedb/company.rb +7 -8
  7. data/lib/themoviedb/configuration.rb +2 -2
  8. data/lib/themoviedb/episode.rb +16 -17
  9. data/lib/themoviedb/find.rb +11 -12
  10. data/lib/themoviedb/genre.rb +53 -57
  11. data/lib/themoviedb/job.rb +3 -5
  12. data/lib/themoviedb/movie.rb +62 -63
  13. data/lib/themoviedb/person.rb +37 -33
  14. data/lib/themoviedb/resource.rb +19 -21
  15. data/lib/themoviedb/search.rb +30 -30
  16. data/lib/themoviedb/season.rb +16 -17
  17. data/lib/themoviedb/tv.rb +24 -25
  18. data/lib/themoviedb/version.rb +2 -1
  19. data/spec/company_spec.rb +31 -36
  20. data/spec/find_spec.rb +10 -13
  21. data/spec/movie_spec.rb +124 -129
  22. data/spec/person_spec.rb +53 -53
  23. data/spec/spec/vcr/find/search_imdb.yml +39 -0
  24. data/spec/spec_helper.rb +29 -0
  25. data/spec/tv_spec.rb +196 -217
  26. data/spec/vcr/company/detail.yml +67 -0
  27. data/spec/vcr/company/movies.yml +98 -0
  28. data/spec/vcr/find/search_imdb.yml +50 -0
  29. data/spec/vcr/find/search_tvdb.yml +52 -0
  30. data/spec/vcr/movie/alternative_titles_for_id.yml +69 -0
  31. data/spec/vcr/movie/cast_information_for_id.yml +109 -0
  32. data/spec/vcr/movie/changes_made.yml +60 -0
  33. data/spec/vcr/movie/credits_for_id.yml +99 -0
  34. data/spec/vcr/movie/crew_for_id.yml +109 -0
  35. data/spec/vcr/movie/detail.yml +93 -0
  36. data/spec/vcr/movie/detail_with_appended_response.yml +254 -0
  37. data/spec/vcr/movie/images.yml +62 -0
  38. data/spec/vcr/movie/keywords_for_id.yml +62 -0
  39. data/spec/vcr/movie/language_german.yml +112 -0
  40. data/spec/vcr/movie/movie_belongs_for_id.yml +89 -0
  41. data/spec/vcr/movie/now_playing.yml +90 -0
  42. data/spec/vcr/movie/popular.yml +96 -0
  43. data/spec/vcr/movie/releases_for_id.yml +60 -0
  44. data/spec/vcr/movie/return_latest_movie.yml +62 -0
  45. data/spec/vcr/movie/return_upcoming_movie.yml +186 -0
  46. data/spec/vcr/movie/similar_for_id.yml +180 -0
  47. data/spec/vcr/movie/top_rated.yml +190 -0
  48. data/spec/vcr/movie/trailers_for_id.yml +60 -0
  49. data/spec/vcr/movie/translations_for_id.yml +76 -0
  50. data/spec/vcr/person/changes.yml +50 -0
  51. data/spec/vcr/person/credits.yml +459 -0
  52. data/spec/vcr/person/detail.yml +65 -0
  53. data/spec/vcr/person/detail_with_appended_response.yml +762 -0
  54. data/spec/vcr/person/images.yml +50 -0
  55. data/spec/vcr/person/latest.yml +51 -0
  56. data/spec/vcr/person/popular.yml +125 -0
  57. data/spec/vcr/tv/cast.yml +74 -0
  58. data/spec/vcr/tv/crew.yml +74 -0
  59. data/spec/vcr/tv/detail.yml +63 -0
  60. data/spec/vcr/tv/detail_with_appeded_response.yml +76 -0
  61. data/spec/vcr/tv/external_ids.yml +60 -0
  62. data/spec/vcr/tv/images.yml +121 -0
  63. data/spec/vcr/tv/popular.yml +96 -0
  64. data/spec/vcr/tv/test_chuck.yml +52 -0
  65. data/spec/vcr/tv/top_rated.yml +84 -0
  66. data/themoviedb.gemspec +10 -35
  67. metadata +94 -9
@@ -1,11 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'httparty'
3
3
 
4
- ["api", "search", "resource", "configuration"].each do |inc|
5
- require File.join(File.dirname(__FILE__), "themoviedb", inc)
4
+ %w(api search resource configuration).each do |inc|
5
+ require File.join(File.dirname(__FILE__), 'themoviedb', inc)
6
6
  end
7
7
 
8
- ["movie", "tv", "season", "episode", "collection", "person", "company", "genre", "find", "job"].each do |inc|
9
- require File.join(File.dirname(__FILE__), "themoviedb", inc)
8
+ %w(movie tv season episode collection person company genre find job).each do |inc|
9
+ require File.join(File.dirname(__FILE__), 'themoviedb', inc)
10
10
  end
11
-
@@ -11,14 +11,14 @@ module Tmdb
11
11
  end
12
12
 
13
13
  def self.key(api_key)
14
- self.config[:api_key] = api_key
14
+ config[:api_key] = api_key
15
15
  end
16
16
 
17
17
  def self.language(lang)
18
- if (lang.nil?)
19
- self.config.delete(:language)
18
+ if lang.nil?
19
+ config.delete(:language)
20
20
  else
21
- self.config[:language] = lang
21
+ config[:language] = lang
22
22
  end
23
23
  end
24
24
 
@@ -33,6 +33,5 @@ module Tmdb
33
33
  def self.set_response(hash)
34
34
  @@response = hash
35
35
  end
36
-
37
36
  end
38
37
  end
@@ -1,8 +1,8 @@
1
1
  module Tmdb
2
2
  class Collection < Resource
3
- has_resource 'collection', :plural => 'collections'
3
+ has_resource 'collection', plural: 'collections'
4
4
 
5
- #http://docs.themoviedb.apiary.io/#collections
5
+ # http://docs.themoviedb.apiary.io/#collections
6
6
  @@fields = [
7
7
  :backdrop_path,
8
8
  :id,
@@ -15,11 +15,10 @@ module Tmdb
15
15
  attr_accessor field
16
16
  end
17
17
 
18
- #Get all of the images for a particular collection by collection id.
19
- def self.images(id, conditions={})
20
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/images")
18
+ # Get all of the images for a particular collection by collection id.
19
+ def self.images(id, _conditions = {})
20
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
21
21
  search.fetch_response
22
22
  end
23
-
24
23
  end
25
- end
24
+ end
@@ -1,8 +1,8 @@
1
1
  module Tmdb
2
2
  class Company < Resource
3
- has_resource 'company', :plural => 'companies'
3
+ has_resource 'company', plural: 'companies'
4
4
 
5
- #http://docs.themoviedb.apiary.io/#companies
5
+ # http://docs.themoviedb.apiary.io/#companies
6
6
  @@fields = [
7
7
  :description,
8
8
  :headquarters,
@@ -17,11 +17,10 @@ module Tmdb
17
17
  attr_accessor field
18
18
  end
19
19
 
20
- #Get the list of movies associated with a particular company.
21
- def self.movies(id, conditions={})
22
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/movies")
23
- search.fetch
20
+ # Get the list of movies associated with a particular company.
21
+ def self.movies(id, _conditions = {})
22
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/movies")
23
+ search.fetch.collect { |result| Tmdb::Movie.new(result) }
24
24
  end
25
-
26
25
  end
27
- end
26
+ end
@@ -1,6 +1,6 @@
1
1
  module Tmdb
2
2
  class Configuration
3
- def initialize()
3
+ def initialize
4
4
  @params = {}
5
5
  @resource = '/configuration'
6
6
  self
@@ -37,7 +37,7 @@ module Tmdb
37
37
 
38
38
  def fetch_response
39
39
  options = @params.merge(Api.config)
40
- response = Api.get(@resource, :query => options)
40
+ response = Api.get(@resource, query: options)
41
41
  response.to_hash
42
42
  end
43
43
 
@@ -1,37 +1,36 @@
1
1
  module Tmdb
2
2
  class Episode < Resource
3
- has_resource 'episode', :plural => 'episodes'
3
+ has_resource 'episode', plural: 'episodes'
4
4
 
5
- #Get the primary information about a TV episode by combination of a season and episode number.
6
- def self.detail(id, season, episode, conditions={})
7
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}")
5
+ # Get the primary information about a TV episode by combination of a season and episode number.
6
+ def self.detail(id, season, episode, conditions = {})
7
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/season/#{endpoint_id + season.to_s}/#{endpoints[:singular]}/#{endpoint_id + episode.to_s}")
8
8
  search.filter(conditions)
9
9
  search.fetch_response
10
10
  end
11
11
 
12
- #Get the TV episode cast credits by combination of season and episode number.
13
- def self.cast(id, season, episode, conditions={})
14
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/credits")
12
+ # Get the TV episode cast credits by combination of season and episode number.
13
+ def self.cast(id, season, episode, _conditions = {})
14
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/season/#{endpoint_id + season.to_s}/#{endpoints[:singular]}/#{endpoint_id + episode.to_s}/credits")
15
15
  search.fetch_response['cast']
16
16
  end
17
17
 
18
- #Get the TV episode crew credits by combination of season and episode number.
19
- def self.crew(id, season, episode, conditions={})
20
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/credits")
18
+ # Get the TV episode crew credits by combination of season and episode number.
19
+ def self.crew(id, season, episode, _conditions = {})
20
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/season/#{endpoint_id + season.to_s}/#{endpoints[:singular]}/#{endpoint_id + episode.to_s}/credits")
21
21
  search.fetch_response['crew']
22
22
  end
23
23
 
24
- #Get the external ids for a TV episode by comabination of a season and episode number.
25
- def self.external_ids(id, season, episode, conditions={})
26
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/external_ids")
24
+ # Get the external ids for a TV episode by comabination of a season and episode number.
25
+ def self.external_ids(id, season, episode, _conditions = {})
26
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/season/#{endpoint_id + season.to_s}/#{endpoints[:singular]}/#{endpoint_id + episode.to_s}/external_ids")
27
27
  search.fetch_response
28
28
  end
29
29
 
30
- #Get the images (episode stills) for a TV episode by combination of a season and episode number.
31
- def self.images(id, season, episode, conditions={})
32
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/season/#{self.endpoint_id + season.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + episode.to_s}/images")
30
+ # Get the images (episode stills) for a TV episode by combination of a season and episode number.
31
+ def self.images(id, season, episode, _conditions = {})
32
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/season/#{endpoint_id + season.to_s}/#{endpoints[:singular]}/#{endpoint_id + episode.to_s}/images")
33
33
  search.fetch_response
34
34
  end
35
-
36
35
  end
37
36
  end
@@ -2,30 +2,29 @@ module Tmdb
2
2
  class Find < Resource
3
3
  has_resource 'find'
4
4
 
5
- def self.imdb_id(id, conditions={})
6
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
5
+ def self.imdb_id(id, _conditions = {})
6
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
7
7
  search.fetch_response(external_source: 'imdb_id')
8
8
  end
9
9
 
10
- def self.freebase_mid(id, conditions={})
11
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
10
+ def self.freebase_mid(id, _conditions = {})
11
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
12
12
  search.fetch_response(external_source: 'freebase_mid')
13
13
  end
14
14
 
15
- def self.freebase_id(id, conditions={})
16
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
15
+ def self.freebase_id(id, _conditions = {})
16
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
17
17
  search.fetch_response(external_source: 'freebase_id')
18
18
  end
19
19
 
20
- def self.tvrage_id(id, conditions={})
21
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
20
+ def self.tvrage_id(id, _conditions = {})
21
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
22
22
  search.fetch_response(external_source: 'tvrage_id')
23
23
  end
24
24
 
25
- def self.tvdb_id(id, conditions={})
26
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
25
+ def self.tvdb_id(id, _conditions = {})
26
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
27
27
  search.fetch_response(external_source: 'tvdb_id')
28
28
  end
29
-
30
29
  end
31
- end
30
+ end
@@ -1,63 +1,59 @@
1
1
  module Tmdb
2
- class Genre
3
- def initialize(attributes={})
2
+ class Genre
3
+ def initialize(attributes = {})
4
4
  attributes.each do |key, value|
5
- if self.respond_to?(key.to_sym)
6
- self.instance_variable_set("@#{key}", value)
5
+ instance_variable_set("@#{key}", value) if respond_to?(key.to_sym)
6
+ end
7
+ end
8
+
9
+ # http://docs.themoviedb.apiary.io/#genres
10
+ @@fields = [
11
+ :id,
12
+ :page,
13
+ :total_pages,
14
+ :total_results,
15
+ :results
16
+ ]
17
+
18
+ @@fields.each do |field|
19
+ attr_accessor field
20
+ end
21
+
22
+ def self.search(query)
23
+ detail(list['genres'].detect { |g| g['name'] == query }['id'])
24
+ end
25
+
26
+ class << self
27
+ alias find search
28
+ end
29
+
30
+ def self.list
31
+ search = Tmdb::Search.new('/genre/list')
32
+ search.fetch_response
33
+ end
34
+
35
+ def self.detail(id, conditions = {})
36
+ url = "/genre/#{id}/movies"
37
+ unless conditions.empty?
38
+ url << '?'
39
+ conditions.each_with_index do |(key, value), index|
40
+ url << "#{key}=#{value}"
41
+ url << '&' if index != conditions.length - 1
7
42
  end
8
43
  end
44
+ search = Tmdb::Search.new(url)
45
+ new(search.fetch_response)
9
46
  end
10
47
 
11
- #http://docs.themoviedb.apiary.io/#genres
12
- @@fields = [
13
- :id,
14
- :page,
15
- :total_pages,
16
- :total_results,
17
- :results
18
- ]
19
-
20
- @@fields.each do |field|
21
- attr_accessor field
22
- end
23
-
24
- def self.search(query)
25
- self.detail(self.list['genres'].detect { |g| g['name'] == query }['id'])
26
- end
27
-
28
- class << self
29
- alias_method :find, :search
30
- end
31
-
32
- def self.list
33
- search = Tmdb::Search.new("/genre/list")
34
- search.fetch_response
35
- end
36
-
37
- def self.detail(id, conditions={})
38
- url = "/genre/#{id}/movies"
39
- if !conditions.empty?
40
- url << "?"
41
- conditions.each_with_index do |(key, value), index|
42
- url << "#{key}=#{value}"
43
- if index != conditions.length - 1
44
- url << "&"
45
- end
46
- end
47
- end
48
- search = Tmdb::Search.new(url)
49
- self.new(search.fetch_response)
50
- end
51
-
52
- def name
53
- @name ||= self.class.list['genres'].detect { |g| g['id'] == @id }['name']
54
- end
55
-
56
- def get_page(page_number, conditions={})
57
- if page_number != @page and page_number > 0 and page_number <= @total_pages
58
- conditions.merge!({ :page => page_number })
59
- self.class.detail(id, conditions)
60
- end
61
- end
62
- end
63
- end
48
+ def name
49
+ @name ||= self.class.list['genres'].detect { |g| g['id'] == @id }['name']
50
+ end
51
+
52
+ def get_page(page_number, conditions = {})
53
+ if page_number != @page && page_number > 0 && page_number <= @total_pages
54
+ conditions[:page] = page_number
55
+ self.class.detail(id, conditions)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,10 +1,8 @@
1
1
  module Tmdb
2
2
  class Job
3
- def initialize(attributes={})
3
+ def initialize(attributes = {})
4
4
  attributes.each do |key, value|
5
- if self.respond_to?(key.to_sym)
6
- self.instance_variable_set("@#{key}", value)
7
- end
5
+ instance_variable_set("@#{key}", value) if respond_to?(key.to_sym)
8
6
  end
9
7
  end
10
8
 
@@ -19,7 +17,7 @@ module Tmdb
19
17
  end
20
18
 
21
19
  def self.list
22
- search = Tmdb::Search.new("/job/list")
20
+ search = Tmdb::Search.new('/job/list')
23
21
  search.fetch_response
24
22
  end
25
23
  end
@@ -1,8 +1,8 @@
1
1
  module Tmdb
2
2
  class Movie < Resource
3
- has_resource 'movie', :plural => 'movies'
3
+ has_resource 'movie', plural: 'movies'
4
4
 
5
- #http://docs.themoviedb.apiary.io/#movies
5
+ # http://docs.themoviedb.apiary.io/#movies
6
6
  @@fields = [
7
7
  :adult,
8
8
  :backdrop_path,
@@ -43,119 +43,118 @@ module Tmdb
43
43
  attr_accessor field
44
44
  end
45
45
 
46
- #Get the latest movie id. singular
46
+ # Get the latest movie id. singular
47
47
  def self.latest
48
- search = Tmdb::Search.new("/movie/latest")
49
- search.fetch_response
48
+ search = Tmdb::Search.new('/movie/latest')
49
+ new(search.fetch_response)
50
50
  end
51
51
 
52
- #Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.
52
+ # Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100.
53
53
  def self.upcoming
54
- search = Tmdb::Search.new("/movie/upcoming")
55
- search.fetch
54
+ search = Tmdb::Search.new('/movie/upcoming')
55
+ search.fetch.collect { |result| new(result) }
56
56
  end
57
57
 
58
- #Get the list of movies playing in theatres. This list refreshes every day. The maximum number of items this list will include is 100.
58
+ # Get the list of movies playing in theatres. This list refreshes every day. The maximum number of items this list will include is 100.
59
59
  def self.now_playing
60
- search = Tmdb::Search.new("/movie/now_playing")
61
- search.fetch
60
+ search = Tmdb::Search.new('/movie/now_playing')
61
+ search.fetch.collect { |result| new(result) }
62
62
  end
63
63
 
64
- #Get the list of popular movies on The Movie Database. This list refreshes every day.
64
+ # Get the list of popular movies on The Movie Database. This list refreshes every day.
65
65
  def self.popular
66
- search = Tmdb::Search.new("/movie/popular")
67
- search.fetch
66
+ search = Tmdb::Search.new('/movie/popular')
67
+ search.fetch.collect { |result| new(result) }
68
68
  end
69
69
 
70
- #Get the list of top rated movies. By default, this list will only include movies that have 10 or more votes. This list refreshes every day.
70
+ # Get the list of top rated movies. By default, this list will only include movies that have 10 or more votes. This list refreshes every day.
71
71
  def self.top_rated
72
- search = Tmdb::Search.new("/movie/top_rated")
73
- search.fetch
72
+ search = Tmdb::Search.new('/movie/top_rated')
73
+ search.fetch.collect { |result| new(result) }
74
74
  end
75
75
 
76
- #Discover movies by different types of data like average rating, number of votes, genres and certifications.
77
- def self.discover(conditions={})
78
- search = Tmdb::Search.new("/discover/movie")
76
+ # Discover movies by different types of data like average rating, number of votes, genres and certifications.
77
+ def self.discover(conditions = {})
78
+ search = Tmdb::Search.new('/discover/movie')
79
79
  search.filter(conditions)
80
- search.fetch
80
+ search.fetch.collect { |result| new(result) }
81
81
  end
82
82
 
83
- #Get the alternative titles for a specific movie id.
84
- def self.alternative_titles(id, conditions={})
85
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/alternative_titles")
83
+ # Get the alternative titles for a specific movie id.
84
+ def self.alternative_titles(id, _conditions = {})
85
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/alternative_titles")
86
86
  search.fetch_response
87
87
  end
88
88
 
89
- #Get the cast information for a specific movie id.
90
- def self.casts(id, conditions={})
91
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/casts")
89
+ # Get the cast information for a specific movie id.
90
+ def self.casts(id, _conditions = {})
91
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/casts")
92
92
  search.fetch_response['cast']
93
93
  end
94
94
 
95
- #Get the cast information for a specific movie id.
96
- def self.crew(id, conditions={})
97
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/casts")
95
+ # Get the cast information for a specific movie id.
96
+ def self.crew(id, _conditions = {})
97
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/casts")
98
98
  search.fetch_response['crew']
99
99
  end
100
100
 
101
- #Get the images (posters and backdrops) for a specific movie id.
102
- def self.images(id, conditions={})
103
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/images")
101
+ # Get the images (posters and backdrops) for a specific movie id.
102
+ def self.images(id, _conditions = {})
103
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
104
104
  search.fetch_response
105
105
  end
106
106
 
107
- #Get the plot keywords for a specific movie id.
108
- def self.keywords(id, conditions={})
109
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/keywords")
107
+ # Get the plot keywords for a specific movie id.
108
+ def self.keywords(id, _conditions = {})
109
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/keywords")
110
110
  search.fetch_response
111
111
  end
112
112
 
113
- #Get the release date by country for a specific movie id.
114
- def self.releases(id, conditions={})
115
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/releases")
113
+ # Get the release date by country for a specific movie id.
114
+ def self.releases(id, _conditions = {})
115
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/releases")
116
116
  search.fetch_response
117
117
  end
118
118
 
119
- #Get the trailers for a specific movie id.
120
- def self.trailers(id, conditions={})
121
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/trailers")
119
+ # Get the trailers for a specific movie id.
120
+ def self.trailers(id, _conditions = {})
121
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/trailers")
122
122
  search.fetch_response
123
123
  end
124
124
 
125
- #Get the translations for a specific movie id.
126
- def self.translations(id, conditions={})
127
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/translations")
125
+ # Get the translations for a specific movie id.
126
+ def self.translations(id, _conditions = {})
127
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/translations")
128
128
  search.fetch_response
129
129
  end
130
130
 
131
- #Get the similar movies for a specific movie id.
132
- def self.similar_movies(id, conditions={})
133
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/similar_movies")
131
+ # Get the similar movies for a specific movie id.
132
+ def self.similar_movies(id, conditions = {})
133
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/similar_movies")
134
134
  search.filter(conditions)
135
- search.fetch
135
+ search.fetch.collect { |result| new(result) }
136
136
  end
137
137
 
138
- #Get the lists that the movie belongs to.
139
- def self.lists(id, conditions={})
140
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/lists")
138
+ # Get the lists that the movie belongs to.
139
+ def self.lists(id, _conditions = {})
140
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/lists")
141
141
  search.fetch_response
142
142
  end
143
143
 
144
- #Get the changes for a specific movie id.
145
- #Changes are grouped by key, and ordered by date in descending order.
146
- #By default, only the last 24 hours of changes are returned.
147
- #The maximum number of days that can be returned in a single request is 14.
148
- #The language is present on fields that are translatable.
149
- def self.changes(id, conditions={})
150
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/changes")
144
+ # Get the changes for a specific movie id.
145
+ # Changes are grouped by key, and ordered by date in descending order.
146
+ # By default, only the last 24 hours of changes are returned.
147
+ # The maximum number of days that can be returned in a single request is 14.
148
+ # The language is present on fields that are translatable.
149
+ def self.changes(id, _conditions = {})
150
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/changes")
151
151
  search.fetch_response
152
152
  end
153
153
 
154
- #Get the credits for a specific movie id.
155
- def self.credits(id, conditions={})
156
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
154
+ # Get the credits for a specific movie id.
155
+ def self.credits(id, _conditions = {})
156
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/credits")
157
157
  search.fetch_response
158
158
  end
159
-
160
159
  end
161
160
  end