Class: Tmdb::Person

Inherits:
Resource show all
Defined in:
lib/themoviedb/person.rb

Constant Summary collapse

@@fields =
[
  :adult,
  :also_known_as,
  :biography,
  :birthday,
  :deathday,
  :homepage,
  :id,
  :known_for,
  :name,
  :place_of_birth,
  :profile_path,
  :movie_credits,
  :tv_credits,
  :combined_credits,
  :images,
  :changes
]

Class Method Summary collapse

Methods inherited from Resource

detail, endpoint_id, endpoints, has_resource, #initialize, list, search

Constructor Details

This class inherits a constructor from Tmdb::Resource

Class Method Details

.changes(id, _conditions = {}) ⇒ Object

Get the changes for a specific person id. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.



85
86
87
88
# File 'lib/themoviedb/person.rb', line 85

def self.changes(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/changes")
  search.fetch_response
end

.credits(id, _conditions = {}) ⇒ Object

Get the combined credits for a specific person id.



46
47
48
49
# File 'lib/themoviedb/person.rb', line 46

def self.credits(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/combined_credits")
  search.fetch_response
end

.external_ids(id, _conditions = {}) ⇒ Object

Get external ID’s for a specific person id.



64
65
66
67
# File 'lib/themoviedb/person.rb', line 64

def self.external_ids(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/external_ids")
  search.fetch_response
end

.images(id, _conditions = {}) ⇒ Object

Get the images for a specific person id.



70
71
72
73
# File 'lib/themoviedb/person.rb', line 70

def self.images(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
  search.fetch_response
end

.latestObject

Get the latest person id.



40
41
42
43
# File 'lib/themoviedb/person.rb', line 40

def self.latest
  search = Tmdb::Search.new("/#{endpoints[:singular]}/latest")
  person = new(search.fetch_response)
end

.movie_credits(id, _conditions = {}) ⇒ Object

Get film credits for a specific person id.



52
53
54
55
# File 'lib/themoviedb/person.rb', line 52

def self.movie_credits(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/movie_credits")
  search.fetch_response
end

Get the list of popular people on The Movie Database. This list refreshes every day.



30
31
32
33
34
35
36
37
# File 'lib/themoviedb/person.rb', line 30

def self.popular
  search = Tmdb::Search.new("/#{endpoints[:singular]}/popular")
  search.fetch.collect do |result|
    next unless result['known_for']
    result['known_for'] = result['known_for'].collect { |movie| Tmdb::Movie.new(movie) }
    new(result)
  end
end

.tagged_images(id, _conditions = {}) ⇒ Object

Get the tagged images for a specific person id.



76
77
78
79
# File 'lib/themoviedb/person.rb', line 76

def self.tagged_images(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/tagged_images")
  search.fetch_response
end

.tv_credits(id, _conditions = {}) ⇒ Object

Get TV credits for a specific person id.



58
59
60
61
# File 'lib/themoviedb/person.rb', line 58

def self.tv_credits(id, _conditions = {})
  search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/tv_credits")
  search.fetch_response
end