Class: Basuco::Trans
Overview
partially taken from chris eppstein’s freebase api github.com/chriseppstein/freebase/tree
Constant Summary
Constants included from Request
Instance Method Summary collapse
- #blurb_content(id, options = {}) ⇒ Object
-
#initialize(options = {:host => 'http://www.freebase.com', :username => 'un', :password => 'pw'}) ⇒ Trans
constructor
A new instance of Trans.
- #raw_content(id, options = {}) ⇒ Object
-
#status? ⇒ Boolean
yes or no.
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( = {:host => 'http://www.freebase.com', :username => 'un', :password => 'pw'}) @host = [:host] @username = [:username] @password = [: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, = {}) response = http_request blurb_service_url+id, response end |
#raw_content(id, options = {}) ⇒ Object
25 26 27 28 |
# File 'lib/basuco/trans.rb', line 25 def raw_content(id, = {}) response = http_request raw_service_url+id, response end |
#status? ⇒ Boolean
yes or no
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 |