Class: Basuco::Trans
- Inherits:
-
Object
- Object
- Basuco::Trans
- Defined in:
- lib/basuco/trans.rb
Overview
partially taken from chris eppstein’s freebase api github.com/chriseppstein/freebase/tree
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.
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( = {: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
29 30 31 32 |
# File 'lib/basuco/trans.rb', line 29 def blurb_content(id, = {}) response = http_request blurb_service_url+id, response end |
#raw_content(id, options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/basuco/trans.rb', line 24 def raw_content(id, = {}) response = http_request raw_service_url+id, response end |
#status? ⇒ Boolean
yes or no
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 |