Skip to content

nikkypx/omdb-api

Repository files navigation

Omdb Api

A Ruby interface to the Open Movie Database API

Required

You must request an API key first from here

Installation

Add this line to your application's Gemfile:

gem 'omdb-api'

And then execute:

$ bundle 

Or install it yourself as:

$ gem install omdb-api 

Usage

Configuration

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 end

Fetching

require '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

TODO

Implement all query params

API

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

Development

$ rake to run the specs

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nikkypx/omdb-api.

License

The gem is available as open source under the terms of the MIT License.

About

Ruby interface to the OMDB API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages