class TMDb::Person
Public Class Methods
find(id)
click to toggle source
Returns the person with TMDb
id of id
.
# File lib/tmdb/person.rb, line 25 def self.find(id) begin response = TMDb.get_api_response("person/#{id}") new(response) rescue ServiceUnavailable TMDb.configuration.null_person || raise end end
new(args)
click to toggle source
# File lib/tmdb/person.rb, line 19 def initialize(args) @tmdb_attrs = args end
where(args)
click to toggle source
Returns an enumerable containing all the people matching the condition hash. Currently the only condition that can be specified is name, e.g.
people = Person.where(:name => 'Reeves')
Only the first page of results (20 people) are returned.
# File lib/tmdb/person.rb, line 42 def self.where(args) response = TMDb.get_api_response('search/person', :query => args[:name]) response['results'].map {|attrs| new(attrs) } end
Public Instance Methods
profile_image_url(size)
click to toggle source
Returns a URL for the person’s profile image at the given size
. Valid sizes should be discovered via the Configuration.image_profile_sizes
method. Returns nil if the person does not have a profile image.
# File lib/tmdb/person.rb, line 51 def profile_image_url(size) if profile_path [TMDb.configuration.image_base_url, size, profile_path].join end end