themoviedb-api 1.0.3 → 1.0.4
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/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/lib/tmdb.rb +1 -0
- data/lib/tmdb/result.rb +4 -0
- data/lib/tmdb/search.rb +66 -18
- data/lib/tmdb/version.rb +1 -1
- data/spec/search_spec.rb +8 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aba6c94c6369309248ddeed88a7f4a9b74f9500
|
4
|
+
data.tar.gz: 8f23a1ed62c018889f8c1eb8d091b5853f4796f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f217055c0600582e588bf59f303b5e474e15c007fd2bbd5bd2fec7db1188094402b8e7028d0abb722422023eef54fbb0d87a202245b1ea0d767ae652e5aa8cdc
|
7
|
+
data.tar.gz: fb67bd6ae1a0e97b0a7fe8714c71c59d50975ce7da1d3a474fbebb97948d93c341aa6e6f8ca71312bb5925e6599a2cea530578b0e9657bd6185bb6b55b2d0304
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/tmdb.rb
CHANGED
data/lib/tmdb/result.rb
ADDED
data/lib/tmdb/search.rb
CHANGED
@@ -4,59 +4,107 @@ module Tmdb
|
|
4
4
|
def self.company(query, filters={})
|
5
5
|
filters.merge!(query: clean_query_param(query))
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
get_result = Resource.new('/search/company', filters).get
|
8
|
+
|
9
|
+
result = Result.new(get_result.except('results'))
|
10
|
+
result.results = get_result['results'].map do |movie|
|
11
|
+
Company.new(movie)
|
12
|
+
end
|
13
|
+
|
14
|
+
result
|
9
15
|
end
|
10
16
|
|
11
17
|
def self.collection(query, filters={})
|
12
18
|
filters.merge!(query: clean_query_param(query))
|
13
19
|
|
14
|
-
|
15
|
-
|
20
|
+
get_result = Resource.new('/search/collection', filters).get
|
21
|
+
|
22
|
+
result = Result.new(get_result.except('results'))
|
23
|
+
result.results = get_result['results'].map do |movie|
|
24
|
+
Collection.new(movie)
|
25
|
+
end
|
26
|
+
|
27
|
+
result
|
16
28
|
end
|
17
29
|
|
18
30
|
def self.keyword(query, filters={})
|
19
31
|
filters.merge!(query: clean_query_param(query))
|
20
32
|
|
21
|
-
|
22
|
-
|
33
|
+
get_result = Resource.new('/search/keyword', filters).get
|
34
|
+
|
35
|
+
result = Result.new(get_result.except('results'))
|
36
|
+
result.results = get_result['results'].map do |movie|
|
37
|
+
Keyword.new(movie)
|
38
|
+
end
|
39
|
+
|
40
|
+
result
|
23
41
|
end
|
24
42
|
|
25
43
|
def self.list(query, filters={})
|
26
44
|
filters.merge!(query: clean_query_param(query))
|
27
45
|
|
28
|
-
|
29
|
-
|
46
|
+
get_result = Resource.new('/search/list', filters).get
|
47
|
+
|
48
|
+
result = Result.new(get_result.except('results'))
|
49
|
+
result.results = get_result['results'].map do |movie|
|
50
|
+
Tmdb::List.new(movie)
|
51
|
+
end
|
52
|
+
|
53
|
+
result
|
30
54
|
end
|
31
55
|
|
32
56
|
def self.movie(query, filters={})
|
33
57
|
filters.merge!(query: clean_query_param(query))
|
34
58
|
|
35
|
-
|
36
|
-
|
59
|
+
get_result = Resource.new('/search/movie', filters).get
|
60
|
+
|
61
|
+
result = Result.new(get_result.except('results'))
|
62
|
+
result.results = get_result['results'].map do |movie|
|
63
|
+
Movie.new(movie)
|
64
|
+
end
|
65
|
+
|
66
|
+
result
|
37
67
|
end
|
38
68
|
|
39
69
|
def self.multi(query, filters={})
|
40
70
|
filters.merge!(query: clean_query_param(query))
|
41
71
|
|
42
|
-
|
43
|
-
|
72
|
+
get_result = Resource.new('/search/multi', filters).get
|
73
|
+
|
74
|
+
result = Result.new(get_result.except('results'))
|
75
|
+
result.results = get_result['results'].map do |movie|
|
76
|
+
Multi.new(movie)
|
77
|
+
end
|
78
|
+
|
79
|
+
result
|
44
80
|
end
|
45
81
|
|
46
82
|
def self.person(query, filters={})
|
47
83
|
filters.merge!(query: clean_query_param(query))
|
48
84
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
85
|
+
get_result = Resource.new('/search/person', filters).get
|
86
|
+
|
87
|
+
result = Result.new(get_result.except('results'))
|
88
|
+
result.results = get_result['results'].map do |movie|
|
89
|
+
person = Person.new(movie)
|
90
|
+
person.convert_known_for!
|
91
|
+
person
|
92
|
+
end
|
93
|
+
|
94
|
+
result
|
53
95
|
end
|
54
96
|
|
55
97
|
def self.tv(query, filters={})
|
56
98
|
filters.merge!(query: clean_query_param(query))
|
57
99
|
|
58
|
-
|
59
|
-
|
100
|
+
get_result = Resource.new('/search/tv', filters).get
|
101
|
+
|
102
|
+
result = Result.new(get_result.except('results'))
|
103
|
+
result.results = get_result['results'].map do |movie|
|
104
|
+
TV.new(movie)
|
105
|
+
end
|
106
|
+
|
107
|
+
result
|
60
108
|
end
|
61
109
|
|
62
110
|
def self.clean_query_param(query)
|
data/lib/tmdb/version.rb
CHANGED
data/spec/search_spec.rb
CHANGED
@@ -34,7 +34,7 @@ describe Tmdb::Search do
|
|
34
34
|
|
35
35
|
subject { company }
|
36
36
|
|
37
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
37
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
38
38
|
|
39
39
|
it 'should have results of kind Tmdb::Company' do
|
40
40
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::Company)
|
@@ -50,7 +50,7 @@ describe Tmdb::Search do
|
|
50
50
|
|
51
51
|
subject { collection }
|
52
52
|
|
53
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
53
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
54
54
|
|
55
55
|
it 'should have results of kind Tmdb::Collection' do
|
56
56
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::Collection)
|
@@ -66,7 +66,7 @@ describe Tmdb::Search do
|
|
66
66
|
|
67
67
|
subject { keyword }
|
68
68
|
|
69
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
69
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
70
70
|
|
71
71
|
it 'should have results of kind Tmdb::Keyword' do
|
72
72
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::Keyword)
|
@@ -82,7 +82,7 @@ describe Tmdb::Search do
|
|
82
82
|
|
83
83
|
subject { list }
|
84
84
|
|
85
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
85
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
86
86
|
|
87
87
|
it 'should have results of kind Tmdb::List' do
|
88
88
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::List)
|
@@ -98,7 +98,7 @@ describe Tmdb::Search do
|
|
98
98
|
|
99
99
|
subject { movie }
|
100
100
|
|
101
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
101
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
102
102
|
|
103
103
|
it 'should have results of kind Tmdb::Movie' do
|
104
104
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::Movie)
|
@@ -114,7 +114,7 @@ describe Tmdb::Search do
|
|
114
114
|
|
115
115
|
subject { multi }
|
116
116
|
|
117
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
117
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
118
118
|
|
119
119
|
it 'should have results of kind Tmdb::Multi' do
|
120
120
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::Multi)
|
@@ -130,7 +130,7 @@ describe Tmdb::Search do
|
|
130
130
|
|
131
131
|
subject { person }
|
132
132
|
|
133
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
133
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
134
134
|
|
135
135
|
it 'should have results of kind Tmdb::Person' do
|
136
136
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::Person)
|
@@ -151,7 +151,7 @@ describe Tmdb::Search do
|
|
151
151
|
|
152
152
|
subject { tv }
|
153
153
|
|
154
|
-
it { expect(subject).to be_an_instance_of(Tmdb::
|
154
|
+
it { expect(subject).to be_an_instance_of(Tmdb::Result) }
|
155
155
|
|
156
156
|
it 'should have results of kind Tmdb::TV' do
|
157
157
|
expect(subject.results.sample).to be_an_instance_of(Tmdb::TV)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: themoviedb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 18Months
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/tmdb/rating.rb
|
201
201
|
- lib/tmdb/release.rb
|
202
202
|
- lib/tmdb/resource.rb
|
203
|
+
- lib/tmdb/result.rb
|
203
204
|
- lib/tmdb/review.rb
|
204
205
|
- lib/tmdb/search.rb
|
205
206
|
- lib/tmdb/struct.rb
|