lib/ruby-tmdb/tmdb.rb in ruby-tmdb-0.1.2 vs lib/ruby-tmdb/tmdb.rb in ruby-tmdb-0.1.3

- old
+ new

@@ -1,11 +1,11 @@ class Tmdb require 'net/http' require 'uri' require 'cgi' - require 'yaml' + require 'json' require 'deepopenstruct' @@api_key = "" @@api_response = {} @@ -21,15 +21,15 @@ "http://api.themoviedb.org/2.1/" end def self.api_call(method, data, language = "en") raise ArgumentError, "Tmdb.api_key must be set before using the API" if(Tmdb.api_key.nil? || Tmdb.api_key.empty?) - url = Tmdb.base_api_url + method + '/' + language + '/yaml/' + Tmdb.api_key + '/' + CGI::escape(data.to_s) + url = Tmdb.base_api_url + method + '/' + language + '/json/' + Tmdb.api_key + '/' + CGI::escape(data.to_s) response = Tmdb.get_url(url) if(response.code.to_i != 200) return nil end - body = YAML::load(response.body) + body = JSON(response.body) if( body.first.include?("Nothing found")) return nil else return body end \ No newline at end of file