Class: Kasabi::Lookup::Client

Inherits:
BaseClient show all
Defined in:
lib/kasabi/api/lookup.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#apikey, #client, #endpoint

Instance Method Summary collapse

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, options={})
  super(endpoint, options)
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