Class: Kasabi::Lookup::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- Kasabi::Lookup::Client
- Defined in:
- lib/kasabi/api/lookup.rb
Instance Attribute Summary
Attributes inherited from BaseClient
Instance Method Summary collapse
-
#initialize(endpoint, options = {}) ⇒ Client
constructor
Initialize the client to work with a specific endpoint.
- #lookup(uri) ⇒ Object
Methods inherited from BaseClient
#client_options, #get, #post, #validate_response
Constructor Details
#initialize(endpoint, options = {}) ⇒ Client
Initialize the client to work with a specific endpoint
The options hash can contain the following values:
-
:apikey: required. apikey authorized to use the API
-
:client: HTTPClient object instance
12 13 14 |
# File 'lib/kasabi/api/lookup.rb', line 12 def initialize(endpoint, ={}) super(endpoint, ) end |
Instance Method Details
#lookup(uri) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/kasabi/api/lookup.rb', line 16 def lookup(uri) response = get(@endpoint, {:about => uri, :output=>"json"} ) validate_response(response) graph = RDF::Graph.new() graph.insert( RDF::JSON::Reader.new( StringIO.new( response.content ) ) ) return graph end |