maddox-tmdb_party 0.2.0 → 0.2.1
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/category.rb +1 -1
- data/lib/tmdb_party/movie.rb +2 -1
- data/lib/tmdb_party/person.rb +21 -0
- data/lib/tmdb_party.rb +1 -0
- data/test/tmdb_party/test_tmdb_party.rb +16 -0
- data/tmdb_party.gemspec +2 -1
- metadata +3 -3
data/VERSION.yml
CHANGED
data/lib/tmdb_party/category.rb
CHANGED
data/lib/tmdb_party/movie.rb
CHANGED
@@ -5,13 +5,14 @@ module TMDBParty
|
|
5
5
|
|
6
6
|
attributes :title, :short_overview, :id, :score, :imdb, :type, :url, :popularity, :alternative_title
|
7
7
|
attributes :release, :type=>DateTime
|
8
|
-
attributes :id, :type => Integer
|
8
|
+
attributes :id, :runtime, :type => Integer
|
9
9
|
attributes :popularity, :score, :type => Float
|
10
10
|
attributes :poster, :backdrop, :type => Image
|
11
11
|
|
12
12
|
attributes :homepage, :lazy => :get_info!
|
13
13
|
attributes :trailer, :lazy => :get_info!, :type=> Video
|
14
14
|
attributes :categories, :lazy => :get_info!, :type=> Category
|
15
|
+
attributes :people, :lazy => :get_info!, :type=> Person
|
15
16
|
|
16
17
|
def initialize(values, tmdb)
|
17
18
|
@tmdb = tmdb
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TMDBParty
|
2
|
+
class Person
|
3
|
+
include Attributes
|
4
|
+
attributes :name, :url, :job
|
5
|
+
|
6
|
+
def initialize(values)
|
7
|
+
self.attributes = values
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parse(data)
|
11
|
+
data = data["person"]
|
12
|
+
if data.is_a?(Array)
|
13
|
+
data.collect do |person|
|
14
|
+
Person.new(person)
|
15
|
+
end
|
16
|
+
else
|
17
|
+
Person.new(data)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/tmdb_party.rb
CHANGED
@@ -37,6 +37,22 @@ class TestTmdbParty < Test::Unit::TestCase
|
|
37
37
|
|
38
38
|
category = transformers.categories.detect{|cat| cat.name == "Adventure Film"}
|
39
39
|
assert_equal "http://www.themoviedb.org/encyclopedia/category/12", category.url
|
40
|
+
|
41
|
+
|
42
|
+
assert_equal 132, transformers.runtime
|
43
|
+
assert_equal 35, transformers.people.length
|
44
|
+
|
45
|
+
# assert_equal 1.0, transformers.score
|
46
|
+
# assert_equal 1.0, transformers.score
|
47
|
+
# assert_equal 1.0, transformers.score
|
48
|
+
# assert_equal 1.0, transformers.score
|
49
|
+
# assert_equal 1.0, transformers.score
|
50
|
+
# assert_equal 1.0, transformers.score
|
51
|
+
# assert_equal 1.0, transformers.score
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
40
56
|
end
|
41
57
|
|
42
58
|
test "getting a single result" do
|
data/tmdb_party.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tmdb_party}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John Duff"]
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/tmdb_party/core_extensions.rb",
|
29
29
|
"lib/tmdb_party/image.rb",
|
30
30
|
"lib/tmdb_party/movie.rb",
|
31
|
+
"lib/tmdb_party/person.rb",
|
31
32
|
"lib/tmdb_party/video.rb",
|
32
33
|
"test/fixtures/imdb_no_results.xml",
|
33
34
|
"test/fixtures/imdb_search.xml",
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Duff
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/tmdb_party/core_extensions.rb
|
65
65
|
- lib/tmdb_party/image.rb
|
66
66
|
- lib/tmdb_party/movie.rb
|
67
|
+
- lib/tmdb_party/person.rb
|
67
68
|
- lib/tmdb_party/video.rb
|
68
69
|
- test/fixtures/imdb_no_results.xml
|
69
70
|
- test/fixtures/imdb_search.xml
|
@@ -75,7 +76,6 @@ files:
|
|
75
76
|
- tmdb_party.gemspec
|
76
77
|
has_rdoc: true
|
77
78
|
homepage: http://github.com/jduff/tmdb_party
|
78
|
-
licenses:
|
79
79
|
post_install_message:
|
80
80
|
rdoc_options:
|
81
81
|
- --charset=UTF-8
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
requirements: []
|
97
97
|
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.2.0
|
100
100
|
signing_key:
|
101
101
|
specification_version: 2
|
102
102
|
summary: TODO
|