tmdb 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/VERSION +1 -1
- data/lib/tmdb/api.rb +1 -1
- data/lib/tmdb/movie.rb +38 -29
- data/test/tmdb/test_movie.rb +13 -2
- data/tmdb.gemspec +3 -3
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2669fa5856591fce42e49db4c496c53a94b8c2c6
|
4
|
+
data.tar.gz: aaa089e0aa1dc50ec25f1dd33a68f335a98ef59c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04ca276cf14fd50f21f3d82296e828adff346efb99e39f970424c3fc0577e8827de5d1e75d28b5a17804fc7695af18edc95eed20847822f380e71432976a2d4b
|
7
|
+
data.tar.gz: 63f9a884e5f30aabbb26cad9e38ba31c266142ef21be438341dcb1b82f820ef4cee8110c85d134a28aeefb1614d7c336aecf4d4c5dfeec8c49984adf8894b1c5
|
data/README.md
CHANGED
@@ -25,13 +25,13 @@ Current available:
|
|
25
25
|
* ::title_search
|
26
26
|
* ::search
|
27
27
|
* ::id
|
28
|
+
* ::popular
|
28
29
|
* [TV](#tv)
|
29
30
|
* ::search
|
30
31
|
* ::id
|
31
32
|
|
32
33
|
Todo:
|
33
34
|
* Movie
|
34
|
-
* ::popular
|
35
35
|
* ::top_rated
|
36
36
|
* TV
|
37
37
|
* ::popular
|
@@ -65,8 +65,7 @@ TMDB::API.genres("tv")
|
|
65
65
|
### Movies
|
66
66
|
|
67
67
|
```ruby
|
68
|
-
# To search for movies
|
69
|
-
# Use any of the parameters listed here: http://docs.themoviedb.apiary.io/#get-%2F3%2Fsearch%2Fmovie
|
68
|
+
# To search for movies by title (returns an array of Hashie::Mash objects)
|
70
69
|
movies = TMDB::Movie.title_search(query: 'the matrix')
|
71
70
|
# => <Hashie::Mash "adult"=>false,
|
72
71
|
"backdrop_path"=>"/7u3pxc0K1wx32IleAkLv78MKgrw.jpg",
|
@@ -83,7 +82,12 @@ movies = TMDB::Movie.title_search(query: 'the matrix')
|
|
83
82
|
movies.first.title
|
84
83
|
# => "The Matrix"
|
85
84
|
|
86
|
-
# Use .search
|
85
|
+
# Use .search to find by various parameters (ie. release date)
|
86
|
+
movies = TMDB::Movie.search('release_date.gte' => '2014-01-01',
|
87
|
+
'release_date.lte' => (Time.now.strftime("%Y-%m-%d")),
|
88
|
+
primary_release_year: 2014)
|
89
|
+
# => Array of <Hashie::Mash> movies
|
90
|
+
|
87
91
|
|
88
92
|
# To pull all the information for a particular movie, run an id search:
|
89
93
|
movie = TMDB::Movie.id(550)
|
@@ -101,6 +105,10 @@ movie = TMDB::Movie.id(550)
|
|
101
105
|
"original_title"=>"Fight Club",
|
102
106
|
"overview"=>
|
103
107
|
"A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion."...>
|
108
|
+
|
109
|
+
# Use .popular to final recent popular movies (according to The Movie Database)
|
110
|
+
movies = TMDB::Movie.popular
|
111
|
+
# => Array of <Hashie::Mash> movies
|
104
112
|
```
|
105
113
|
|
106
114
|
### TV
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/tmdb/api.rb
CHANGED
data/lib/tmdb/movie.rb
CHANGED
@@ -3,38 +3,47 @@
|
|
3
3
|
|
4
4
|
module TMDB
|
5
5
|
class Movie
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
movies.push(Hashie::Mash.new(result))
|
15
|
-
end
|
16
|
-
return movies
|
6
|
+
def self.title_search(options = {})
|
7
|
+
# Accepted parameters:
|
8
|
+
# :page, :include_adult (true / false), :year
|
9
|
+
options.merge!(api_key: TMDB::API.api_key)
|
10
|
+
results = TMDB::API.get("/3/search/movie", query: options)['results']
|
11
|
+
movies = []
|
12
|
+
results.each do |result|
|
13
|
+
movies.push(Hashie::Mash.new(result))
|
17
14
|
end
|
15
|
+
return movies
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
return movies
|
18
|
+
# language (ISO_639_1: 'en')
|
19
|
+
# country (ISO_3166_1: 'US')
|
20
|
+
def self.search(options = {})
|
21
|
+
# US-snobbish
|
22
|
+
options.merge!(api_key: TMDB::API.api_key,
|
23
|
+
language: 'en',
|
24
|
+
certification_country: 'US')
|
25
|
+
results = TMDB::API.get("/3/discover/movie", query: options)['results']
|
26
|
+
movies = []
|
27
|
+
results.each do |result|
|
28
|
+
movies.push(Hashie::Mash.new(result))
|
32
29
|
end
|
30
|
+
return movies
|
31
|
+
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
def self.id(movie_id)
|
34
|
+
options = { api_key: TMDB::API.api_key }
|
35
|
+
Hashie::Mash.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
|
36
|
+
# movie.title = "Fight Club"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.popular
|
40
|
+
options = { api_key: TMDB::API.api_key }
|
41
|
+
results = TMDB::API.get("/3/movie/popular", query: options)['results']
|
42
|
+
movies = []
|
43
|
+
results.each do |result|
|
44
|
+
movies.push(Hashie::Mash.new(result))
|
45
|
+
end
|
46
|
+
return movies
|
47
|
+
end
|
39
48
|
end
|
40
49
|
end
|
data/test/tmdb/test_movie.rb
CHANGED
@@ -16,8 +16,10 @@ describe TMDB::Movie do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
# TMDB::Movie::
|
20
|
-
describe ".search
|
19
|
+
# TMDB::Movie::search(release_date.gte, page, etc.)
|
20
|
+
describe ".search('release_date.gte' => '2014-01-01',
|
21
|
+
'release_date.lte' => (Time.now.strftime("%Y-%m-%d"))" do
|
22
|
+
|
21
23
|
it "should return recent results" do
|
22
24
|
movies = TMDB::Movie.search('release_date.gte' => '2014-01-01',
|
23
25
|
'release_date.lte' => (Time.now.strftime("%Y-%m-%d")),
|
@@ -46,4 +48,13 @@ describe TMDB::Movie do
|
|
46
48
|
end
|
47
49
|
|
48
50
|
end
|
51
|
+
|
52
|
+
# TMDB::Movie::popular
|
53
|
+
describe ".popular" do
|
54
|
+
it "should return a list of popular results" do
|
55
|
+
movies = TMDB::Movie.popular
|
56
|
+
movies.must_be_instance_of Array
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
49
60
|
end
|
data/tmdb.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: tmdb 0.
|
5
|
+
# stub: tmdb 0.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "tmdb"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Cody Barr"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-07-02"
|
15
15
|
s.description = "tmdb is a simple ruby wrapper for The Movie Database. Exposes all TMDB API operations"
|
16
16
|
s.email = "cody.barr@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,161 +1,161 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tmdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Barr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.13.1
|
20
|
-
- - ~>
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '0.13'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.13.1
|
30
|
-
- - ~>
|
30
|
+
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0.13'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: hashie
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 2.1.1
|
40
|
-
- - ~>
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '2.1'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 2.1.1
|
50
|
-
- - ~>
|
50
|
+
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '2.1'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: shoulda
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 3.5.0
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '3.5'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 3.5.0
|
70
|
-
- - ~>
|
70
|
+
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '3.5'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rdoc
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- - ~>
|
77
|
+
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '3.12'
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - ~>
|
84
|
+
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '3.12'
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: bundler
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
|
-
- - ~>
|
91
|
+
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '1.0'
|
94
94
|
type: :development
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- - ~>
|
98
|
+
- - "~>"
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '1.0'
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: jeweler
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- -
|
105
|
+
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: 2.0.1
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 2.0.1
|
118
|
-
- - ~>
|
118
|
+
- - "~>"
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '2.0'
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
122
|
name: simplecov
|
123
123
|
requirement: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: 0.8.2
|
128
|
-
- - ~>
|
128
|
+
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0.8'
|
131
131
|
type: :development
|
132
132
|
prerelease: false
|
133
133
|
version_requirements: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: 0.8.2
|
138
|
-
- - ~>
|
138
|
+
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0.8'
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: rake-notes
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: 0.2.0
|
148
|
-
- - ~>
|
148
|
+
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0.2'
|
151
151
|
type: :development
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: 0.2.0
|
158
|
-
- - ~>
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0.2'
|
161
161
|
description: tmdb is a simple ruby wrapper for The Movie Database. Exposes all TMDB
|
@@ -192,12 +192,12 @@ require_paths:
|
|
192
192
|
- lib
|
193
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
194
194
|
requirements:
|
195
|
-
- -
|
195
|
+
- - ">="
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
199
|
requirements:
|
200
|
-
- -
|
200
|
+
- - ">="
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|