themoviedb 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -5
- data/lib/themoviedb/api.rb +5 -5
- data/lib/themoviedb/collection.rb +1 -1
- data/lib/themoviedb/company.rb +1 -1
- data/lib/themoviedb/configuration.rb +8 -8
- data/lib/themoviedb/episode.rb +3 -3
- data/lib/themoviedb/find.rb +6 -6
- data/lib/themoviedb/genre.rb +5 -5
- data/lib/themoviedb/job.rb +1 -1
- data/lib/themoviedb/keyword.rb +20 -0
- data/lib/themoviedb/movie.rb +15 -9
- data/lib/themoviedb/person.rb +3 -3
- data/lib/themoviedb/resource.rb +1 -1
- data/lib/themoviedb/search.rb +22 -20
- data/lib/themoviedb/season.rb +3 -3
- data/lib/themoviedb/tv.rb +6 -6
- data/lib/themoviedb/version.rb +2 -1
- data/lib/themoviedb.rb +6 -6
- data/spec/company_spec.rb +30 -32
- data/spec/find_spec.rb +14 -16
- data/spec/invalid_api_key_spec.rb +13 -14
- data/spec/keyword_spec.rb +66 -0
- data/spec/movie_spec.rb +134 -133
- data/spec/person_spec.rb +60 -63
- data/spec/spec_helper.rb +13 -17
- data/spec/tv_spec.rb +175 -177
- data/spec/vcr/keyword/detail.yml +56 -0
- data/spec/vcr/keyword/movies_for_id.yml +334 -0
- data/spec/vcr/movie/detail.yml +22 -56
- data/themoviedb.gemspec +1 -7
- metadata +50 -100
data/spec/company_spec.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'vcr'
|
1
|
+
require "spec_helper"
|
4
2
|
|
5
|
-
describe Tmdb::Company do
|
3
|
+
RSpec.describe Tmdb::Company do
|
6
4
|
@fields = [
|
7
5
|
:description,
|
8
6
|
:headquarters,
|
@@ -17,76 +15,76 @@ describe Tmdb::Company do
|
|
17
15
|
it { should respond_to field }
|
18
16
|
end
|
19
17
|
|
20
|
-
describe
|
18
|
+
describe "For a company detail" do
|
21
19
|
before(:each) do
|
22
|
-
VCR.use_cassette
|
20
|
+
VCR.use_cassette "company/detail" do
|
23
21
|
@company = Tmdb::Company.detail(5)
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
27
|
-
it
|
28
|
-
expect(@company[
|
25
|
+
it "should return a id" do
|
26
|
+
expect(@company["id"]).to eq(5)
|
29
27
|
end
|
30
28
|
|
31
|
-
it
|
32
|
-
expect(@company[
|
29
|
+
it "should have a description" do
|
30
|
+
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.")
|
33
31
|
end
|
34
32
|
|
35
|
-
it
|
36
|
-
expect(@company[
|
33
|
+
it "should have a homepage" do
|
34
|
+
expect(@company["homepage"]).to eq("http://www.sonypictures.com/")
|
37
35
|
end
|
38
36
|
|
39
|
-
it
|
40
|
-
expect(@company[
|
37
|
+
it "should have logo" do
|
38
|
+
expect(@company["logo_path"]).to eq("/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png")
|
41
39
|
end
|
42
40
|
|
43
|
-
it
|
44
|
-
expect(@company[
|
41
|
+
it "should have a name" do
|
42
|
+
expect(@company["name"]).to eq("Columbia Pictures")
|
45
43
|
end
|
46
44
|
|
47
|
-
it
|
48
|
-
expect(@company[
|
45
|
+
it "could have a parent company" do
|
46
|
+
expect(@company["parent_company"]["name"]).to eq("Sony Pictures Entertainment")
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
52
|
-
describe
|
50
|
+
describe "For a company movies" do
|
53
51
|
before(:each) do
|
54
|
-
VCR.use_cassette
|
52
|
+
VCR.use_cassette "company/movies" do
|
55
53
|
@movies = Tmdb::Company.movies(5)
|
56
54
|
@movie = @movies.first
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
60
|
-
it
|
58
|
+
it "should give back multiple movies" do
|
61
59
|
expect(@movies.count).to be > 1
|
62
60
|
end
|
63
61
|
|
64
|
-
it
|
62
|
+
it "should have a id" do
|
65
63
|
expect(@movie.id).to eq(97_020)
|
66
64
|
end
|
67
65
|
|
68
|
-
it
|
69
|
-
expect(@movie.title).to eq(
|
66
|
+
it "should have a title" do
|
67
|
+
expect(@movie.title).to eq("RoboCop")
|
70
68
|
end
|
71
69
|
|
72
|
-
it
|
73
|
-
expect(@movie.original_title).to eq(
|
70
|
+
it "should have a original title" do
|
71
|
+
expect(@movie.original_title).to eq("RoboCop")
|
74
72
|
end
|
75
73
|
|
76
|
-
it
|
77
|
-
expect(@movie.poster_path).to eq(
|
74
|
+
it "should have a poster" do
|
75
|
+
expect(@movie.poster_path).to eq("/xxLhczZMiJt1iRdhfkVkuMu87si.jpg")
|
78
76
|
end
|
79
77
|
|
80
|
-
it
|
78
|
+
it "should have a popularity rating" do
|
81
79
|
expect(@movie.popularity).to eq(3.13451193740971)
|
82
80
|
end
|
83
81
|
|
84
|
-
it
|
82
|
+
it "should show whether it is an adult movie" do
|
85
83
|
expect(@movie.adult).to eq(false)
|
86
84
|
end
|
87
85
|
|
88
|
-
it
|
89
|
-
expect(@movie.release_date).to eq(
|
86
|
+
it "should have a release date" do
|
87
|
+
expect(@movie.release_date).to eq("2014-02-07")
|
90
88
|
end
|
91
89
|
end
|
92
90
|
end
|
data/spec/find_spec.rb
CHANGED
@@ -1,27 +1,25 @@
|
|
1
|
-
require
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'vcr'
|
1
|
+
require "spec_helper"
|
4
2
|
|
5
|
-
describe Tmdb::Find do
|
6
|
-
describe
|
3
|
+
RSpec.describe Tmdb::Find do
|
4
|
+
describe "For a search" do
|
7
5
|
before(:each) do
|
8
6
|
@find = Tmdb::Find
|
9
7
|
end
|
10
8
|
|
11
|
-
it
|
12
|
-
VCR.use_cassette
|
13
|
-
find = @find.imdb_id(
|
14
|
-
expect(find[
|
15
|
-
expect(find[
|
16
|
-
expect(find[
|
9
|
+
it "should return results for imdb_id" do
|
10
|
+
VCR.use_cassette "find/search_imdb" do
|
11
|
+
find = @find.imdb_id("tt1375666")
|
12
|
+
expect(find["movie_results"]).to be_truthy
|
13
|
+
expect(find["person_results"]).to be_truthy
|
14
|
+
expect(find["tv_results"]).to be_truthy
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
|
-
it
|
21
|
-
VCR.use_cassette
|
22
|
-
find = @find.tvdb_id(
|
23
|
-
expect(find[
|
24
|
-
expect(find[
|
18
|
+
it "should return results for tvdb_id" do
|
19
|
+
VCR.use_cassette "find/search_tvdb" do
|
20
|
+
find = @find.tvdb_id("81189")
|
21
|
+
expect(find["tv_results"].first["name"]).to eq "Breaking Bad"
|
22
|
+
expect(find["tv_results"]).to be_truthy
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
@@ -1,24 +1,23 @@
|
|
1
|
-
require
|
2
|
-
require 'spec_helper'
|
1
|
+
require "spec_helper"
|
3
2
|
|
4
|
-
describe
|
3
|
+
RSpec.describe "invalid API key" do
|
5
4
|
after(:all) { Tmdb::Api.key($VALID_API_KEY) }
|
6
|
-
it
|
5
|
+
it "raises error for nil key" do
|
7
6
|
Tmdb::Api.key(nil)
|
8
|
-
VCR.use_cassette
|
9
|
-
expect { Tmdb::Movie.search(
|
7
|
+
VCR.use_cassette "api_key/nil_key" do
|
8
|
+
expect { Tmdb::Movie.search("batman") }.to raise_error(Tmdb::InvalidApiKeyError)
|
10
9
|
end
|
11
10
|
end
|
12
|
-
it
|
13
|
-
Tmdb::Api.key(
|
14
|
-
VCR.use_cassette
|
15
|
-
expect { Tmdb::Movie.search(
|
11
|
+
it "raises error for empty string key" do
|
12
|
+
Tmdb::Api.key("")
|
13
|
+
VCR.use_cassette "api_key/empty_string" do
|
14
|
+
expect { Tmdb::Movie.search("batman") }.to raise_error(Tmdb::InvalidApiKeyError)
|
16
15
|
end
|
17
16
|
end
|
18
|
-
it
|
19
|
-
Tmdb::Api.key(
|
20
|
-
VCR.use_cassette
|
21
|
-
expect { Tmdb::Movie.search(
|
17
|
+
it "raises error invalid nonempty key" do
|
18
|
+
Tmdb::Api.key("bad-key")
|
19
|
+
VCR.use_cassette "api_key/invalid_key" do
|
20
|
+
expect { Tmdb::Movie.search("batman") }.to raise_error(Tmdb::InvalidApiKeyError)
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Tmdb::Keyword do
|
4
|
+
@fields = [:id, :name]
|
5
|
+
|
6
|
+
@fields.each do |field|
|
7
|
+
it { should respond_to field }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "For a keyword detail" do
|
11
|
+
before(:each) do
|
12
|
+
VCR.use_cassette "keyword/detail" do
|
13
|
+
@keyword = Tmdb::Keyword.detail(818)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return a id" do
|
18
|
+
expect(@keyword["id"]).to eq 818
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return a name" do
|
22
|
+
expect(@keyword["name"]).to eq "based on novel"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "For a keyword movies" do
|
27
|
+
before(:each) do
|
28
|
+
VCR.use_cassette "keyword/movies_for_id" do
|
29
|
+
@movies = Tmdb::Keyword.movies(818)
|
30
|
+
@movie = @movies.first
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should give back multiple movies" do
|
35
|
+
expect(@movies.count).to be > 1
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have a id" do
|
39
|
+
expect(@movie.id).to eq(341_174)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have a title" do
|
43
|
+
expect(@movie.title).to eq("Fifty Shades Darker")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have a original title" do
|
47
|
+
expect(@movie.original_title).to eq("Fifty Shades Darker")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should have a poster" do
|
51
|
+
expect(@movie.poster_path).to eq("/7SMCz5724COOYDhY0mj0NfcJqxH.jpg")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have a popularity rating" do
|
55
|
+
expect(@movie.popularity).to eq(208.414524)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should show whether it is an adult movie" do
|
59
|
+
expect(@movie.adult).to eq(false)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have a release date" do
|
63
|
+
expect(@movie.release_date).to eq("2017-02-08")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|