Class: TMDb::Person
- Extended by:
- Searchable
- Defined in:
- lib/tmdb-api/person.rb
Constant Summary collapse
- ATTRIBUTES =
:id, :adult, :also_known_as, :biography, :homepage, :name, :place_of_birth, :profile_path, :popularity, :imdb_id, :known_for
Class Method Summary collapse
-
.find(id, options = {}) ⇒ Object
Public: Gets the basic person information for a specific person ID.
-
.images(id) ⇒ Object
Public: Gets the images for a specific person ID.
-
.popular(options = {}) ⇒ Object
Public: Gets a list of popular people.
Instance Method Summary collapse
-
#birthday ⇒ Object
Public: return the parsed birthday.
-
#deathday ⇒ Object
Public: return the parsed deathday.
Methods included from Searchable
Methods inherited from Base
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 , check the api documentation
Examples
TMDb::Person.find(138)
19 20 21 22 |
# File 'lib/tmdb-api/person.rb', line 19 def self.find(id, = {}) res = get("/person/#{id}", query: ) 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)
31 32 33 34 |
# File 'lib/tmdb-api/person.rb', line 31 def self.images(id) res = get("/person/#{id}/images") res.success? ? res : bad_response(res) end |
.popular(options = {}) ⇒ Object
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)
45 46 47 48 49 50 51 52 53 |
# File 'lib/tmdb-api/person.rb', line 45 def self.popular( = {}) res = get('/person/popular', query: ) if res.success? res['results'].map { |person| Person.new(person) } else bad_response(res) end end |
Instance Method Details
#birthday ⇒ Object
Public: return the parsed birthday.
56 57 58 |
# File 'lib/tmdb-api/person.rb', line 56 def birthday Date.parse(@birthday) rescue nil end |
#deathday ⇒ Object
Public: return the parsed deathday.
61 62 63 |
# File 'lib/tmdb-api/person.rb', line 61 def deathday Date.parse(@deathday) rescue nil end |