class Movlog::Movie

Movie info

Attributes

actors[R]
awards[R]
country[R]
director[R]
genre[R]
imdb_id[R]
language[R]
location[R]
plot[R]
poster[R]
rating[R]
released[R]
response[R]
runtime[R]
title[R]
type[R]
year[R]

Public Class Methods

find(data) click to toggle source
# File lib/movlog/movie.rb, line 22
def self.find(data)
  new(data: data)
end
new(data:) click to toggle source
# File lib/movlog/movie.rb, line 14
def initialize(data:)
  @imdb_id = data[:imdb_id]
  @title = data[:title]
  @year = data[:year]
  @type = data[:type]
  @poster = data[:poster]
end

Public Instance Methods

get_details() click to toggle source
# File lib/movlog/movie.rb, line 31
def get_details
  movie_details = OmdbApi.movie_info(@title)
  parse_details(details: movie_details)
end
get_location() click to toggle source
# File lib/movlog/movie.rb, line 26
def get_location
  return @location if @location
  @location = OmdbApi.location(@imdb_id)
end
parse_details(details:) click to toggle source
# File lib/movlog/movie.rb, line 36
def parse_details(details:)
  @rating = details['imdbRating']
  @plot = details['Plot']
  @runtime = details['Runtime']
  @awards = details['Awards']
  @director = details['Director']
  @actors = details['Actors']
  @country = details['Country']
  @language = details['Language']
  @released = details['Released']
  @genre = details['Genre']
end