Class: Basuco::Trans

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

Overview

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Trans.



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

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



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

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

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



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

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

#status?Boolean

yes or no

Returns:

  • (Boolean)


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

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