module Zelda class Request def self.get(url) result = HTTParty.get parse_url(url) if result %w(created_at updated_at id).each do |key| result.delete(key) if result[key] end if result['error'] raise result['error'] end end result end def self.parse_url(*args) raise "No Zelda::API_KEY specified" unless defined?(Zelda::API_KEY) "http://zelda.omroep.nl/#{ Zelda::API_KEY }/#{ args.join('/') }" end end end