Class: OMDB::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/omdbapi/client.rb

Overview

Client for handling requests to the omdbapi.com API.

See Also:

Instance Method Summary collapse

Instance Method Details

#find(title) ⇒ Array, Hash

Find a movie by its title.

Examples:

OMDB.find('Star Wars')

Parameters:

  • title (String)

    The title of the movie or show to find.

Returns:



38
39
40
41
# File 'lib/omdbapi/client.rb', line 38

def find(title)
  results = get '/', { s: title }
  results[:search] ? results[:search] : results
end

#id(imdb_id) ⇒ Hash

Retrieves a movie or show based on its IMDb ID.

Examples:

OMDB.id('tt0944947')

Parameters:

  • imdb_id (String)

    The IMDb ID of the movie or show.

Returns:



28
29
30
# File 'lib/omdbapi/client.rb', line 28

def id(imdb_id) 
  return get '/', { i: imdb_id }
end

#title(title, year = nil) ⇒ Hash

Retrieves a movie or show based on its title.

Examples:

OMDB.title('Game of Thrones')

Parameters:

  • title (String)

    The title of the movie or show.

Returns:



17
18
19
# File 'lib/omdbapi/client.rb', line 17

def title(title, year=nil)
  get '/', { t: title }
end