A Ruby interface to the Open Movie Database API
You must request an API key first from here
Add this line to your application's Gemfile:
gem 'omdb-api'And then execute:
$ bundle Or install it yourself as:
$ gem install omdb-api First you have to create a client object with your API key
client = Omdb::Api::Client.new(api_key: [your API key])`You can also set the API key with a block
client = Omdb::Api::Client.new do |config| config.api_key = api_key endrequire 'omdb/api' client.find_by_title('star wars') => #<Omdb::Api::Movie:0x007f9a7d453cf0 @actors="Harrison Ford"... client.find_by_id('tt0083929') => #<Omdb::Api::Movie:0x007f960a648f28 @actors="Sean Penn, Jennifer Jason Leigh, Judge Reinhold, Robert Romanus", client.search('indiana jones') => [#<Omdb::Api::Movie:0x007ffec28ad1a8 @title="Indiana...You can also pass options to these methods that match the available options from the OMDB API spec.
For example:
client.find_by_title('star wars', plot: 'short')`Returns an Omdb::Api::Models::Movie
An unsuccessful query will return an Omdb::Api::Models::Error object
Implement all query params
Parent
Omdb::Api::Movie
Methods
#actors
#awards
#box_office
#country
#director
#dvd
#error
#genre
#imdb_id
#imdb_rating
#imdb_votes
#language
#metascore
#plot
#poster
#rated
#released
#runtime
#title
#type
#writer
#year
Parent
Omdb::Api::Error
Methods
#response
#error
$ rake to run the specs
Bug reports and pull requests are welcome on GitHub at https://github.com/nikkypx/omdb-api.
The gem is available as open source under the terms of the MIT License.