Sha256: b36a5b8cf67e0994af53bd6ab1d37d0196683db04bcc6ee0b075a3d0d3abb9f0

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

# TODO: See about making this a deepopenstruct: https://github.com/aarongough/deepopenstruct
# TODO: Review http://ruby.learncodethehardway.org/book/ex44.html first, figure out if we ant to use inheritance or composition

module TMDB
  class Movie

      def self.search(options = {})
        # Accepted parameters:
        # :page, :include_adult (true / false), :year
        options.merge!(api_key: TMDB::API.api_key)
        results = TMDB::API.get("/3/search/movie", query: options)['results']
        movies = []
        results.each do |result|
          movies.push(Hashie::Mash.new(result))
        end
        return movies
      end

      def self.id(movie_id)
        options = { api_key: TMDB::API.api_key }
        Hashie::Mash.new(TMDB::API.get("/3/movie/#{movie_id}", query: options))
        # movie.title = "Fight Club"
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tmdb-0.2.0 lib/tmdb/movie.rb