Sha256: 063af421759871c8c33db6ba39884060b12d69685b0304dd589136c8707ed0a0
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
module FilmBuff class IMDb attr_accessor :locale include HTTParty include HTTParty::Icebox cache :store => 'memory', :timeout => 120 base_uri 'app.imdb.com' format :json def initialize @locale = "en_US" end public def find_by_id(imdb_id) result = self.class.get('/title/maindetails', :query => { :tconst => imdb_id, :locale => @locale }).parsed_response Title.new(result["data"]) end def find_by_title(title) result = self.class.get('http://www.imdb.com/xml/find', :query => { :q => title, :json => '1', :tt => 'on' }).parsed_response %w(title_popular title_exact title_approx title_substring).each do |key| if result[key] result[key].each do |row| next unless row['id'] && row['title'] && row['description'] return self.find_by_id(row['id']) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
filmbuff-0.1.6 | lib/filmbuff/imdb.rb |