Class: Basuco::Trans

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/basuco/trans.rb

Overview

partially taken from chris eppstein’s freebase api github.com/chriseppstein/freebase/tree

Constant Summary

Constants included from Request

Request::SERVICES

Instance Method Summary collapse

Methods included from Request

#get_query_response, #handle_read_error, #http_request, #params_to_string, #service_url

Constructor Details

#initialize(options = {:host => 'http://www.freebase.com', :username => 'un', :password => 'pw'}) ⇒ Trans

Returns a new instance of Trans.



11
12
13
14
15
16
# File 'lib/basuco/trans.rb', line 11

def initialize(options = {:host => 'http://www.freebase.com', :username => 'un', :password => 'pw'})
  @host = options[:host]
  @username = options[:username]
  @password = options[:password]
  Basuco.trans = self
end

Instance Method Details

#blurb_content(id, options = {}) ⇒ Object



30
31
32
33
# File 'lib/basuco/trans.rb', line 30

def blurb_content(id, options = {})
  response = http_request blurb_service_url+id, options
  response
end

#raw_content(id, options = {}) ⇒ Object



25
26
27
28
# File 'lib/basuco/trans.rb', line 25

def raw_content(id, options = {})
  response = http_request raw_service_url+id, options
  response
end

#status?Boolean

yes or no

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/basuco/trans.rb', line 19

def status?
  response = http_request status_service_url
  result = JSON.parse response
  return result["blob"] == "OK"
end