maddox-tmdb_party 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/tmdb_party.rb +9 -3
- data/test/fixtures/single_result.xml +26 -0
- data/test/tmdb_party/test_tmdb_party.rb +13 -1
- data/tmdb_party.gemspec +9 -4
- metadata +5 -4
data/VERSION.yml
CHANGED
data/lib/tmdb_party.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
gem 'httparty'
|
1
|
+
# gem 'httparty'
|
2
2
|
require 'httparty'
|
3
3
|
require 'tmdb_party/core_extensions'
|
4
4
|
require 'tmdb_party/attributes'
|
@@ -19,8 +19,14 @@ module TMDBParty
|
|
19
19
|
|
20
20
|
def search(query)
|
21
21
|
data = self.class.get('/Movie.search', :query=>{:title=>query})
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
case data['results']['moviematches']['movie']
|
24
|
+
when Array
|
25
|
+
data['results']['moviematches']['movie'].collect { |movie| Movie.new(movie, self) }
|
26
|
+
when Hash
|
27
|
+
[Movie.new(data['results']['moviematches']['movie'], self)]
|
28
|
+
else
|
29
|
+
[]
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<results for="sweeney todd" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
|
3
|
+
<opensearch:Query searchTerms="sweeney todd"/>
|
4
|
+
<opensearch:totalResults>1</opensearch:totalResults>
|
5
|
+
<moviematches>
|
6
|
+
<movie>
|
7
|
+
<score>1.0</score>
|
8
|
+
<popularity>2</popularity>
|
9
|
+
<title>Sweeney Todd: The Demon Barber of Fleet Street</title>
|
10
|
+
<alternative_title></alternative_title>
|
11
|
+
<type>movie</type>
|
12
|
+
<id>13885</id>
|
13
|
+
<imdb>tt0408236</imdb>
|
14
|
+
<url>http://www.themoviedb.org/movie/13885</url>
|
15
|
+
<short_overview>The infamous story of Benjamin Barker, a.k.a Sweeney Todd, who sets up a barber shop down in London which is the basis for a sinister partnership with his fellow tenant, Mrs. Lovett. Based on the hit Broadway musical.</short_overview>
|
16
|
+
<release>2007-12-21</release>
|
17
|
+
<poster size="original">http://images.themoviedb.org/posters/8329/folder.jpg</poster>
|
18
|
+
<poster size="thumb">http://images.themoviedb.org/posters/8329/folder_thumb.jpg</poster>
|
19
|
+
<poster size="cover">http://images.themoviedb.org/posters/8329/folder_cover.jpg</poster>
|
20
|
+
<poster size="mid">http://images.themoviedb.org/posters/8329/folder_mid.jpg</poster>
|
21
|
+
<backdrop size="original">http://images.themoviedb.org/backdrops/15314/sweeney_todd.jpg</backdrop>
|
22
|
+
<backdrop size="mid">http://images.themoviedb.org/backdrops/15314/sweeney_todd_poster.jpg</backdrop>
|
23
|
+
<backdrop size="thumb">http://images.themoviedb.org/backdrops/15314/sweeney_todd_thumb.jpg</backdrop>
|
24
|
+
</movie>
|
25
|
+
</moviematches>
|
26
|
+
</results>
|
@@ -39,6 +39,19 @@ class TestTmdbParty < Test::Unit::TestCase
|
|
39
39
|
assert_equal "http://www.themoviedb.org/encyclopedia/category/12", category.url
|
40
40
|
end
|
41
41
|
|
42
|
+
test "getting a single result" do
|
43
|
+
stub_get('/Movie.search?api_key=key&title=sweeney%20todd', 'single_result.xml')
|
44
|
+
|
45
|
+
results = @tmdb.search('sweeney todd')
|
46
|
+
|
47
|
+
assert_equal 1, results.length
|
48
|
+
|
49
|
+
sweeney_todd = results.first
|
50
|
+
|
51
|
+
assert_equal 'tt0408236', sweeney_todd.imdb
|
52
|
+
end
|
53
|
+
|
54
|
+
|
42
55
|
|
43
56
|
test "finding transformers via imdb id" do
|
44
57
|
stub_get('/Movie.imdbLookup?api_key=key&imdb_id=tt0418279', 'imdb_search.xml')
|
@@ -68,7 +81,6 @@ class TestTmdbParty < Test::Unit::TestCase
|
|
68
81
|
test "NOT finding transformers via imdb id" do
|
69
82
|
stub_get('/Movie.imdbLookup?api_key=key&imdb_id=tt0418279dd', 'imdb_no_results.xml')
|
70
83
|
result = @tmdb.imdb_lookup('tt0418279dd')
|
71
|
-
puts result.inspect
|
72
84
|
assert_nil result
|
73
85
|
end
|
74
86
|
|
data/tmdb_party.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{tmdb_party}
|
5
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["John Duff"]
|
9
|
-
s.date = %q{2009-08
|
12
|
+
s.date = %q{2009-09-08}
|
10
13
|
s.email = %q{duff.john@gmail.com}
|
11
14
|
s.extra_rdoc_files = [
|
12
15
|
"LICENSE",
|
@@ -29,15 +32,17 @@ Gem::Specification.new do |s|
|
|
29
32
|
"test/fixtures/imdb_no_results.xml",
|
30
33
|
"test/fixtures/imdb_search.xml",
|
31
34
|
"test/fixtures/search.xml",
|
35
|
+
"test/fixtures/single_result.xml",
|
32
36
|
"test/fixtures/transformers.xml",
|
33
37
|
"test/test_helper.rb",
|
34
38
|
"test/tmdb_party/test_tmdb_party.rb",
|
35
39
|
"tmdb_party.gemspec"
|
36
40
|
]
|
41
|
+
s.has_rdoc = true
|
37
42
|
s.homepage = %q{http://github.com/jduff/tmdb_party}
|
38
43
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
44
|
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.
|
45
|
+
s.rubygems_version = %q{1.3.1}
|
41
46
|
s.summary = %q{TODO}
|
42
47
|
s.test_files = [
|
43
48
|
"test/test_helper.rb",
|
@@ -46,7 +51,7 @@ Gem::Specification.new do |s|
|
|
46
51
|
|
47
52
|
if s.respond_to? :specification_version then
|
48
53
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
-
s.specification_version =
|
54
|
+
s.specification_version = 2
|
50
55
|
|
51
56
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
57
|
s.add_runtime_dependency(%q<httparty>, [">= 0.4.3"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maddox-tmdb_party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Duff
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08
|
12
|
+
date: 2009-09-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -68,11 +68,12 @@ files:
|
|
68
68
|
- test/fixtures/imdb_no_results.xml
|
69
69
|
- test/fixtures/imdb_search.xml
|
70
70
|
- test/fixtures/search.xml
|
71
|
+
- test/fixtures/single_result.xml
|
71
72
|
- test/fixtures/transformers.xml
|
72
73
|
- test/test_helper.rb
|
73
74
|
- test/tmdb_party/test_tmdb_party.rb
|
74
75
|
- tmdb_party.gemspec
|
75
|
-
has_rdoc:
|
76
|
+
has_rdoc: true
|
76
77
|
homepage: http://github.com/jduff/tmdb_party
|
77
78
|
licenses:
|
78
79
|
post_install_message:
|
@@ -97,7 +98,7 @@ requirements: []
|
|
97
98
|
rubyforge_project:
|
98
99
|
rubygems_version: 1.3.5
|
99
100
|
signing_key:
|
100
|
-
specification_version:
|
101
|
+
specification_version: 2
|
101
102
|
summary: TODO
|
102
103
|
test_files:
|
103
104
|
- test/test_helper.rb
|