Class: TMDb::Person

Inherits:
Base
  • Object
show all
Extended by:
Searchable
Defined in:
lib/tmdb-api/person.rb

Constant Summary collapse

ATTRIBUTES =

Person attributes

:id, :adult, :also_known_as, :biography, :birthday, :deathday,
:homepage, :name, :place_of_birth, :profile_path, :popularity, :imdb_id

Class Method Summary collapse

Methods included from Searchable

search

Methods inherited from Base

bad_response, #initialize

Constructor Details

This class inherits a constructor from TMDb::Base

Class Method Details

.find(id, options = {}) ⇒ Object

Public: Gets the basic person information for a specific person ID.

id - The ID of the person. options - The hash options used to filter the search (default: {}):

More information about the options, check the api documentation

Examples

TMDb::Person.find(138)



20
21
22
23
# File 'lib/tmdb-api/person.rb', line 20

def self.find(id, options = {})
  res = get("/person/#{id}", query: options)
  res.success? ? Person.new(res) : bad_response(res)
end

.images(id) ⇒ Object

Public: Gets the images for a specific person ID.

id - The person’s ID

Examples

TMDb::Person.images(138)



32
33
34
35
# File 'lib/tmdb-api/person.rb', line 32

def self.images(id)
  res = get("/person/#{id}/images")
  res.success? ? res : bad_response(res)
end

Public: Gets a list of popular people.

options - The hash options used to filter the search (default: {}):

:page - List's page.

Examples

TMDb::Person.popular TMDb::Person.popular(page: 4)



46
47
48
49
50
51
52
53
54
# File 'lib/tmdb-api/person.rb', line 46

def self.popular(options = {})
  res = get('/person/popular', query: options)

  if res.success?
    res['results'].map { |person| Person.new(person) }
  else
    bad_response(res)
  end
end