themoviedb 0.0.11 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/themoviedb.rb +2 -2
- data/lib/themoviedb/find.rb +31 -0
- data/lib/themoviedb/movie.rb +7 -0
- data/lib/themoviedb/search.rb +11 -2
- data/lib/themoviedb/tv.rb +7 -0
- data/spec/company_spec.rb +97 -0
- data/spec/find_spec.rb +31 -0
- data/spec/tv_spec.rb +418 -0
- data/themoviedb.gemspec +5 -2
- metadata +16 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 150958669d746edcb3042292a7bd77d49e1c4ab4
|
4
|
+
data.tar.gz: 96c536fcc8eec0f14b76bfe6e75b805d0db6799f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 837dea47313de961f14a6f722a857a486c2f86d04ca9bc73b913fbba23a95cca2c4117106addf7eb2953df2a6bd028baf150695bd89d832f54ba02ba78cc16c5
|
7
|
+
data.tar.gz: 5ccab009d5dcbf2c9b6a0fd81df2a6ae6429531f09c9cd38c6a00128f339d5524cbeb55132925a0c10c7505c526efc3c787e8b0b2f874221ba8a71b4c0a9024b
|
data/lib/themoviedb.rb
CHANGED
@@ -5,10 +5,10 @@ require 'httparty'
|
|
5
5
|
require File.join(File.dirname(__FILE__), "themoviedb", inc)
|
6
6
|
end
|
7
7
|
|
8
|
-
["movie", "tv", "season", "episode", "collection", "people", "company", "genre"].each do |inc|
|
8
|
+
["movie", "tv", "season", "episode", "collection", "people", "company", "genre", "find"].each do |inc|
|
9
9
|
require File.join(File.dirname(__FILE__), "themoviedb", inc)
|
10
10
|
end
|
11
11
|
|
12
12
|
module Tmdb
|
13
|
-
VERSION = "0.0.
|
13
|
+
VERSION = "0.0.14"
|
14
14
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Tmdb
|
2
|
+
class Find < Resource
|
3
|
+
has_resource 'find'
|
4
|
+
|
5
|
+
def self.imdb_id(id, conditions={})
|
6
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
|
7
|
+
search.fetch_response(external_source: 'imdb_id')
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.freebase_mid(id, conditions={})
|
11
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
|
12
|
+
search.fetch_response(external_source: 'freebase_mid')
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.freebase_id(id, conditions={})
|
16
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
|
17
|
+
search.fetch_response(external_source: 'freebase_id')
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.tvrage_id(id, conditions={})
|
21
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
|
22
|
+
search.fetch_response(external_source: 'tvrage_id')
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.tvdb_id(id, conditions={})
|
26
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
|
27
|
+
search.fetch_response(external_source: 'tvdb_id')
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/lib/themoviedb/movie.rb
CHANGED
@@ -63,6 +63,13 @@ module Tmdb
|
|
63
63
|
search.fetch
|
64
64
|
end
|
65
65
|
|
66
|
+
#Discover movies by different types of data like average rating, number of votes, genres and certifications.
|
67
|
+
def self.discover(conditions={})
|
68
|
+
search = Tmdb::Search.new("/discover/movie")
|
69
|
+
search.filter(conditions)
|
70
|
+
search.fetch
|
71
|
+
end
|
72
|
+
|
66
73
|
#Get the alternative titles for a specific movie id.
|
67
74
|
def self.alternative_titles(id, conditions={})
|
68
75
|
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/alternative_titles")
|
data/lib/themoviedb/search.rb
CHANGED
@@ -36,6 +36,8 @@ module Tmdb
|
|
36
36
|
@resource = '/search/company'
|
37
37
|
elsif resource == 'keyword' then
|
38
38
|
@resource = '/search/keyword'
|
39
|
+
elsif resource == 'find'
|
40
|
+
@resource = '/find'
|
39
41
|
end
|
40
42
|
self
|
41
43
|
end
|
@@ -45,6 +47,8 @@ module Tmdb
|
|
45
47
|
conditions.each do |key, value|
|
46
48
|
if self.respond_to?(key)
|
47
49
|
self.send(key, value)
|
50
|
+
else
|
51
|
+
@params[key] = value
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
@@ -56,9 +60,14 @@ module Tmdb
|
|
56
60
|
end
|
57
61
|
|
58
62
|
#Send back whole response
|
59
|
-
def fetch_response
|
60
|
-
|
63
|
+
def fetch_response(conditions={})
|
64
|
+
if conditions[:external_source]
|
65
|
+
options = @params.merge(Api.config.merge({external_source: conditions[:external_source]}))
|
66
|
+
else
|
67
|
+
options = @params.merge(Api.config)
|
68
|
+
end
|
61
69
|
response = Api.get(@resource, :query => options)
|
70
|
+
|
62
71
|
etag = response.headers['etag'].gsub /"/, ''
|
63
72
|
Api.set_response({'code' => response.code, 'etag' => etag})
|
64
73
|
response.to_hash
|
data/lib/themoviedb/tv.rb
CHANGED
@@ -45,6 +45,13 @@ module Tmdb
|
|
45
45
|
search.fetch
|
46
46
|
end
|
47
47
|
|
48
|
+
#Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates
|
49
|
+
def self.discover(conditions={})
|
50
|
+
search = Tmdb::Search.new("/discover/tv")
|
51
|
+
search.filter(conditions)
|
52
|
+
search.fetch
|
53
|
+
end
|
54
|
+
|
48
55
|
#Get the cast information about a TV series.
|
49
56
|
def self.cast(id, conditions={})
|
50
57
|
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
describe Tmdb::Company do
|
6
|
+
|
7
|
+
@fields = [
|
8
|
+
:description,
|
9
|
+
:headquarters,
|
10
|
+
:homepage,
|
11
|
+
:id,
|
12
|
+
:logo_path,
|
13
|
+
:name,
|
14
|
+
:parent_company
|
15
|
+
]
|
16
|
+
|
17
|
+
@fields.each do |field|
|
18
|
+
it { should respond_to field }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "For a company detail" do
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
VCR.use_cassette 'company/detail' do
|
25
|
+
@company = Tmdb::Company.detail(5)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return a id" do
|
30
|
+
@company.id.should eq(5)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have a description" do
|
34
|
+
@company.description.should 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
|
+
end
|
36
|
+
|
37
|
+
it "should have a homepage" do
|
38
|
+
@company.homepage.should eq("http://www.sonypictures.com/")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should have logo" do
|
42
|
+
@company.logo_path.should eq("/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should have a name" do
|
46
|
+
@company.name.should eq("Columbia Pictures")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "could have a parent company" do
|
50
|
+
@company.parent_company["name"].should eq("Sony Pictures Entertainment")
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "For a company movies" do
|
56
|
+
before(:each) do
|
57
|
+
VCR.use_cassette 'company/movies' do
|
58
|
+
@movies = Tmdb::Company.movies(5)
|
59
|
+
@movie = @movies.first
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should give back multiple movies" do
|
64
|
+
@movies.count.should > 1
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should have a id" do
|
68
|
+
@movie["id"].should eq(97020)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should have a title" do
|
72
|
+
@movie["title"].should eq("RoboCop")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should have a original title" do
|
76
|
+
@movie["original_title"].should eq("RoboCop")
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should have a poster" do
|
80
|
+
@movie["poster_path"].should eq("/xxLhczZMiJt1iRdhfkVkuMu87si.jpg")
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should have a popularity rating" do
|
84
|
+
@movie["popularity"].should eq(3.13451193740971)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should show whether it is an adult movie" do
|
88
|
+
@movie["adult"].should eq(false)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should have a release date" do
|
92
|
+
@movie["release_date"].should eq("2014-02-07")
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
data/spec/find_spec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
describe Tmdb::Find do
|
6
|
+
|
7
|
+
describe "For a search" do
|
8
|
+
before(:each) do
|
9
|
+
@find = Tmdb::Find
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return results for imdb_id" do
|
13
|
+
VCR.use_cassette 'find/search_imdb' do
|
14
|
+
find = @find.imdb_id("tt1375666")
|
15
|
+
find['movie_results'].should be_true
|
16
|
+
find['person_results'].should be_true
|
17
|
+
find['tv_results'].should be_true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return results for tvdb_id" do
|
22
|
+
VCR.use_cassette 'find/search_tvdb' do
|
23
|
+
find = @find.tvdb_id("81189")
|
24
|
+
find['tv_results'].first['name'].should == 'Breaking Bad'
|
25
|
+
find['tv_results'].should be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/tv_spec.rb
ADDED
@@ -0,0 +1,418 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
describe Tmdb::TV do
|
6
|
+
|
7
|
+
@fields = [
|
8
|
+
:backdrop_path,
|
9
|
+
:created_by,
|
10
|
+
:episode_run_time,
|
11
|
+
:first_air_date,
|
12
|
+
:genres,
|
13
|
+
:homepage,
|
14
|
+
:id,
|
15
|
+
:in_production,
|
16
|
+
:languages,
|
17
|
+
:last_air_date,
|
18
|
+
:name,
|
19
|
+
:networks,
|
20
|
+
:number_of_episodes,
|
21
|
+
:number_of_seasons,
|
22
|
+
:original_name,
|
23
|
+
:origin_country,
|
24
|
+
:overview,
|
25
|
+
:popularity,
|
26
|
+
:poster_path,
|
27
|
+
:seasons,
|
28
|
+
:status,
|
29
|
+
:vote_average,
|
30
|
+
:vote_count
|
31
|
+
]
|
32
|
+
|
33
|
+
@fields.each do |field|
|
34
|
+
it { should respond_to field }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "For a TV detail" do
|
38
|
+
|
39
|
+
before(:each) do
|
40
|
+
VCR.use_cassette 'tv/detail' do
|
41
|
+
@tv = Tmdb::TV.detail(1396)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return a id" do
|
46
|
+
@tv.id.should == 1396
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return a backdrop" do
|
50
|
+
@tv.backdrop_path.should == "/dRaV8HGx7Z9xmw77qSs8prp5OuI.jpg"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return a created date" do
|
54
|
+
@tv.created_by.should == [{"id"=>66633, "name"=>"Vince Gilligan", "profile_path"=>"/wSTvJGz7QbJf1HK2Mv1Cev6W9TV.jpg"}]
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return a run time" do
|
58
|
+
@tv.episode_run_time.should == [45, 47]
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return genres" do
|
62
|
+
@tv.genres.should == [{"id"=>18, "name"=>"Drama"}]
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return a first air date" do
|
66
|
+
@tv.first_air_date.should == "2008-01-20"
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should return a homepage" do
|
70
|
+
@tv.homepage.should == "http://www.amctv.com/shows/breaking-bad"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return a production state" do
|
74
|
+
@tv.in_production.should be_false
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should return languages" do
|
78
|
+
@tv.languages.should == ["en", "de", "ro", "es", "fa"]
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should return a last air date" do
|
82
|
+
@tv.last_air_date.should == "2013-09-29"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should return a name" do
|
86
|
+
@tv.name.should == "Breaking Bad"
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should return a network" do
|
90
|
+
@tv.networks.should == [{"id"=>174, "name"=>"AMC"}]
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should return the number of episodes" do
|
94
|
+
@tv.number_of_episodes.should == 62
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should return the number of seasons" do
|
98
|
+
@tv.number_of_seasons.should == 5
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should return the original name" do
|
102
|
+
@tv.original_name.should == "Breaking Bad"
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should return the origin country" do
|
106
|
+
@tv.origin_country.should == ["US"]
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should return a overview" do
|
110
|
+
@tv.overview.should == "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan. Set and produced in Albuquerque, New Mexico, Breaking Bad is the story of Walter White, a struggling high school chemistry teacher who is diagnosed with inoperable lung cancer at the beginning of the series. He turns to a life of crime, producing and selling methamphetamine, in order to secure his family's financial future before he dies, teaming with his former student, Jesse Pinkman. Heavily serialized, the series is known for positioning its characters in seemingly inextricable corners and has been labeled a contemporary western by its creator."
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should return a popularity rating" do
|
114
|
+
@tv.popularity.should == 9.23244532629376
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should return a poster" do
|
118
|
+
@tv.poster_path.should == "/iRDNn9EHKuBhGa77UBteazvsZa1.jpg"
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should return seasons" do
|
122
|
+
@tv.seasons.should == [{"air_date"=>"2009-02-17", "poster_path"=>"/AngNuUbXSciwLnUXtdOBHqphxNr.jpg", "season_number"=>0}, {"air_date"=>"2008-01-20", "poster_path"=>"/2lhO5zd1nnf7PjC7dGCUo45Volz.jpg", "season_number"=>1}, {"air_date"=>"2009-03-08", "poster_path"=>"/mYsNUgov0AtEnwpNeopj1lgMTf2.jpg", "season_number"=>2}, {"air_date"=>"2010-03-21", "poster_path"=>"/vxoZzDLMwxpuR5i5z4qSIU4LShE.jpg", "season_number"=>3}, {"air_date"=>"2011-07-17", "poster_path"=>"/dzZKSFsV6fREiSCYRj9NPFY4ggd.jpg", "season_number"=>4}, {"air_date"=>"2012-07-15", "poster_path"=>"/8bnD50mYDcoYER5ZcarjBGgAEb6.jpg", "season_number"=>5}]
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should return a status" do
|
126
|
+
@tv.status.should == "Ended"
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should return a vote average" do
|
130
|
+
@tv.vote_average.should == 8.83333333333333
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should return a vote count" do
|
134
|
+
@tv.vote_count.should == 24
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "For popular TV shows" do
|
140
|
+
|
141
|
+
before(:each) do
|
142
|
+
VCR.use_cassette 'tv/popular' do
|
143
|
+
@tv = Tmdb::TV.popular
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should return an array" do
|
148
|
+
@tv.class.should == Array
|
149
|
+
end
|
150
|
+
|
151
|
+
it "each show should return an id" do
|
152
|
+
@tv.first["id"].should == 57243
|
153
|
+
end
|
154
|
+
|
155
|
+
it "each show should return an name" do
|
156
|
+
@tv.first["name"].should == "Doctor Who"
|
157
|
+
end
|
158
|
+
|
159
|
+
it "each show should return an original name" do
|
160
|
+
@tv.first["original_name"].should == "Doctor Who"
|
161
|
+
end
|
162
|
+
|
163
|
+
it "each show should return an popularity" do
|
164
|
+
@tv.first["popularity"].should == 16.5167252220739
|
165
|
+
end
|
166
|
+
|
167
|
+
it "each show should return an poster_path" do
|
168
|
+
@tv.first["poster_path"].should == "/4a94ptIdYz0JwSzo0dCNuPCcfM8.jpg"
|
169
|
+
end
|
170
|
+
|
171
|
+
it "each show should return an vote_average" do
|
172
|
+
@tv.first["vote_average"].should == 7.875
|
173
|
+
end
|
174
|
+
|
175
|
+
it "each show should return an vote_count" do
|
176
|
+
@tv.first["vote_count"].should == 4
|
177
|
+
end
|
178
|
+
|
179
|
+
it "each show should return an backdrop" do
|
180
|
+
@tv.first["backdrop_path"].should == nil
|
181
|
+
end
|
182
|
+
|
183
|
+
it "each show should return an first air date" do
|
184
|
+
@tv.first["first_air_date"].should == "2005-03-26"
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "For top rated TV shows" do
|
190
|
+
|
191
|
+
before(:each) do
|
192
|
+
VCR.use_cassette 'tv/top_rated' do
|
193
|
+
@tv = Tmdb::TV.top_rated
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should return an array" do
|
198
|
+
@tv.class.should == Array
|
199
|
+
end
|
200
|
+
|
201
|
+
it "each show should return an id" do
|
202
|
+
@tv.first["id"].should == 1104
|
203
|
+
end
|
204
|
+
|
205
|
+
it "each show should return an name" do
|
206
|
+
@tv.first["name"].should == "Mad Men"
|
207
|
+
end
|
208
|
+
|
209
|
+
it "each show should return an original name" do
|
210
|
+
@tv.first["original_name"].should == "Mad Men"
|
211
|
+
end
|
212
|
+
|
213
|
+
it "each show should return an popularity" do
|
214
|
+
@tv.first["popularity"].should == 2.15615937122719
|
215
|
+
end
|
216
|
+
|
217
|
+
it "each show should return an poster_path" do
|
218
|
+
@tv.first["poster_path"].should == "/xA2nHrx2oHGPnL4ehBwPxD0ABvb.jpg"
|
219
|
+
end
|
220
|
+
|
221
|
+
it "each show should return an vote_average" do
|
222
|
+
@tv.first["vote_average"].should == 9.66666666666667
|
223
|
+
end
|
224
|
+
|
225
|
+
it "each show should return an vote_count" do
|
226
|
+
@tv.first["vote_count"].should == 3
|
227
|
+
end
|
228
|
+
|
229
|
+
it "each show should return an backdrop" do
|
230
|
+
@tv.first["backdrop_path"].should == "/yGW0NX3I8GXPlWPdoWWyaH0AsCk.jpg"
|
231
|
+
end
|
232
|
+
|
233
|
+
it "each show should return an first air date" do
|
234
|
+
@tv.first["first_air_date"].should == "2007-07-19"
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
describe "For a TV shows images" do
|
240
|
+
|
241
|
+
describe "For backdrops" do
|
242
|
+
|
243
|
+
before(:each) do
|
244
|
+
VCR.use_cassette 'tv/images' do
|
245
|
+
@backdrop = Tmdb::TV.images(1396)['backdrops'].first
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should return a aspect ratio" do
|
250
|
+
@backdrop["aspect_ratio"].should == 1.78
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should return a file path" do
|
254
|
+
@backdrop["file_path"].should == "/dRaV8HGx7Z9xmw77qSs8prp5OuI.jpg"
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should return a height" do
|
258
|
+
@backdrop["height"].should == 720
|
259
|
+
end
|
260
|
+
|
261
|
+
it "should return a iso code" do
|
262
|
+
@backdrop["iso_639_1"].should == nil
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should return a vote average" do
|
266
|
+
@backdrop["vote_average"].should == 0.0
|
267
|
+
end
|
268
|
+
|
269
|
+
it "should return a vote count" do
|
270
|
+
@backdrop["vote_count"].should == 0.0
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should return a width" do
|
274
|
+
@backdrop["width"].should == 1280
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
|
279
|
+
describe "For posters" do
|
280
|
+
|
281
|
+
before(:each) do
|
282
|
+
VCR.use_cassette 'tv/images' do
|
283
|
+
@poster = Tmdb::TV.images(1396)['posters'].first
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
it "should return a aspect ratio" do
|
288
|
+
@poster["aspect_ratio"].should == 1.0
|
289
|
+
end
|
290
|
+
|
291
|
+
it "should return a file path" do
|
292
|
+
@poster["file_path"].should == "/lVbofIPlw3kYa8FQgHT7GtWMI2Q.jpg"
|
293
|
+
end
|
294
|
+
|
295
|
+
it "should return a height" do
|
296
|
+
@poster["height"].should == 1000
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should return a iso code" do
|
300
|
+
@poster["iso_639_1"].should == "nl"
|
301
|
+
end
|
302
|
+
|
303
|
+
it "should return a vote average" do
|
304
|
+
@poster["vote_average"].should == 5.3125
|
305
|
+
end
|
306
|
+
|
307
|
+
it "should return a vote count" do
|
308
|
+
@poster["vote_count"].should == 1
|
309
|
+
end
|
310
|
+
|
311
|
+
it "should return a width" do
|
312
|
+
@poster["width"].should == 1000
|
313
|
+
end
|
314
|
+
|
315
|
+
end
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
describe "For a TV shows cast" do
|
320
|
+
|
321
|
+
before(:each) do
|
322
|
+
VCR.use_cassette 'tv/cast' do
|
323
|
+
@cast = Tmdb::TV.cast(1396).first
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
it "should return a id" do
|
328
|
+
@cast['id'].should == 17419
|
329
|
+
end
|
330
|
+
|
331
|
+
it "should return a name" do
|
332
|
+
@cast['name'].should == "Bryan Cranston"
|
333
|
+
end
|
334
|
+
|
335
|
+
it "should return a order" do
|
336
|
+
@cast['order'].should == 0
|
337
|
+
end
|
338
|
+
|
339
|
+
it "should return a profile image" do
|
340
|
+
@cast['profile_path'].should == "/qXWgFCk4OJqmLRUBEj7cbp8dnkx.jpg"
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should return a character name" do
|
344
|
+
@cast['character'].should == "Walter White"
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should return a credit id" do
|
348
|
+
@cast['credit_id'].should == "52542282760ee313280017f9"
|
349
|
+
end
|
350
|
+
|
351
|
+
end
|
352
|
+
|
353
|
+
describe "For a TV shows crew" do
|
354
|
+
|
355
|
+
before(:each) do
|
356
|
+
VCR.use_cassette 'tv/crew' do
|
357
|
+
@crew = Tmdb::TV.crew(1396).first
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
it "should return a id" do
|
362
|
+
@crew['id'].should == 29779
|
363
|
+
end
|
364
|
+
|
365
|
+
it "should return a department" do
|
366
|
+
@crew['department'].should == "Production"
|
367
|
+
end
|
368
|
+
|
369
|
+
it "should return a job" do
|
370
|
+
@crew['job'].should == "Executive Producer"
|
371
|
+
end
|
372
|
+
|
373
|
+
it "should return a name" do
|
374
|
+
@crew['name'].should == "Michelle MacLaren"
|
375
|
+
end
|
376
|
+
|
377
|
+
it "should return a profile image" do
|
378
|
+
@crew['profile_path'].should == nil
|
379
|
+
end
|
380
|
+
|
381
|
+
end
|
382
|
+
|
383
|
+
describe "For a TV shows external ids" do
|
384
|
+
|
385
|
+
before(:each) do
|
386
|
+
VCR.use_cassette 'tv/external_ids' do
|
387
|
+
@external = Tmdb::TV.external_ids(1396)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
it "should return a id" do
|
392
|
+
@external['id'].should == 1396
|
393
|
+
end
|
394
|
+
|
395
|
+
it "should return a imdb id" do
|
396
|
+
@external['imdb_id'].should == "tt0903747"
|
397
|
+
end
|
398
|
+
|
399
|
+
it "should return a tvdb id" do
|
400
|
+
@external['tvdb_id'].should == 81189
|
401
|
+
end
|
402
|
+
|
403
|
+
it "should return a tvrage id" do
|
404
|
+
@external['tvrage_id'].should == 18164
|
405
|
+
end
|
406
|
+
|
407
|
+
it "should return a freebase id" do
|
408
|
+
@external['freebase_id'].should == "/en/breaking_bad"
|
409
|
+
end
|
410
|
+
|
411
|
+
it "should return a freebase mid" do
|
412
|
+
@external['freebase_mid'].should == "/m/03d34x8"
|
413
|
+
end
|
414
|
+
|
415
|
+
|
416
|
+
end
|
417
|
+
|
418
|
+
end
|
data/themoviedb.gemspec
CHANGED
@@ -27,10 +27,13 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/themoviedb/season.rb",
|
28
28
|
"lib/themoviedb/episode.rb",
|
29
29
|
"lib/themoviedb/tv.rb",
|
30
|
-
"
|
30
|
+
"lib/themoviedb/find.rb"
|
31
31
|
]
|
32
32
|
s.test_files = [
|
33
|
-
"spec/movie_spec.rb"
|
33
|
+
"spec/movie_spec.rb",
|
34
|
+
"spec/tv_spec.rb",
|
35
|
+
"spec/company_spec.rb",
|
36
|
+
"spec/find_spec.rb"
|
34
37
|
]
|
35
38
|
s.require_paths = ["lib"]
|
36
39
|
s.add_dependency('httparty')
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: themoviedb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.14
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ahmet Abdi
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: httparty
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: Provides a simple, easy to use interface for the Movie Database API.
|
@@ -48,30 +45,36 @@ files:
|
|
48
45
|
- lib/themoviedb/season.rb
|
49
46
|
- lib/themoviedb/episode.rb
|
50
47
|
- lib/themoviedb/tv.rb
|
48
|
+
- lib/themoviedb/find.rb
|
51
49
|
- spec/movie_spec.rb
|
50
|
+
- spec/tv_spec.rb
|
51
|
+
- spec/company_spec.rb
|
52
|
+
- spec/find_spec.rb
|
52
53
|
homepage: http://rubygems.org/gems/themoviedb
|
53
54
|
licenses: []
|
55
|
+
metadata: {}
|
54
56
|
post_install_message:
|
55
57
|
rdoc_options: []
|
56
58
|
require_paths:
|
57
59
|
- lib
|
58
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
61
|
requirements:
|
61
|
-
- -
|
62
|
+
- - '>='
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0'
|
64
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
requirements: []
|
71
71
|
rubyforge_project: themoviedb
|
72
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 2.1.11
|
73
73
|
signing_key:
|
74
|
-
specification_version:
|
74
|
+
specification_version: 4
|
75
75
|
summary: A Ruby wrapper for the The Movie Database API.
|
76
76
|
test_files:
|
77
77
|
- spec/movie_spec.rb
|
78
|
+
- spec/tv_spec.rb
|
79
|
+
- spec/company_spec.rb
|
80
|
+
- spec/find_spec.rb
|