Class: FtrRuby::Tests

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

Class Method Summary collapse

Class Method Details

.register_test(test_uri:, proxy_url: "https://tools.ostrails.eu/fdp-index-proxy/proxy") ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/registertest.rb', line 4

def self.register_test(test_uri:, proxy_url: "https://tools.ostrails.eu/fdp-index-proxy/proxy")
  warn "registering new test"
  #       curl -v -L -H "content-type: application/json"
  # -d '{"clientUrl": "https://my.domain.org/path/to/DCAT/testdcat.ttl"}'
  # https://tools.ostrails.eu/fdp-index-proxy/proxy
  begin
    response = RestClient::Request.execute({
                                             method: :post,
                                             url: proxy_url,
                                             headers: { "Accept" => "application/json",
                                                        "Content-Type" => "application/json" },
                                             payload: { "clientUrl": test_uri }.to_json
                                           }).body
  rescue StandardError => e
    warn "response is #{response.inspect} error #{e.inspect}"
  end
  response
end