themoviedb 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/themoviedb.rb +1 -1
- data/lib/themoviedb/{people.rb → person.rb} +8 -8
- data/lib/themoviedb/version.rb +1 -1
- data/spec/person_spec.rb +104 -0
- data/themoviedb.gemspec +2 -2
- metadata +7 -7
- data/spec/people_spec.rb +0 -27
data/lib/themoviedb.rb
CHANGED
@@ -5,7 +5,7 @@ require 'httparty'
|
|
5
5
|
require File.join(File.dirname(__FILE__), "themoviedb", inc)
|
6
6
|
end
|
7
7
|
|
8
|
-
["movie", "tv", "season", "episode", "collection", "
|
8
|
+
["movie", "tv", "season", "episode", "collection", "person", "company", "genre", "find", "job"].each do |inc|
|
9
9
|
require File.join(File.dirname(__FILE__), "themoviedb", inc)
|
10
10
|
end
|
11
11
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Tmdb
|
2
|
-
class
|
3
|
-
has_resource 'person', :plural => '
|
2
|
+
class Person < Resource
|
3
|
+
has_resource 'person', :plural => 'people'
|
4
4
|
|
5
5
|
#http://docs.themoviedb.apiary.io/#people
|
6
6
|
@@fields = [
|
@@ -15,20 +15,20 @@ module Tmdb
|
|
15
15
|
:place_of_birth,
|
16
16
|
:profile_path
|
17
17
|
]
|
18
|
-
|
18
|
+
|
19
19
|
@@fields.each do |field|
|
20
20
|
attr_accessor field
|
21
21
|
end
|
22
22
|
|
23
23
|
#Get the list of popular people on The Movie Database. This list refreshes every day.
|
24
24
|
def self.popular
|
25
|
-
search = Tmdb::Search.new("/
|
25
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/popular")
|
26
26
|
search.fetch
|
27
27
|
end
|
28
28
|
|
29
29
|
#Get the latest person id.
|
30
30
|
def self.latest
|
31
|
-
search = Tmdb::Search.new("/
|
31
|
+
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/latest")
|
32
32
|
search.fetch_response
|
33
33
|
end
|
34
34
|
|
@@ -45,8 +45,8 @@ module Tmdb
|
|
45
45
|
end
|
46
46
|
|
47
47
|
#Get the changes for a specific person id.
|
48
|
-
#Changes are grouped by key, and ordered by date in descending order.
|
49
|
-
#By default, only the last 24 hours of changes are returned.
|
48
|
+
#Changes are grouped by key, and ordered by date in descending order.
|
49
|
+
#By default, only the last 24 hours of changes are returned.
|
50
50
|
#The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
|
51
51
|
def self.changes(id, conditions={})
|
52
52
|
search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/changes")
|
@@ -54,4 +54,4 @@ module Tmdb
|
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
57
|
-
end
|
57
|
+
end
|
data/lib/themoviedb/version.rb
CHANGED
data/spec/person_spec.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'rspec'
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
describe Tmdb::Person do
|
7
|
+
@fields = [:id,:name,:place_of_birth,:also_known_as,
|
8
|
+
:adult,:biography,:birthday,:deathday,:homepage,
|
9
|
+
:profile_path]
|
10
|
+
|
11
|
+
@fields.each do |field|
|
12
|
+
it { should respond_to field }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "For person p" do
|
16
|
+
before(:each) do
|
17
|
+
@person = Tmdb::Person
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the popular people" do
|
21
|
+
VCR.use_cassette 'person/popular' do
|
22
|
+
@person.popular.should be_true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return the latest person" do
|
27
|
+
VCR.use_cassette 'person/latest' do
|
28
|
+
@person.latest.should be_true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return credits for a person ID" do
|
33
|
+
VCR.use_cassette 'person/credits' do
|
34
|
+
@person.credits(5292).should be_true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should return changes for a person ID" do
|
39
|
+
VCR.use_cassette 'person/changes' do
|
40
|
+
@person.changes(5292).should be_true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "For a person detail" do
|
46
|
+
before(:each) do
|
47
|
+
VCR.use_cassette 'person/detail' do
|
48
|
+
@person = Tmdb::Person.detail(5292)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return a id" do
|
53
|
+
@person.id.should == 5292
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return a name" do
|
57
|
+
@person.name.should == "Denzel Washington"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return a adult" do
|
61
|
+
@person.adult.should == false
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should return a biography" do
|
65
|
+
@person.biography.should == "From Wikipedia, the free encyclopedia.\n\nDenzel Hayes Washington, Jr. (born December 28, 1954) is an American actor, screenwriter, director and film producer. He first rose to prominence when he joined the cast of the medical drama St. Elsewhere, playing Dr. Philip Chandler for six years. He has received much critical acclaim for his work in film since the 1990s, including for his portrayals of real-life figures, such as Steve Biko, Malcolm X, Rubin \"Hurricane\" Carter, Melvin B. Tolson, Frank Lucas, and Herman Boone.\n\nWashington has received two Academy Awards, two Golden Globe awards, a Tony Award. He is notable for winning the Best Supporting Actor for Glory in 1989; and the Academy Award for Best Actor in 2001 for his role in the film Training Day\n\nDescription above from the Wikipedia article Denzel Washington, licensed under CC-BY-SA, full list of contributors on Wikipedia."
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should return a birthday" do
|
69
|
+
@person.birthday.should == "1954-12-28"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return a deathday" do
|
73
|
+
@person.deathday.should == ""
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should return a homepage" do
|
77
|
+
@person.homepage.should == ""
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return a place of birth" do
|
81
|
+
@person.place_of_birth.should == "Mount Vernon, New York, USA"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should return a profile path" do
|
85
|
+
@person.profile_path.should == "/khMf8LLTtppUwuZqqnigD2nAy26.jpg"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should return an array with also known as names" do
|
89
|
+
@person.also_known_as.should == []
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "For images of a person" do
|
94
|
+
before(:each) do
|
95
|
+
VCR.use_cassette 'person/images' do
|
96
|
+
@person_images = Tmdb::Person.images(5292)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should return profiles" do
|
101
|
+
@person_images['profiles'].length == 6
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/themoviedb.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
"lib/themoviedb/genre.rb",
|
22
22
|
"lib/themoviedb/job.rb",
|
23
23
|
"lib/themoviedb/movie.rb",
|
24
|
-
"lib/themoviedb/
|
24
|
+
"lib/themoviedb/person.rb",
|
25
25
|
"lib/themoviedb/resource.rb",
|
26
26
|
"lib/themoviedb/search.rb",
|
27
27
|
"lib/themoviedb/season.rb",
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
"spec/movie_spec.rb",
|
35
35
|
"spec/tv_spec.rb",
|
36
36
|
"spec/company_spec.rb",
|
37
|
-
"spec/
|
37
|
+
"spec/person_spec.rb",
|
38
38
|
"spec/find_spec.rb"
|
39
39
|
]
|
40
40
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: themoviedb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement: &
|
16
|
+
requirement: &19356660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19356660
|
25
25
|
description: Provides a simple, easy to use interface for the Movie Database API.
|
26
26
|
email:
|
27
27
|
- ahmetabdi@gmail.com
|
@@ -38,7 +38,7 @@ files:
|
|
38
38
|
- lib/themoviedb/genre.rb
|
39
39
|
- lib/themoviedb/job.rb
|
40
40
|
- lib/themoviedb/movie.rb
|
41
|
-
- lib/themoviedb/
|
41
|
+
- lib/themoviedb/person.rb
|
42
42
|
- lib/themoviedb/resource.rb
|
43
43
|
- lib/themoviedb/search.rb
|
44
44
|
- lib/themoviedb/season.rb
|
@@ -49,7 +49,7 @@ files:
|
|
49
49
|
- spec/movie_spec.rb
|
50
50
|
- spec/tv_spec.rb
|
51
51
|
- spec/company_spec.rb
|
52
|
-
- spec/
|
52
|
+
- spec/person_spec.rb
|
53
53
|
- spec/find_spec.rb
|
54
54
|
homepage: http://rubygems.org/gems/themoviedb
|
55
55
|
licenses: []
|
@@ -79,5 +79,5 @@ test_files:
|
|
79
79
|
- spec/movie_spec.rb
|
80
80
|
- spec/tv_spec.rb
|
81
81
|
- spec/company_spec.rb
|
82
|
-
- spec/
|
82
|
+
- spec/person_spec.rb
|
83
83
|
- spec/find_spec.rb
|
data/spec/people_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
require 'rspec'
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'vcr'
|
5
|
-
|
6
|
-
describe Tmdb::People do
|
7
|
-
|
8
|
-
@fields = [:id,:name,:place_of_birth,:also_known_as,
|
9
|
-
:adult,:biography,:birthday,:deathday,:homepage,
|
10
|
-
:profile_path]
|
11
|
-
|
12
|
-
@fields.each do |field|
|
13
|
-
it { should respond_to field }
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "For people" do
|
17
|
-
before(:each) do
|
18
|
-
@people = Tmdb::People
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return the popular people" do
|
22
|
-
VCR.use_cassette 'people/popular' do
|
23
|
-
@people.popular.should be_true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|