Class: Freebase::Base

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/freebase/base.rb

Class Method Summary collapse

Class Method Details

.run(query) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/freebase/base.rb', line 7

def self.run query
  service_url = 'http://api.freebase.com/api/service/mqlread'
  query_envelope = { :query => query }
  url = service_url + '?query=' + CGI::escape(Yajl::Encoder.new.encode(query_envelope))
  response = get(url)
  Freebase::Response.new(Yajl::Parser.new.parse(response.body))
end