Class: RDFObject::TalisPlatformProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf_objects/http_client.rb

Constant Summary collapse

@@formats =
['rdf','ntriples','turtle','json']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store_name) ⇒ TalisPlatformProxy

Returns a new instance of TalisPlatformProxy.



42
43
44
# File 'lib/rdf_objects/http_client.rb', line 42

def initialize(store_name)
  @store = store_name
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



40
41
42
# File 'lib/rdf_objects/http_client.rb', line 40

def store
  @store
end

Instance Method Details

#proxy_uri(uri, format = ['rdf']) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rdf_objects/http_client.rb', line 46

def proxy_uri(uri, format=['rdf'])
  idx = 0
  best_format = nil
  while !best_format
    @@formats.each do | fmt |
      if format[idx] == fmt
        best_format = fmt
        break
      end
    end
    idx += 1
  end
  raise "No compatible response format!" if !best_format
  "http://api.talis.com/stores/#{@store}/meta?about=#{CGI.escape(uri)}&output=#{best_format}"
end