+++ date = "2009-06-03" title = "Ruby Gem: IMDB" tags = ["General", "Ruby", "imdb", "gem", "api"] slug = "ruby-gem-imdb" +++ I just released version 0.1.0 of my IMDB gem which allows your app to search IMDB for IMDB movie ID's and access most data that's publicly available. ## Installation ``` shell sudo gem install imdb ``` This will also install the dependencies Hpricot and HTTParty. ## Usage In your project, include the gem (and possibly rubygems as well). ``` ruby require 'rubygems' require 'imdb' search = Imdb::Search.new('Star Trek') => # puts search.movies[0..3].collect{ |m| [m.id, m.title].join(" - ") }.join("\n") => 0060028 - "Star Trek" (1966) (TV series) 0796366 - Star Trek (2009) 0092455 - "Star Trek: The Next Generation" (1987) (TV series) 0112178 - "Star Trek: Voyager" (1995) (TV series) st = Imdb::Movie.new("0796366") => # st.title => "Star Trek" st.year => 2009 st.rating => 8.4 st.cast_members[0..2].join(", ") => "Chris Pine, Zachary Quinto, Leonard Nimoy" ``` As you can see, both `Imdb::Search` and `Imdb::Movie` are lazy loading, only doing a HTTP request when you actually request data. Also, the remote HTTP data is cached trhough-out the life span of your Imdb::Movie object. ## Documentation Generated RDoc documentation can be found at [http://ariejan.github.com/imdb/][1]. [1]: http://ariejan.github.com/imdb/ ## Issues, feature requests, patches, the works Please use https://github.com/ariejan/imdb to supply patches (preferably through a pull-request) and to report issues.