24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/sylfy/service/cactusncirest.rb', line 24
def perform(identifier, representation, xml = false)
if @@representation_type.include?(representation.to_sym)
uri = "#{@@baseuri}/#{URI.escape(identifier, "[] ")}/#{representation.to_s}"
begin
return URI.parse(uri).read().strip().chomp.split(/\n/)
rescue OpenURI::HTTPError
return []
end
else
raise Sylfy::Service::ParameterError, "Wrong representation type. Should be #{@@representation_type.join(', ')}"
end
end
|