Sha256: 4016a0f63389fc7d85fab0757a1a12a83c79add7d4ebadfad97c7a225c7ec82e

Contents?: true

Size: 611 Bytes

Versions: 3

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true
require_relative 'omdb_api'

module Movlog
  # Movie info
  class Movie
    attr_reader :imdb_id, :title, :year, :actors, :poster, :plot, :location

    def initialize(data:)
      @imdb_id = data['imdbID']
      @title = data['Title']
      @year = data['Year']
      @actors = data['Actors']
      @poster = data['Poster']
      @plot = data['Plot']
    end

    def self.find(t:)
      movie_data = OmdbApi.movie_info(t)
      new(data: movie_data)
    end

    def get_location
      return @location if @location
      @location = OmdbApi.location(@imdb_id)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
movlog-0.2.11 lib/movlog/movie.rb
movlog-0.2.10 lib/movlog/movie.rb
movlog-0.2.9 lib/movlog/movie.rb