Sha256: db26d71294c394654d1844c149d28c42dc0770002b189a86e5ea8bdfb3ca8be4

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

module Omdb
  module Api
    class Movie
      MOVIE_ATTRIBUTES = %i[
        actors
        awards
        country
        director
        genre
        imdbid
        imdbrating
        imdbvotes
        language
        metascore
        plot
        poster
        rated
        released
        runtime
        title
        type
        writer
        year
        error
      ].freeze

      attr_reader(*MOVIE_ATTRIBUTES)

      def initialize(response)
        attrs(response)
      end

      def attrs(response)
        response.each_key do |key|
          instance_variable_set("@#{key.downcase}".to_sym, response[key])
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omdb-api-1.0.0 lib/omdb/api/movie.rb