lib/ruby-tmdb/tmdb.rb in ruby-tmdb-0.1.1 vs lib/ruby-tmdb/tmdb.rb in ruby-tmdb-0.1.2
- old
+ new
@@ -20,9 +20,10 @@
def self.base_api_url
"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)
response = Tmdb.get_url(url)
if(response.code.to_i != 200)
return nil
end
\ No newline at end of file