Sha256: f318c48003c60550c9759c37e1515263fa127875e08701390825e29e880e4c70
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
gem 'httparty' require 'httparty' require 'tmdb_party/core_extensions' require 'tmdb_party/attributes' require 'tmdb_party/video' require 'tmdb_party/category' require 'tmdb_party/image' require 'tmdb_party/movie' module TMDBParty class Base include HTTParty base_uri 'http://api.themoviedb.org/2.0' format :xml def initialize(key) self.class.default_params :api_key => key end def search(query) data = self.class.get('/Movie.search', :query=>{:title=>query}) data['results']['moviematches']['movie'].collect do |movie| Movie.new(movie, self) end end def imdb_lookup(imdb_id) data = self.class.get('/Movie.imdbLookup', :query=>{:imdb_id=>imdb_id}) case data['results']['moviematches']['movie'] when String return nil when Hash Movie.new(data['results']['moviematches']['movie'], self) end end def get_info(id) data = self.class.get('/Movie.getInfo', :query=>{:id=>id}) Movie.new(data['results']['moviematches']['movie'], self) end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
jduff-tmdb_party-0.1.0 | lib/tmdb_party.rb |
maddox-tmdb_party-0.1.0 | lib/tmdb_party.rb |