themoviedb 0.1.0 → 1.0.0
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 +459 -0
- data/lib/themoviedb.rb +4 -5
- data/lib/themoviedb/api.rb +4 -5
- data/lib/themoviedb/collection.rb +6 -7
- data/lib/themoviedb/company.rb +7 -8
- data/lib/themoviedb/configuration.rb +2 -2
- data/lib/themoviedb/episode.rb +16 -17
- data/lib/themoviedb/find.rb +11 -12
- data/lib/themoviedb/genre.rb +53 -57
- data/lib/themoviedb/job.rb +3 -5
- data/lib/themoviedb/movie.rb +62 -63
- data/lib/themoviedb/person.rb +37 -33
- data/lib/themoviedb/resource.rb +19 -21
- data/lib/themoviedb/search.rb +30 -30
- data/lib/themoviedb/season.rb +16 -17
- data/lib/themoviedb/tv.rb +24 -25
- data/lib/themoviedb/version.rb +2 -1
- data/spec/company_spec.rb +31 -36
- data/spec/find_spec.rb +10 -13
- data/spec/movie_spec.rb +124 -129
- data/spec/person_spec.rb +53 -53
- data/spec/spec/vcr/find/search_imdb.yml +39 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/tv_spec.rb +196 -217
- data/spec/vcr/company/detail.yml +67 -0
- data/spec/vcr/company/movies.yml +98 -0
- data/spec/vcr/find/search_imdb.yml +50 -0
- data/spec/vcr/find/search_tvdb.yml +52 -0
- data/spec/vcr/movie/alternative_titles_for_id.yml +69 -0
- data/spec/vcr/movie/cast_information_for_id.yml +109 -0
- data/spec/vcr/movie/changes_made.yml +60 -0
- data/spec/vcr/movie/credits_for_id.yml +99 -0
- data/spec/vcr/movie/crew_for_id.yml +109 -0
- data/spec/vcr/movie/detail.yml +93 -0
- data/spec/vcr/movie/detail_with_appended_response.yml +254 -0
- data/spec/vcr/movie/images.yml +62 -0
- data/spec/vcr/movie/keywords_for_id.yml +62 -0
- data/spec/vcr/movie/language_german.yml +112 -0
- data/spec/vcr/movie/movie_belongs_for_id.yml +89 -0
- data/spec/vcr/movie/now_playing.yml +90 -0
- data/spec/vcr/movie/popular.yml +96 -0
- data/spec/vcr/movie/releases_for_id.yml +60 -0
- data/spec/vcr/movie/return_latest_movie.yml +62 -0
- data/spec/vcr/movie/return_upcoming_movie.yml +186 -0
- data/spec/vcr/movie/similar_for_id.yml +180 -0
- data/spec/vcr/movie/top_rated.yml +190 -0
- data/spec/vcr/movie/trailers_for_id.yml +60 -0
- data/spec/vcr/movie/translations_for_id.yml +76 -0
- data/spec/vcr/person/changes.yml +50 -0
- data/spec/vcr/person/credits.yml +459 -0
- data/spec/vcr/person/detail.yml +65 -0
- data/spec/vcr/person/detail_with_appended_response.yml +762 -0
- data/spec/vcr/person/images.yml +50 -0
- data/spec/vcr/person/latest.yml +51 -0
- data/spec/vcr/person/popular.yml +125 -0
- data/spec/vcr/tv/cast.yml +74 -0
- data/spec/vcr/tv/crew.yml +74 -0
- data/spec/vcr/tv/detail.yml +63 -0
- data/spec/vcr/tv/detail_with_appeded_response.yml +76 -0
- data/spec/vcr/tv/external_ids.yml +60 -0
- data/spec/vcr/tv/images.yml +121 -0
- data/spec/vcr/tv/popular.yml +96 -0
- data/spec/vcr/tv/test_chuck.yml +52 -0
- data/spec/vcr/tv/top_rated.yml +84 -0
- data/themoviedb.gemspec +10 -35
- metadata +94 -9
data/lib/themoviedb/person.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Tmdb
|
2
2
|
class Person < Resource
|
3
|
-
has_resource 'person', :
|
3
|
+
has_resource 'person', plural: 'people'
|
4
4
|
|
5
|
-
#http://docs.themoviedb.apiary.io/#people
|
5
|
+
# http://docs.themoviedb.apiary.io/#people
|
6
6
|
@@fields = [
|
7
7
|
:adult,
|
8
8
|
:also_known_as,
|
@@ -11,6 +11,7 @@ module Tmdb
|
|
11
11
|
:deathday,
|
12
12
|
:homepage,
|
13
13
|
:id,
|
14
|
+
:known_for,
|
14
15
|
:name,
|
15
16
|
:place_of_birth,
|
16
17
|
:profile_path,
|
@@ -25,62 +26,65 @@ module Tmdb
|
|
25
26
|
attr_accessor field
|
26
27
|
end
|
27
28
|
|
28
|
-
#Get the list of popular people on The Movie Database. This list refreshes every day.
|
29
|
+
# Get the list of popular people on The Movie Database. This list refreshes every day.
|
29
30
|
def self.popular
|
30
|
-
search = Tmdb::Search.new("/#{
|
31
|
-
search.fetch
|
31
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/popular")
|
32
|
+
search.fetch.collect do |result|
|
33
|
+
next unless result['known_for']
|
34
|
+
result['known_for'] = result['known_for'].collect { |movie| Tmdb::Movie.new(movie) }
|
35
|
+
new(result)
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
|
-
#Get the latest person id.
|
39
|
+
# Get the latest person id.
|
35
40
|
def self.latest
|
36
|
-
search = Tmdb::Search.new("/#{
|
37
|
-
search.fetch_response
|
41
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/latest")
|
42
|
+
person = new(search.fetch_response)
|
38
43
|
end
|
39
44
|
|
40
|
-
#Get the combined credits for a specific person id.
|
41
|
-
def self.credits(id,
|
42
|
-
search = Tmdb::Search.new("/#{
|
45
|
+
# Get the combined credits for a specific person id.
|
46
|
+
def self.credits(id, _conditions = {})
|
47
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/combined_credits")
|
43
48
|
search.fetch_response
|
44
49
|
end
|
45
50
|
|
46
|
-
#Get film credits for a specific person id.
|
47
|
-
def self.movie_credits(id,
|
48
|
-
search = Tmdb::Search.new("/#{
|
51
|
+
# Get film credits for a specific person id.
|
52
|
+
def self.movie_credits(id, _conditions = {})
|
53
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/movie_credits")
|
49
54
|
search.fetch_response
|
50
55
|
end
|
51
56
|
|
52
|
-
#Get TV credits for a specific person id.
|
53
|
-
def self.tv_credits(id,
|
54
|
-
search = Tmdb::Search.new("/#{
|
57
|
+
# Get TV credits for a specific person id.
|
58
|
+
def self.tv_credits(id, _conditions = {})
|
59
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/tv_credits")
|
55
60
|
search.fetch_response
|
56
61
|
end
|
57
62
|
|
58
|
-
#Get external ID's for a specific person id.
|
59
|
-
def self.external_ids(id,
|
60
|
-
search = Tmdb::Search.new("/#{
|
63
|
+
# Get external ID's for a specific person id.
|
64
|
+
def self.external_ids(id, _conditions = {})
|
65
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/external_ids")
|
61
66
|
search.fetch_response
|
62
67
|
end
|
63
68
|
|
64
|
-
#Get the images for a specific person id.
|
65
|
-
def self.images(id,
|
66
|
-
search = Tmdb::Search.new("/#{
|
69
|
+
# Get the images for a specific person id.
|
70
|
+
def self.images(id, _conditions = {})
|
71
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
|
67
72
|
search.fetch_response
|
68
73
|
end
|
69
74
|
|
70
|
-
#Get the tagged images for a specific person id.
|
71
|
-
def self.tagged_images(id,
|
72
|
-
search = Tmdb::Search.new("/#{
|
75
|
+
# Get the tagged images for a specific person id.
|
76
|
+
def self.tagged_images(id, _conditions = {})
|
77
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/tagged_images")
|
73
78
|
search.fetch_response
|
74
79
|
end
|
75
80
|
|
76
|
-
#Get the changes for a specific person id.
|
77
|
-
#Changes are grouped by key, and ordered by date in descending order.
|
78
|
-
#By default, only the last 24 hours of changes are returned.
|
79
|
-
#The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
|
80
|
-
def self.changes(id,
|
81
|
-
search = Tmdb::Search.new("/#{
|
81
|
+
# Get the changes for a specific person id.
|
82
|
+
# Changes are grouped by key, and ordered by date in descending order.
|
83
|
+
# By default, only the last 24 hours of changes are returned.
|
84
|
+
# The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
|
85
|
+
def self.changes(id, _conditions = {})
|
86
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/changes")
|
82
87
|
search.fetch_response
|
83
88
|
end
|
84
|
-
|
85
89
|
end
|
86
90
|
end
|
data/lib/themoviedb/resource.rb
CHANGED
@@ -3,56 +3,54 @@ module Tmdb
|
|
3
3
|
@@endpoints = {}
|
4
4
|
@@endpoint_id = {}
|
5
5
|
|
6
|
-
def self.has_resource(singular=nil, opts={})
|
7
|
-
@@endpoints[
|
8
|
-
:
|
9
|
-
:
|
6
|
+
def self.has_resource(singular = nil, opts = {})
|
7
|
+
@@endpoints[name.downcase] = {
|
8
|
+
singular: singular.nil? ? name.downcase.to_s : singular,
|
9
|
+
plural: opts[:plural].nil? ? "#{name.downcase}s" : opts[:plural]
|
10
10
|
}
|
11
|
-
@@endpoint_id[
|
11
|
+
@@endpoint_id[name.downcase] = opts[:id].nil? ? '' : "#{opts[:id]}-"
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.endpoints
|
15
|
-
@@endpoints[
|
15
|
+
@@endpoints[name.downcase]
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.endpoint_id
|
19
|
-
@@endpoint_id[
|
19
|
+
@@endpoint_id[name.downcase]
|
20
20
|
end
|
21
21
|
|
22
|
-
#Get the basic resource information for a specific id.
|
23
|
-
def self.detail(id, conditions={})
|
24
|
-
search = Tmdb::Search.new("/#{
|
22
|
+
# Get the basic resource information for a specific id.
|
23
|
+
def self.detail(id, conditions = {})
|
24
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
|
25
25
|
search.filter(conditions)
|
26
26
|
search.fetch_response
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.list(conditions={})
|
30
|
-
search = Tmdb::Search.new("/#{
|
29
|
+
def self.list(conditions = {})
|
30
|
+
search = Tmdb::Search.new("/#{endpoints[:plural]}")
|
31
31
|
search.filter(conditions)
|
32
32
|
search.fetch.collect do |result|
|
33
|
-
|
33
|
+
new(result)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.search(query)
|
38
38
|
search = Tmdb::Search.new
|
39
|
-
search.resource(
|
39
|
+
search.resource(endpoints[:singular].to_s)
|
40
40
|
search.query(query)
|
41
41
|
search.fetch.collect do |result|
|
42
|
-
|
42
|
+
new(result)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
class << self
|
47
|
-
|
47
|
+
alias find search
|
48
48
|
end
|
49
49
|
|
50
|
-
def initialize(attributes={})
|
50
|
+
def initialize(attributes = {})
|
51
51
|
attributes.each do |key, value|
|
52
|
-
if
|
53
|
-
self.instance_variable_set("@#{key}", value)
|
54
|
-
end
|
52
|
+
instance_variable_set("@#{key}", value) if respond_to?(key.to_sym)
|
55
53
|
end
|
56
54
|
end
|
57
55
|
end
|
58
|
-
end
|
56
|
+
end
|
data/lib/themoviedb/search.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
module Tmdb
|
2
2
|
class Search
|
3
|
-
def initialize(resource=nil)
|
3
|
+
def initialize(resource = nil)
|
4
4
|
@params = {}
|
5
5
|
@resource = resource.nil? ? '/search/movie' : resource
|
6
6
|
self
|
7
7
|
end
|
8
8
|
|
9
9
|
def query(query)
|
10
|
-
@params[:query] =
|
10
|
+
@params[:query] = query.to_s
|
11
11
|
self
|
12
12
|
end
|
13
13
|
|
14
14
|
def year(year)
|
15
|
-
@params[:year] =
|
15
|
+
@params[:year] = year.to_s
|
16
16
|
self
|
17
17
|
end
|
18
18
|
|
19
19
|
def primary_realease_year(year)
|
20
|
-
@params[:primary_release_year] =
|
20
|
+
@params[:primary_release_year] = year.to_s
|
21
21
|
self
|
22
22
|
end
|
23
23
|
|
24
24
|
def resource(resource)
|
25
25
|
@resource = case resource
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
26
|
+
when 'movie'
|
27
|
+
'/search/movie'
|
28
|
+
when 'collection'
|
29
|
+
'/search/collection'
|
30
|
+
when 'tv'
|
31
|
+
'/search/tv'
|
32
|
+
when 'person'
|
33
|
+
'/search/person'
|
34
|
+
when 'list'
|
35
|
+
'/search/list'
|
36
|
+
when 'company'
|
37
|
+
'/search/company'
|
38
|
+
when 'keyword'
|
39
|
+
'/search/keyword'
|
40
|
+
when 'find'
|
41
|
+
'/find'
|
42
42
|
end
|
43
43
|
self
|
44
44
|
end
|
@@ -46,8 +46,8 @@ module Tmdb
|
|
46
46
|
def filter(conditions)
|
47
47
|
if conditions
|
48
48
|
conditions.each do |key, value|
|
49
|
-
if
|
50
|
-
|
49
|
+
if respond_to?(key)
|
50
|
+
send(key, value)
|
51
51
|
else
|
52
52
|
@params[key] = value
|
53
53
|
end
|
@@ -55,25 +55,25 @@ module Tmdb
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
#Sends back main data
|
58
|
+
# Sends back main data
|
59
59
|
def fetch
|
60
60
|
fetch_response['results']
|
61
61
|
end
|
62
62
|
|
63
|
-
#Send back whole response
|
64
|
-
def fetch_response(conditions={})
|
63
|
+
# Send back whole response
|
64
|
+
def fetch_response(conditions = {})
|
65
65
|
if conditions[:external_source]
|
66
|
-
options = @params.merge(Api.config.merge({external_source: conditions[:external_source]}))
|
66
|
+
options = @params.merge(Api.config.merge({ external_source: conditions[:external_source] }))
|
67
67
|
else
|
68
68
|
options = @params.merge(Api.config)
|
69
69
|
end
|
70
|
-
response = Api.get(@resource, :
|
70
|
+
response = Api.get(@resource, query: options)
|
71
71
|
|
72
72
|
original_etag = response.headers.fetch('etag', '')
|
73
|
-
etag = original_etag.
|
73
|
+
etag = original_etag.delete('"')
|
74
74
|
|
75
|
-
Api.set_response(
|
76
|
-
|
75
|
+
Api.set_response('code' => response.code, 'etag' => etag)
|
76
|
+
response.to_hash
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/lib/themoviedb/season.rb
CHANGED
@@ -1,37 +1,36 @@
|
|
1
1
|
module Tmdb
|
2
2
|
class Season < Resource
|
3
|
-
has_resource 'season', :
|
3
|
+
has_resource 'season', plural: 'seasons'
|
4
4
|
|
5
|
-
#Get the primary information about a TV season by its season number.
|
6
|
-
def self.detail(id, season, conditions={})
|
7
|
-
search = Tmdb::Search.new("/tv/#{
|
5
|
+
# Get the primary information about a TV season by its season number.
|
6
|
+
def self.detail(id, season, conditions = {})
|
7
|
+
search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}")
|
8
8
|
search.filter(conditions)
|
9
9
|
search.fetch_response
|
10
10
|
end
|
11
11
|
|
12
|
-
#Get the cast credits for a TV season by season number.
|
13
|
-
def self.cast(id, season,
|
14
|
-
search = Tmdb::Search.new("/tv/#{
|
12
|
+
# Get the cast credits for a TV season by season number.
|
13
|
+
def self.cast(id, season, _conditions = {})
|
14
|
+
search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/credits")
|
15
15
|
search.fetch_response['cast']
|
16
16
|
end
|
17
17
|
|
18
|
-
#Get the crew credits for a TV season by season number.
|
19
|
-
def self.crew(id, season,
|
20
|
-
search = Tmdb::Search.new("/tv/#{
|
18
|
+
# Get the crew credits for a TV season by season number.
|
19
|
+
def self.crew(id, season, _conditions = {})
|
20
|
+
search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/credits")
|
21
21
|
search.fetch_response['crew']
|
22
22
|
end
|
23
23
|
|
24
|
-
#Get the external ids that we have stored for a TV season by season number.
|
25
|
-
def self.external_ids(id, season,
|
26
|
-
search = Tmdb::Search.new("/tv/#{
|
24
|
+
# Get the external ids that we have stored for a TV season by season number.
|
25
|
+
def self.external_ids(id, season, _conditions = {})
|
26
|
+
search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/external_ids")
|
27
27
|
search.fetch_response
|
28
28
|
end
|
29
29
|
|
30
|
-
#Get the images (posters) that we have stored for a TV season by season number.
|
31
|
-
def self.images(id, season,
|
32
|
-
search = Tmdb::Search.new("/tv/#{
|
30
|
+
# Get the images (posters) that we have stored for a TV season by season number.
|
31
|
+
def self.images(id, season, _conditions = {})
|
32
|
+
search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/images")
|
33
33
|
search.fetch_response
|
34
34
|
end
|
35
|
-
|
36
35
|
end
|
37
36
|
end
|
data/lib/themoviedb/tv.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Tmdb
|
2
2
|
class TV < Resource
|
3
|
-
has_resource 'tv', :
|
3
|
+
has_resource 'tv', plural: 'tv'
|
4
4
|
|
5
|
-
#http://docs.themoviedb.apiary.io/#tv
|
5
|
+
# http://docs.themoviedb.apiary.io/#tv
|
6
6
|
@@fields = [
|
7
7
|
:backdrop_path,
|
8
8
|
:created_by,
|
@@ -35,48 +35,47 @@ module Tmdb
|
|
35
35
|
attr_accessor field
|
36
36
|
end
|
37
37
|
|
38
|
-
#Get the list of popular TV shows. This list refreshes every day.
|
38
|
+
# Get the list of popular TV shows. This list refreshes every day.
|
39
39
|
def self.popular
|
40
|
-
search = Tmdb::Search.new(
|
41
|
-
search.fetch
|
40
|
+
search = Tmdb::Search.new('/tv/popular')
|
41
|
+
search.fetch.collect { |result| new(result) }
|
42
42
|
end
|
43
43
|
|
44
|
-
#Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.
|
44
|
+
# Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.
|
45
45
|
def self.top_rated
|
46
|
-
search = Tmdb::Search.new(
|
47
|
-
search.fetch
|
46
|
+
search = Tmdb::Search.new('/tv/top_rated')
|
47
|
+
search.fetch.collect { |result| new(result) }
|
48
48
|
end
|
49
49
|
|
50
|
-
#Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates
|
51
|
-
def self.discover(conditions={})
|
52
|
-
search = Tmdb::Search.new(
|
50
|
+
# Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates
|
51
|
+
def self.discover(conditions = {})
|
52
|
+
search = Tmdb::Search.new('/discover/tv')
|
53
53
|
search.filter(conditions)
|
54
|
-
search.fetch
|
54
|
+
search.fetch.collect { |result| new(result) }
|
55
55
|
end
|
56
56
|
|
57
|
-
#Get the cast information about a TV series.
|
58
|
-
def self.cast(id,
|
59
|
-
search = Tmdb::Search.new("/#{
|
57
|
+
# Get the cast information about a TV series.
|
58
|
+
def self.cast(id, _conditions = {})
|
59
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/credits")
|
60
60
|
search.fetch_response['cast']
|
61
61
|
end
|
62
62
|
|
63
|
-
#Get the crew information about a TV series.
|
64
|
-
def self.crew(id,
|
65
|
-
search = Tmdb::Search.new("/#{
|
63
|
+
# Get the crew information about a TV series.
|
64
|
+
def self.crew(id, _conditions = {})
|
65
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/credits")
|
66
66
|
search.fetch_response['crew']
|
67
67
|
end
|
68
68
|
|
69
|
-
#Get the external ids that we have stored for a TV series.
|
70
|
-
def self.external_ids(id,
|
71
|
-
search = Tmdb::Search.new("/#{
|
69
|
+
# Get the external ids that we have stored for a TV series.
|
70
|
+
def self.external_ids(id, _conditions = {})
|
71
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/external_ids")
|
72
72
|
search.fetch_response
|
73
73
|
end
|
74
74
|
|
75
|
-
#Get the images (posters and backdrops) for a TV series.
|
76
|
-
def self.images(id,
|
77
|
-
search = Tmdb::Search.new("/#{
|
75
|
+
# Get the images (posters and backdrops) for a TV series.
|
76
|
+
def self.images(id, _conditions = {})
|
77
|
+
search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
|
78
78
|
search.fetch_response
|
79
79
|
end
|
80
|
-
|
81
80
|
end
|
82
81
|
end
|
data/lib/themoviedb/version.rb
CHANGED
data/spec/company_spec.rb
CHANGED
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
require 'vcr'
|
4
4
|
|
5
5
|
describe Tmdb::Company do
|
6
|
-
|
7
6
|
@fields = [
|
8
7
|
:description,
|
9
8
|
:headquarters,
|
@@ -18,41 +17,39 @@ describe Tmdb::Company do
|
|
18
17
|
it { should respond_to field }
|
19
18
|
end
|
20
19
|
|
21
|
-
describe
|
22
|
-
|
20
|
+
describe 'For a company detail' do
|
23
21
|
before(:each) do
|
24
22
|
VCR.use_cassette 'company/detail' do
|
25
23
|
@company = Tmdb::Company.detail(5)
|
26
24
|
end
|
27
25
|
end
|
28
26
|
|
29
|
-
it
|
30
|
-
@company['id'].
|
27
|
+
it 'should return a id' do
|
28
|
+
expect(@company['id']).to eq(5)
|
31
29
|
end
|
32
30
|
|
33
|
-
it
|
34
|
-
@company['description'].
|
31
|
+
it 'should have a description' do
|
32
|
+
expect(@company['description']).to eq("Columbia Pictures Industries, Inc. (CPII) is an American film production and distribution company. Columbia Pictures now forms part of the Columbia TriStar Motion Picture Group, owned by Sony Pictures Entertainment, a subsidiary of the Japanese conglomerate Sony. It is one of the leading film companies in the world, a member of the so-called Big Six. It was one of the so-called Little Three among the eight major film studios of Hollywood's Golden Age.")
|
35
33
|
end
|
36
34
|
|
37
|
-
it
|
38
|
-
@company['homepage'].
|
35
|
+
it 'should have a homepage' do
|
36
|
+
expect(@company['homepage']).to eq('http://www.sonypictures.com/')
|
39
37
|
end
|
40
38
|
|
41
|
-
it
|
42
|
-
@company['logo_path'].
|
39
|
+
it 'should have logo' do
|
40
|
+
expect(@company['logo_path']).to eq('/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png')
|
43
41
|
end
|
44
42
|
|
45
|
-
it
|
46
|
-
@company['name'].
|
43
|
+
it 'should have a name' do
|
44
|
+
expect(@company['name']).to eq('Columbia Pictures')
|
47
45
|
end
|
48
46
|
|
49
|
-
it
|
50
|
-
@company['parent_company'][
|
47
|
+
it 'could have a parent company' do
|
48
|
+
expect(@company['parent_company']['name']).to eq('Sony Pictures Entertainment')
|
51
49
|
end
|
52
|
-
|
53
50
|
end
|
54
51
|
|
55
|
-
describe
|
52
|
+
describe 'For a company movies' do
|
56
53
|
before(:each) do
|
57
54
|
VCR.use_cassette 'company/movies' do
|
58
55
|
@movies = Tmdb::Company.movies(5)
|
@@ -60,38 +57,36 @@ describe Tmdb::Company do
|
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
63
|
-
it
|
64
|
-
@movies.count.
|
60
|
+
it 'should give back multiple movies' do
|
61
|
+
expect(@movies.count).to be > 1
|
65
62
|
end
|
66
63
|
|
67
|
-
it
|
68
|
-
@movie
|
64
|
+
it 'should have a id' do
|
65
|
+
expect(@movie.id).to eq(97_020)
|
69
66
|
end
|
70
67
|
|
71
|
-
it
|
72
|
-
@movie
|
68
|
+
it 'should have a title' do
|
69
|
+
expect(@movie.title).to eq('RoboCop')
|
73
70
|
end
|
74
71
|
|
75
|
-
it
|
76
|
-
@movie
|
72
|
+
it 'should have a original title' do
|
73
|
+
expect(@movie.original_title).to eq('RoboCop')
|
77
74
|
end
|
78
75
|
|
79
|
-
it
|
80
|
-
@movie
|
76
|
+
it 'should have a poster' do
|
77
|
+
expect(@movie.poster_path).to eq('/xxLhczZMiJt1iRdhfkVkuMu87si.jpg')
|
81
78
|
end
|
82
79
|
|
83
|
-
it
|
84
|
-
@movie
|
80
|
+
it 'should have a popularity rating' do
|
81
|
+
expect(@movie.popularity).to eq(3.13451193740971)
|
85
82
|
end
|
86
83
|
|
87
|
-
it
|
88
|
-
@movie
|
84
|
+
it 'should show whether it is an adult movie' do
|
85
|
+
expect(@movie.adult).to eq(false)
|
89
86
|
end
|
90
87
|
|
91
|
-
it
|
92
|
-
@movie
|
88
|
+
it 'should have a release date' do
|
89
|
+
expect(@movie.release_date).to eq('2014-02-07')
|
93
90
|
end
|
94
|
-
|
95
91
|
end
|
96
|
-
|
97
|
-
end
|
92
|
+
end
|