ruby-tmdb3 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +21 -0
- data/README.rdoc +105 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/lib/ruby-tmdb3/tmdb.rb +133 -0
- data/lib/ruby-tmdb3/tmdb_cast.rb +56 -0
- data/lib/ruby-tmdb3/tmdb_movie.rb +60 -0
- data/lib/ruby-tmdb3.rb +8 -0
- data/ruby-tmdb3.gemspec +74 -0
- data/test/fixtures/blank_result.txt +15 -0
- data/test/fixtures/example_com.txt +25 -0
- data/test/fixtures/image.jpg +0 -0
- data/test/fixtures/incorrect_api_url.txt +13 -0
- data/test/fixtures/movie_get_info.txt +15 -0
- data/test/fixtures/movie_imdb_lookup.txt +15 -0
- data/test/fixtures/movie_search.txt +15 -0
- data/test/fixtures/person_get_info.txt +15 -0
- data/test/fixtures/person_search.txt +15 -0
- data/test/setup/setup_api_key.rb +10 -0
- data/test/setup/test_unit_extensions.rb +21 -0
- data/test/setup/url_mocks.rb +46 -0
- data/test/test_helper.rb +21 -0
- data/test/unit/test_direct_require.rb +25 -0
- data/test/unit/tmdb_cast_test.rb +124 -0
- data/test/unit/tmdb_movie_test.rb +158 -0
- data/test/unit/tmdb_test.rb +180 -0
- metadata +139 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2012 Irio Irineu Musskopf Junior (http://irio.posterous.com/)
|
2
|
+
Copyright (c) 2010 Aaron Gough (http://thingsaaronmade.com/)
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
= ruby-tmdb3
|
2
|
+
|
3
|
+
ruby-tmdb3 is an ActiveRecord-style API wrapper for {TheMovieDB.org (TMDb)}[http://www.themoviedb.org/]. ruby-tmdb3 uses tmdb's API v3 and is designed to streamline common tasks associated with finding information about movies and cast members.
|
4
|
+
|
5
|
+
=== Examples
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'ruby-tmdb3'
|
9
|
+
|
10
|
+
# setup your API key
|
11
|
+
Tmdb.api_key = "t478f8de5776c799de5a"
|
12
|
+
|
13
|
+
# setup your default language
|
14
|
+
Tmdb.default_language = "en"
|
15
|
+
|
16
|
+
@movie = TmdbMovie.find(:title => "Iron Man", :limit => 1)
|
17
|
+
# => <OpenStruct>
|
18
|
+
|
19
|
+
@movie.title
|
20
|
+
# => "Iron Man"
|
21
|
+
|
22
|
+
=== Installation
|
23
|
+
|
24
|
+
For ease of use ruby-tmdb3 is packaged as a Rubygem. Installing it is as simple as:
|
25
|
+
|
26
|
+
gem install ruby-tmdb3
|
27
|
+
|
28
|
+
=== Usage
|
29
|
+
|
30
|
+
There are 3 main methods you can use to get information about movies and cast members:
|
31
|
+
|
32
|
+
==== TmdbMovie.find([:id, :imdb, :title, :limit, :expand_results, :language])
|
33
|
+
|
34
|
+
Find information about an individual movie, or a set of movies that share a similar title, eg:
|
35
|
+
|
36
|
+
TmdbMovie.find(:title => "fight club", :limit => 10, :expand_results => true, :language => "en")
|
37
|
+
|
38
|
+
Parameters:
|
39
|
+
|
40
|
+
[:id] Specifies an individual movie via it's TMDb id
|
41
|
+
[:title] Specifies a query string to look for in the movie titles
|
42
|
+
[:imdb] Specifies an individual movie via it's IMDB id
|
43
|
+
[:limit] Specifies the maximum number of results to be returned
|
44
|
+
[:expand_results] The TMDb API by default returns only partial info for any API method that can return multiple results. When :expand_results is set to true ruby-tmdb3 automatically makes extra API calls to fetch the full information for each item. This can result in *very* slow requests though. If you only need basic information for a search listing then set this to false. Defaults to 'true'.
|
45
|
+
[:language] Allows you to override the default API language on a per-query basis.
|
46
|
+
|
47
|
+
You must supply at least one of :id, :title, or :imdb. All other parameters are optional.
|
48
|
+
|
49
|
+
==== TmdbCast.find([:id, :name, :limit, :expand_results, :language])
|
50
|
+
|
51
|
+
Find information about an individual cast member, or a set of cast members sharing similar names, eg:
|
52
|
+
|
53
|
+
TmdbCast.find( :id => 123, :name => "Brad", :limit => 1, :expand_results => true)
|
54
|
+
|
55
|
+
[:id] Specifies an individual cast member via their TMDb id
|
56
|
+
[:name] Specifies a query string to look for in the cast names
|
57
|
+
[:limit] See TmdbMovie
|
58
|
+
[:expand_results] See TmdbMovie
|
59
|
+
[:language] See TmdbMovie
|
60
|
+
|
61
|
+
You must supply at least one of :id or :name. All other parameters are optional.
|
62
|
+
|
63
|
+
|
64
|
+
=== Usage Examples
|
65
|
+
|
66
|
+
Find all movies whose titles match a given string:
|
67
|
+
|
68
|
+
@movies = TmdbMovie.find(:title => 'Iron Man')
|
69
|
+
|
70
|
+
Find the movie most likely to be associated with a given title:
|
71
|
+
|
72
|
+
@movie = TmdbMovie.find(:title => 'Sin City', :limit => 1)
|
73
|
+
|
74
|
+
Find a single movie by it's TMDb ID:
|
75
|
+
|
76
|
+
@movie = TmdbMovie.find(:id => 187)
|
77
|
+
|
78
|
+
Find a single movie by it's IMDB ID:
|
79
|
+
|
80
|
+
@movie = TmdbMovie.find(:imdb => 'tt0401792')
|
81
|
+
|
82
|
+
Find all cast members whose names match a given string:
|
83
|
+
|
84
|
+
@actors = TmdbCast.find(:name => 'Fred')
|
85
|
+
|
86
|
+
Find an individual cast member via their TMDb ID:
|
87
|
+
|
88
|
+
@actor = TmdbCast.find(:id => 101)
|
89
|
+
|
90
|
+
Get the info for a movie in French:
|
91
|
+
|
92
|
+
@movie = TmdbMovie.find(:title => 'Sin City', :limit => 1, :language => "fr")
|
93
|
+
|
94
|
+
|
95
|
+
=== Item information
|
96
|
+
|
97
|
+
To find out more about the information each object offers on retrieved items have a look at the {TMDb API Docs}[http://help.themoviedb.org/kb/api/about-3]. For the most accurate information about the information available have a look at the data directly through ruby-tmdb3 by calling @item.raw_data.inspect
|
98
|
+
|
99
|
+
=== Author & Credits
|
100
|
+
|
101
|
+
Author:: {Irio Irineu Musskopf Junior}[mailto:iirineu@gmail.com], {Aaron Gough}[mailto:aaron@aarongough.com]
|
102
|
+
Contributors:: {Alex Hayes}[https://github.com/alexhayes], {Alvaro Pereyra Rabanal}[https://github.com/xenda], {Linus Oleander}[https://github.com/oleander], {aristides}[https://github.com/aristides], {Robin Boutros}[https://github.com/niuage]
|
103
|
+
|
104
|
+
Copyright (c) 2012 {Irio Irineu Musskopf Junior}[http://irio.posterous.com/] ({irio.posterous.com}[http://irio.posterous.com/])
|
105
|
+
Copyright (c) 2010 {Aaron Gough}[http://thingsaaronmade.com/] ({thingsaaronmade.com}[http://thingsaaronmade.com/]), released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rdoc/task'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'jeweler'
|
10
|
+
Jeweler::Tasks.new do |gemspec|
|
11
|
+
gemspec.name = "ruby-tmdb3"
|
12
|
+
gemspec.summary = "An ActiveRecord-style API wrapper for TheMovieDB.org"
|
13
|
+
gemspec.description = "An ActiveRecord-style API wrapper for TheMovieDB.org"
|
14
|
+
gemspec.email = "iirineu@gmail.com"
|
15
|
+
gemspec.homepage = "https://github.com/Irio/ruby-tmdb"
|
16
|
+
gemspec.authors = ["Irio Irineu Musskopf Junior", "Aaron Gough"]
|
17
|
+
gemspec.rdoc_options << '--line-numbers' << '--inline-source'
|
18
|
+
gemspec.extra_rdoc_files = ['README.rdoc', 'MIT-LICENSE']
|
19
|
+
gemspec.add_dependency( "deepopenstruct", ">= 0.1.2")
|
20
|
+
gemspec.add_dependency( "json")
|
21
|
+
gemspec.add_dependency "addressable"
|
22
|
+
gemspec.add_development_dependency "webmock"
|
23
|
+
end
|
24
|
+
rescue LoadError
|
25
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
desc 'Test ruby-tmdb3.'
|
30
|
+
Rake::TestTask.new(:test) do |t|
|
31
|
+
t.libs << 'lib/*.rb'
|
32
|
+
t.libs << 'test'
|
33
|
+
t.pattern = 'test/**/*_test.rb'
|
34
|
+
t.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
desc 'Generate documentation for ruby-tmdb3.'
|
39
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = 'ruby-tmdb3'
|
42
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
43
|
+
rdoc.rdoc_files.include('README.rdoc')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
rdoc.rdoc_files.include('app/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.0
|
@@ -0,0 +1,133 @@
|
|
1
|
+
class Tmdb
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
require 'cgi'
|
6
|
+
require 'json'
|
7
|
+
require 'deepopenstruct'
|
8
|
+
require "addressable/uri"
|
9
|
+
|
10
|
+
@@api_key = ""
|
11
|
+
@@default_language = "en"
|
12
|
+
@@api_response = {}
|
13
|
+
|
14
|
+
def self.api_key
|
15
|
+
@@api_key
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.api_key=(key)
|
19
|
+
@@api_key = key
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.default_language
|
23
|
+
@@default_language
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.default_language=(language)
|
27
|
+
@@default_language = language
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.base_api_url
|
31
|
+
"http://api.themoviedb.org/3/"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.api_call(method, data, language = @@default_language)
|
35
|
+
raise ArgumentError, "Tmdb.api_key must be set before using the API" if(Tmdb.api_key.nil? || Tmdb.api_key.empty?)
|
36
|
+
raise ArgumentError, "Invalid data." if(data.nil? || (data.class != Hash))
|
37
|
+
|
38
|
+
data = {
|
39
|
+
api_key: Tmdb.api_key,
|
40
|
+
language: language
|
41
|
+
}.merge(data)
|
42
|
+
|
43
|
+
# Addressable can only handle hashes whose values respond to to_str, so lets be nice and convert things.
|
44
|
+
query_values = {}
|
45
|
+
data.each do |key,value|
|
46
|
+
if not value.respond_to?(:to_str) and value.respond_to?(:to_s)
|
47
|
+
query_values[key] = value.to_s
|
48
|
+
else
|
49
|
+
query_values[key] = value
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
uri = Addressable::URI.new
|
54
|
+
|
55
|
+
# Construct URL for queries with id
|
56
|
+
if data.has_key?(:id)
|
57
|
+
uri.query_values = query_values
|
58
|
+
|
59
|
+
url = Tmdb.base_api_url + method + "/" + data[:id].to_s + "?" + uri.query
|
60
|
+
|
61
|
+
# Construct URL other queries
|
62
|
+
else
|
63
|
+
query_values = {
|
64
|
+
query: CGI::escape(data[:query])
|
65
|
+
}.merge(query_values)
|
66
|
+
|
67
|
+
uri.query_values = query_values
|
68
|
+
|
69
|
+
url = Tmdb.base_api_url + method + "?" + uri.query
|
70
|
+
end
|
71
|
+
|
72
|
+
response = Tmdb.get_url(url)
|
73
|
+
if(response.code.to_i != 200)
|
74
|
+
raise RuntimeError, "Tmdb API returned status code '#{response.code}' for URL: '#{url}'"
|
75
|
+
end
|
76
|
+
|
77
|
+
body = JSON(response.body)
|
78
|
+
if body.has_key?("results") && body["results"].empty?
|
79
|
+
return nil
|
80
|
+
else
|
81
|
+
return body
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Get a URL and return a response object, follow upto 'limit' re-directs on the way
|
86
|
+
def self.get_url(uri_str, limit = 10)
|
87
|
+
return false if limit == 0
|
88
|
+
begin
|
89
|
+
response = Net::HTTP.get_response(URI.parse(uri_str))
|
90
|
+
rescue SocketError, Errno::ENETDOWN
|
91
|
+
response = Net::HTTPBadRequest.new( '404', 404, "Not Found" )
|
92
|
+
return response
|
93
|
+
end
|
94
|
+
case response
|
95
|
+
when Net::HTTPSuccess then response
|
96
|
+
when Net::HTTPRedirection then get_url(response['location'], limit - 1)
|
97
|
+
else
|
98
|
+
Net::HTTPBadRequest.new( '404', 404, "Not Found" )
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.data_to_object(data)
|
103
|
+
object = DeepOpenStruct.load(data)
|
104
|
+
object.raw_data = data
|
105
|
+
["posters", "backdrops", "profile"].each do |image_array_name|
|
106
|
+
if(object.respond_to?(image_array_name))
|
107
|
+
image_array = object.send(image_array_name)
|
108
|
+
image_array.each_index do |x|
|
109
|
+
image_array[x] = image_array[x].image
|
110
|
+
image_array[x].instance_eval <<-EOD
|
111
|
+
def self.data
|
112
|
+
return Tmdb.get_url(self.url).body
|
113
|
+
end
|
114
|
+
EOD
|
115
|
+
end
|
116
|
+
end
|
117
|
+
if(object.profile)
|
118
|
+
object.profiles = object.profile
|
119
|
+
end
|
120
|
+
end
|
121
|
+
unless(object.cast.nil?)
|
122
|
+
object.cast.each_index do |x|
|
123
|
+
object.cast[x].instance_eval <<-EOD
|
124
|
+
def self.bio
|
125
|
+
return TmdbCast.find(:id => self.id, :limit => 1)
|
126
|
+
end
|
127
|
+
EOD
|
128
|
+
end
|
129
|
+
end
|
130
|
+
return object
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class TmdbCast
|
2
|
+
|
3
|
+
def self.find(options)
|
4
|
+
options = {
|
5
|
+
:expand_results => true
|
6
|
+
}.merge(options)
|
7
|
+
|
8
|
+
raise ArgumentError, "At least one of: id, name, should be supplied" if(options[:id].nil? && options[:name].nil?)
|
9
|
+
|
10
|
+
results = []
|
11
|
+
unless(options[:id].nil? || options[:id].to_s.empty?)
|
12
|
+
results << Tmdb.api_call("person", {id: options[:id].to_s}, options[:language])
|
13
|
+
end
|
14
|
+
unless(options[:name].nil? || options[:name].to_s.empty?)
|
15
|
+
api_return = Tmdb.api_call('search/person', {query: options[:name].to_s}, options[:language])
|
16
|
+
results << api_return["results"] if api_return
|
17
|
+
end
|
18
|
+
|
19
|
+
results.flatten!(1)
|
20
|
+
results.uniq!
|
21
|
+
results.delete_if &:nil?
|
22
|
+
|
23
|
+
unless(options[:limit].nil?)
|
24
|
+
raise ArgumentError, ":limit must be an integer greater than 0" unless(options[:limit].is_a?(Fixnum) && options[:limit] > 0)
|
25
|
+
results = results.slice(0, options[:limit])
|
26
|
+
end
|
27
|
+
|
28
|
+
results.map!{|c| TmdbCast.new(c, options[:expand_results], options[:language])}
|
29
|
+
|
30
|
+
if(results.length == 1)
|
31
|
+
return results.first
|
32
|
+
else
|
33
|
+
return results
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.new(raw_data, expand_results = false, language = nil)
|
38
|
+
# expand the result by calling Person.getInfo unless :expand_results is set to false or the data is already complete
|
39
|
+
# (as determined by checking for the 'birthday' property)
|
40
|
+
if(expand_results && !raw_data.has_key?("birthday"))
|
41
|
+
begin
|
42
|
+
expanded_data = Tmdb.api_call("person", {id: raw_data["id"].to_s}, language)
|
43
|
+
rescue RuntimeError => e
|
44
|
+
raise ArgumentError, "Unable to fetch expanded info for Cast ID: '#{raw_data["id"]}'" if expanded_data.nil?
|
45
|
+
end
|
46
|
+
raw_data = expanded_data
|
47
|
+
end
|
48
|
+
return Tmdb.data_to_object(raw_data)
|
49
|
+
end
|
50
|
+
|
51
|
+
def ==(other)
|
52
|
+
return false unless(other.is_a?(TmdbCast))
|
53
|
+
@raw_data == other.raw_data
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class TmdbMovie
|
2
|
+
|
3
|
+
def self.find(options)
|
4
|
+
options = {
|
5
|
+
:expand_results => true
|
6
|
+
}.merge(options)
|
7
|
+
|
8
|
+
raise ArgumentError, "At least one of: id, title, imdb should be supplied" if(options[:id].nil? && options[:title].nil? && options[:imdb].nil?)
|
9
|
+
|
10
|
+
results = []
|
11
|
+
unless(options[:id].nil? || options[:id].to_s.empty?)
|
12
|
+
results << Tmdb.api_call("movie", {id: options[:id].to_s}, options[:language])
|
13
|
+
end
|
14
|
+
unless(options[:title].nil? || options[:title].to_s.empty?)
|
15
|
+
api_return = Tmdb.api_call("search/movie", {query: options[:title].to_s}, options[:language])
|
16
|
+
results << api_return["results"] if api_return
|
17
|
+
end
|
18
|
+
unless(options[:imdb].nil? || options[:imdb].to_s.empty?)
|
19
|
+
results << Tmdb.api_call("movie", {id: options[:imdb].to_s}, options[:language])
|
20
|
+
options[:expand_results] = true
|
21
|
+
end
|
22
|
+
|
23
|
+
results.flatten!(1)
|
24
|
+
results.uniq!
|
25
|
+
results.delete_if &:nil?
|
26
|
+
|
27
|
+
unless(options[:limit].nil?)
|
28
|
+
raise ArgumentError, ":limit must be an integer greater than 0" unless(options[:limit].is_a?(Fixnum) && options[:limit] > 0)
|
29
|
+
results = results.slice(0, options[:limit])
|
30
|
+
end
|
31
|
+
|
32
|
+
results.map!{|m| TmdbMovie.new(m, options[:expand_results], options[:language])}
|
33
|
+
|
34
|
+
if(results.length == 1)
|
35
|
+
return results.first
|
36
|
+
else
|
37
|
+
return results
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.new(raw_data, expand_results = false, language = nil)
|
42
|
+
# expand the result by calling movie unless :expand_results is false or the data is already complete
|
43
|
+
# (as determined by checking for the runtime property in the raw data)
|
44
|
+
if(expand_results && !raw_data.has_key?("runtime"))
|
45
|
+
begin
|
46
|
+
expanded_data = Tmdb.api_call("movie", {id: raw_data["id"].to_s}, language)
|
47
|
+
rescue RuntimeError => e
|
48
|
+
raise ArgumentError, "Unable to fetch expanded info for Movie ID: '#{raw_data["id"]}'" if expanded_data.nil?
|
49
|
+
end
|
50
|
+
raw_data = expanded_data
|
51
|
+
end
|
52
|
+
return Tmdb.data_to_object(raw_data)
|
53
|
+
end
|
54
|
+
|
55
|
+
def ==(other)
|
56
|
+
return false unless(other.is_a?(TmdbMovie))
|
57
|
+
return @raw_data == other.raw_data
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
data/lib/ruby-tmdb3.rb
ADDED
data/ruby-tmdb3.gemspec
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "ruby-tmdb3"
|
8
|
+
s.version = "0.3.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Irio Irineu Musskopf Junior", "Aaron Gough"]
|
12
|
+
s.date = "2012-06-19"
|
13
|
+
s.description = "An ActiveRecord-style API wrapper for TheMovieDB.org"
|
14
|
+
s.email = "iirineu@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"MIT-LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/ruby-tmdb3.rb",
|
25
|
+
"lib/ruby-tmdb3/tmdb.rb",
|
26
|
+
"lib/ruby-tmdb3/tmdb_cast.rb",
|
27
|
+
"lib/ruby-tmdb3/tmdb_movie.rb",
|
28
|
+
"ruby-tmdb3.gemspec",
|
29
|
+
"test/fixtures/blank_result.txt",
|
30
|
+
"test/fixtures/example_com.txt",
|
31
|
+
"test/fixtures/image.jpg",
|
32
|
+
"test/fixtures/incorrect_api_url.txt",
|
33
|
+
"test/fixtures/movie_get_info.txt",
|
34
|
+
"test/fixtures/movie_imdb_lookup.txt",
|
35
|
+
"test/fixtures/movie_search.txt",
|
36
|
+
"test/fixtures/person_get_info.txt",
|
37
|
+
"test/fixtures/person_search.txt",
|
38
|
+
"test/setup/setup_api_key.rb",
|
39
|
+
"test/setup/test_unit_extensions.rb",
|
40
|
+
"test/setup/url_mocks.rb",
|
41
|
+
"test/test_helper.rb",
|
42
|
+
"test/unit/test_direct_require.rb",
|
43
|
+
"test/unit/tmdb_cast_test.rb",
|
44
|
+
"test/unit/tmdb_movie_test.rb",
|
45
|
+
"test/unit/tmdb_test.rb"
|
46
|
+
]
|
47
|
+
s.homepage = "https://github.com/Irio/ruby-tmdb"
|
48
|
+
s.rdoc_options = ["--line-numbers", "--inline-source"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = "1.8.19"
|
51
|
+
s.summary = "An ActiveRecord-style API wrapper for TheMovieDB.org"
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
+
s.add_runtime_dependency(%q<deepopenstruct>, [">= 0.1.2"])
|
58
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
59
|
+
s.add_runtime_dependency(%q<addressable>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<deepopenstruct>, [">= 0.1.2"])
|
63
|
+
s.add_dependency(%q<json>, [">= 0"])
|
64
|
+
s.add_dependency(%q<addressable>, [">= 0"])
|
65
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<deepopenstruct>, [">= 0.1.2"])
|
69
|
+
s.add_dependency(%q<json>, [">= 0"])
|
70
|
+
s.add_dependency(%q<addressable>, [">= 0"])
|
71
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx
|
3
|
+
Date: Mon, 23 Aug 2010 16:46:40 GMT
|
4
|
+
Content-Type: text/json; charset=utf-8
|
5
|
+
Transfer-Encoding: chunked
|
6
|
+
Connection: keep-alive
|
7
|
+
Keep-Alive: timeout=20
|
8
|
+
Status: 200 OK
|
9
|
+
Cache-Control: public, max-age=21600
|
10
|
+
X-Varnish: 2542133049
|
11
|
+
Age: 0
|
12
|
+
Via: 1.1 varnish
|
13
|
+
X-Cache: MISS
|
14
|
+
|
15
|
+
{"page":1,"results":[],"total_pages":0,"total_results":0}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: Apache/2.2.3 (CentOS)
|
3
|
+
Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT
|
4
|
+
ETag: "24ec5-1b6-4059a80bfd280"
|
5
|
+
Accept-Ranges: bytes
|
6
|
+
Content-Type: text/html; charset=UTF-8
|
7
|
+
Connection: Keep-Alive
|
8
|
+
Date: Sun, 16 May 2010 19:01:25 GMT
|
9
|
+
Age: 6053
|
10
|
+
Content-Length: 438
|
11
|
+
|
12
|
+
<HTML>
|
13
|
+
<HEAD>
|
14
|
+
<TITLE>Example Web Page</TITLE>
|
15
|
+
</HEAD>
|
16
|
+
<body>
|
17
|
+
<p>You have reached this web page by typing "example.com",
|
18
|
+
"example.net",
|
19
|
+
or "example.org" into your web browser.</p>
|
20
|
+
<p>These domain names are reserved for use in documentation and are not available
|
21
|
+
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
|
22
|
+
2606</a>, Section 3.</p>
|
23
|
+
</BODY>
|
24
|
+
</HTML>
|
25
|
+
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
HTTP/1.1 404 Not Found
|
2
|
+
Status: 404 Not Found
|
3
|
+
Content-Type: text/html
|
4
|
+
X-Cascade: pass
|
5
|
+
Content-Length: 18
|
6
|
+
Date: Sun, 16 May 2010 19:07:32 GMT
|
7
|
+
X-Varnish: 4026308020 4014879260
|
8
|
+
Age: 8217
|
9
|
+
Via: 1.1 varnish
|
10
|
+
Connection: keep-alive
|
11
|
+
X-Cache: HIT
|
12
|
+
|
13
|
+
<h1>Not Found</h1>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx
|
3
|
+
Date: Mon, 23 Aug 2010 16:45:21 GMT
|
4
|
+
Content-Type: text/json; charset=utf-8
|
5
|
+
Transfer-Encoding: chunked
|
6
|
+
Connection: keep-alive
|
7
|
+
Keep-Alive: timeout=20
|
8
|
+
Status: 200 OK
|
9
|
+
Cache-Control: public, max-age=21600
|
10
|
+
X-Varnish: 2542127928 2542059531
|
11
|
+
Age: 1000
|
12
|
+
Via: 1.1 varnish
|
13
|
+
X-Cache: HIT
|
14
|
+
|
15
|
+
{"adult":false,"backdrop_path":"/kftq445wZNaKEqJ9gXwYOIfI2p1.jpg","belongs_to_collection":{"id":188,"name":"Sin City","poster_path":"/mYxbfd8pZz9YTtEFRaOcQboOvMk.jpg","backdrop_path":"/wyey4NS4Z1z7293R8FFBETL6DSr.jpg"},"budget":40000000,"genres":[{"id":28,"name":"Action"},{"id":80,"name":"Crime"},{"id":18,"name":"Drama"},{"id":53,"name":"Thriller"}],"homepage":"http://www.sincitythemovie.com/","id":187,"imdb_id":"tt0401792","original_title":"Sin City","overview":"Sin City is a neo-noir crime thriller based on Frank Miller's graphic novel series of the same name.The film is primarily based on three of Miller's works: The Hard Goodbye, about a man who embarks on a brutal rampage in search of his one-time sweetheart's killer; The Big Fat Kill, which focuses on a street war between a group of prostitutes and a group of mercenaries; and That Yellow Bastard, which follows an aging police officer who protects a young woman from a grotesquely disfigured serial killer.","popularity":1993.887,"poster_path":"/eCJkepVJslq1nEtqURLaC1zLPAL.jpg","production_companies":[{"name":"Miramax Films","id":14}],"production_countries":[{"iso_3166_1":"US","name":"United States of America"}],"release_date":"2005-04-01","revenue":158733820,"runtime":124,"spoken_languages":[{"iso_639_1":"en","name":"English"}],"tagline":"There is no justice without sin.","title":"Sin City","vote_average":8.4,"vote_count":59}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx
|
3
|
+
Date: Mon, 23 Aug 2010 16:44:10 GMT
|
4
|
+
Content-Type: text/json; charset=utf-8
|
5
|
+
Transfer-Encoding: chunked
|
6
|
+
Connection: keep-alive
|
7
|
+
Keep-Alive: timeout=20
|
8
|
+
Status: 200 OK
|
9
|
+
Cache-Control: public, max-age=21600
|
10
|
+
X-Varnish: 2542123184
|
11
|
+
Age: 0
|
12
|
+
Via: 1.1 varnish
|
13
|
+
X-Cache: MISS
|
14
|
+
|
15
|
+
{"adult":false,"backdrop_path":"/kftq445wZNaKEqJ9gXwYOIfI2p1.jpg","belongs_to_collection":{"id":188,"name":"Sin City","poster_path":"/mYxbfd8pZz9YTtEFRaOcQboOvMk.jpg","backdrop_path":"/wyey4NS4Z1z7293R8FFBETL6DSr.jpg"},"budget":40000000,"genres":[{"id":28,"name":"Action"},{"id":80,"name":"Crime"},{"id":18,"name":"Drama"},{"id":53,"name":"Thriller"}],"homepage":"http://www.sincitythemovie.com/","id":187,"imdb_id":"tt0401792","original_title":"Sin City","overview":"Sin City is a neo-noir crime thriller based on Frank Miller's graphic novel series of the same name.The film is primarily based on three of Miller's works: The Hard Goodbye, about a man who embarks on a brutal rampage in search of his one-time sweetheart's killer; The Big Fat Kill, which focuses on a street war between a group of prostitutes and a group of mercenaries; and That Yellow Bastard, which follows an aging police officer who protects a young woman from a grotesquely disfigured serial killer.","popularity":1993.887,"poster_path":"/eCJkepVJslq1nEtqURLaC1zLPAL.jpg","production_companies":[{"name":"Miramax Films","id":14}],"production_countries":[{"iso_3166_1":"US","name":"United States of America"}],"release_date":"2005-04-01","revenue":158733820,"runtime":124,"spoken_languages":[{"iso_639_1":"en","name":"English"}],"tagline":"There is no justice without sin.","title":"Sin City","vote_average":8.4,"vote_count":59}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx
|
3
|
+
Date: Mon, 23 Aug 2010 16:42:39 GMT
|
4
|
+
Content-Type: text/json; charset=utf-8
|
5
|
+
Transfer-Encoding: chunked
|
6
|
+
Connection: keep-alive
|
7
|
+
Keep-Alive: timeout=20
|
8
|
+
Status: 200 OK
|
9
|
+
Cache-Control: public, max-age=21600
|
10
|
+
X-Varnish: 2542116501
|
11
|
+
Age: 0
|
12
|
+
Via: 1.1 varnish
|
13
|
+
X-Cache: MISS
|
14
|
+
|
15
|
+
{"page":1,"results":[{"adult":false,"backdrop_path":"/ZQixhAZx6fH1VNafFXsqa1B8QI.jpg","id":1726,"original_title":"Iron Man","release_date":"2008-05-02","poster_path":"/848chlIWVT41VtAAgyh9bWymAYb.jpg","popularity":21562.48,"title":"Iron Man","vote_average":8.4,"vote_count":95},{"adult":false,"backdrop_path":"/u36if7fq60FXOnCgBEQpafyEJwT.jpg","id":69592,"original_title":"Iron Man","release_date":"1951-08-18","poster_path":"/hcpm8d6cqo3rVqpfVPUk2IRHGRD.jpg","popularity":0.055,"title":"Iron Man","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/jxdSxqAFrdioKgXwgTs5Qfbazjq.jpg","id":10138,"original_title":"Iron Man 2","release_date":"2010-05-07","poster_path":"/zJ2eK7fehqFSQ2w5JlQIF0OJP9q.jpg","popularity":63754.923,"title":"Iron Man 2","vote_average":7.6,"vote_count":153},{"adult":false,"backdrop_path":null,"id":68721,"original_title":"Iron Man 3","release_date":"2013-05-03","poster_path":"/ixKNUY0SP6XkkmoM9Wtv5M9fSVq.jpg","popularity":2.057,"title":"Iron Man 3","vote_average":10.0,"vote_count":1},{"adult":false,"backdrop_path":"/uP7aqLFRDCBKIFlXzUjAdlvLLWc.jpg","id":13647,"original_title":"The Invincible Iron Man","release_date":"2007-01-23","poster_path":"/y64MWiAhRPE6kbnaaq3OtaLzE4P.jpg","popularity":0.407,"title":"The Invincible Iron Man","vote_average":6.8,"vote_count":2},{"adult":false,"backdrop_path":"/cByOkC6oQWMEKrNUtWPdpKMKnzT.jpg","id":9313,"original_title":"The Man in the Iron Mask","release_date":"1998-03-13","poster_path":"/q4zrsSUk84RhCwZthpoB3ICJKCk.jpg","popularity":2.0,"title":"The Man in the Iron Mask","vote_average":8.4,"vote_count":7},{"adult":false,"backdrop_path":"/uoaaqL0UDy80fX5wjFVnHf8QSR7.jpg","id":41428,"original_title":"Tetsuo","release_date":"1989-07-01","poster_path":"/w7HLpqSo44XO70xBD8iZz1IyhGl.jpg","popularity":0.091,"title":"Tetsuo: The Iron Man","vote_average":7.5,"vote_count":2},{"adult":false,"backdrop_path":null,"id":17883,"original_title":"Iron Man - Marvel / Jetix Animation DVD","release_date":"1994-01-01","poster_path":"/AbsrKvTTg6MbLqsduU5Vv0qkecY.jpg","popularity":0.007,"title":"Iron Man - Marvel / Jetix Animation DVD","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":92679,"original_title":"Chou Lian Huan","release_date":"1974-01-23","poster_path":"/oXuSvOyawTc5ATXD6gczV5TEi5b.jpg","popularity":0.008,"title":"Man Of Iron","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/7rgabNcJB2jPmWU1TqMzWMBrtbR.jpg","id":4199,"original_title":"The Man in the Iron Mask","release_date":"1977-07-07","poster_path":"/fK3lkuzoGvTO4OdDFo9ca27oB16.jpg","popularity":0.008,"title":"The Man in the Iron Mask","vote_average":7.5,"vote_count":1},{"adult":false,"backdrop_path":"/sen7Iu5widsUtMZ30UhQBTy2E1C.jpg","id":43836,"original_title":"The Man in the Iron Mask","release_date":"1939-07-13","poster_path":"/43WqoaSXeAKHTBX62RmKORuCr4V.jpg","popularity":0.002,"title":"The Man in the Iron Mask","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":97430,"original_title":"The Man with the Iron Fists","release_date":null,"poster_path":null,"popularity":0.06,"title":"The Man with the Iron Fists","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":225,"original_title":"Czlowiek z zelaza","release_date":"1981-07-27","poster_path":"/gmMcimLedQNLQNbSlLsONXZI1Ct.jpg","popularity":0.005,"title":"Man of Iron","vote_average":7.0,"vote_count":0},{"adult":false,"backdrop_path":"/kHqw7EktdUDVZ68fZOzubvK79eq.jpg","id":37113,"original_title":"David Knight: Iron Man of Enduro","release_date":null,"poster_path":"/jJcCt517cR1mauj6Bdfb5DBSwmB.jpg","popularity":0.06,"title":"David Knight: Iron Man of Enduro","vote_average":10.0,"vote_count":1},{"adult":false,"backdrop_path":null,"id":49187,"original_title":"Marvel Iron Man: The Complete Animated Series - Disc 1","release_date":null,"poster_path":"/1Il7FukSGvp0rMubjaMUueANHvM.jpg","popularity":0.06,"title":"Marvel Iron Man: The Complete Animated Series - Disc 1","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":49188,"original_title":"Marvel Iron Man: The Complete Animated Series - Disc 2","release_date":null,"poster_path":"/q4f0NUlaEtYPYkMfpiRMA1GZGQO.jpg","popularity":0.06,"title":"Marvel Iron Man: The Complete Animated Series - Disc 2","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":49189,"original_title":"Marvel Iron Man: The Complete Animated Series - Disc 3","release_date":null,"poster_path":"/lxwWWGuYPphgB3edSGkVswoA9pX.jpg","popularity":0.06,"title":"Marvel Iron Man: The Complete Animated Series - Disc 3","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":101803,"original_title":"Sam Peckinpah: Man of Iron","release_date":"1983-06-29","poster_path":"/peLpmC0FNcSZWq5FcWkdgm8RStG.jpg","popularity":0.005,"title":"Sam Peckinpah: Man of Iron","vote_average":0.0,"vote_count":0}],"total_pages":1,"total_results":18}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx
|
3
|
+
Date: Mon, 23 Aug 2010 16:41:11 GMT
|
4
|
+
Content-Type: text/json; charset=utf-8
|
5
|
+
Transfer-Encoding: chunked
|
6
|
+
Connection: keep-alive
|
7
|
+
Keep-Alive: timeout=20
|
8
|
+
Status: 200 OK
|
9
|
+
Cache-Control: public, max-age=21600
|
10
|
+
X-Varnish: 2542110576 2542059510
|
11
|
+
Age: 751
|
12
|
+
Via: 1.1 varnish
|
13
|
+
X-Cache: HIT
|
14
|
+
|
15
|
+
{"adult":false,"also_known_as":[],"biography":"From Wikipedia, the free encyclopedia.\n\nWilliam Bradley \"Brad\" Pitt (born December 18, 1963) is an American actor and film producer. Pitt has received two Academy Award nominations and four Golden Globe Award nominations, winning one. He has been described as one of the world's most attractive men, a label for which he has received substantial media attention.\n\nPitt began his acting career with television guest appearances, including a role on the CBS prime-time soap opera Dallas in 1987. He later gained recognition as the cowboy hitchhiker who seduces Geena Davis's character in the 1991 road movie Thelma & Louise. Pitt's first leading roles in big-budget productions came with A River Runs Through It (1992) and Interview with the Vampire (1994). He was cast opposite Anthony Hopkins in the 1994 drama Legends of the Fall, which earned him his first Golden Globe nomination. In 1995 he gave critically acclaimed performances in the crime thriller Seven and the science fiction film 12 Monkeys, the latter securing him a Golden Globe Award for Best Supporting Actor and an Academy Award nomination. Four years later, in 1999, Pitt starred in the cult hit Fight Club. He then starred in the major international hit as Rusty Ryan in Ocean's Eleven (2001) and its sequels, Ocean's Twelve (2004) and Ocean's Thirteen (2007). His greatest commercial successes have been Troy (2004) and Mr. & Mrs. Smith (2005). Pitt received his second Academy Award nomination for his title role performance in the 2008 film The Curious Case of Benjamin Button.\n\nFollowing a high-profile relationship with actress Gwyneth Paltrow, Pitt was married to actress Jennifer Aniston for five years. Pitt lives with actress Angelina Jolie in a relationship that has generated wide publicity. He and Jolie have six children—Maddox, Pax, Zahara, Shiloh, Knox, and Vivienne. Since beginning his relationship with Jolie, he has become increasingly involved in social issues both in the United States and internationally. Pitt owns a production company named Plan B Entertainment, whose productions include the 2007 Academy Award winning Best Picture, The Departed.\n\nDescription above from the Wikipedia article Brad Pitt, licensed under CC-BY-SA, full list of contributors on Wikipedia.","birthday":"1963-12-18","deathday":"","homepage":"http://simplybrad.com/","id":287,"name":"Brad Pitt","place_of_birth":"Shawnee, Oklahoma, United States","profile_path":"/w8zJQuN7tzlm6FY9mfGKihxp3Cb.jpg"}
|