Sha256: b3be229a17587ea49d8aba63d02915f04ae2eb5a276f1f0aea4ed2570f49f063
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 Bytes
Contents
module FilmBuff class IMDb attr_accessor :locale include HTTParty include HTTParty::Icebox cache :store => 'file', :timeout => 120, :location => Dir.tmpdir base_uri 'app.imdb.com' default_params = { "api" => "v1", "app_id" => "iphone1_1", "timestamp" => Time.now.utc.to_i, "sig" => "app1_1" } 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) results = self.class.get('/find', :query => { q: title, locale: @locale }).parsed_response find_by_id(results["data"]["results"][0]["list"][0]["tconst"]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
filmbuff-0.1.2 | lib/filmbuff/imdb.rb |