parse_caller.rb revision e4d81151f4841a6354d043551a970418b32be02a
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorcemodule Hets
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce class ParseCaller < ActionCaller
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce # Server-Instances should be started with the following
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce # arguments: `hets +RTS -K1G -RTS -a none`
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce MODE_ARGUMENTS = {
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce fast_run: %w(just-structured),
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce default: %w(full-signatures full-theories auto),
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce }
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce CMD = 'dg'
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce METHOD = :get
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce def call(iri, with_mode: :default)
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce escaped_iri = Rack::Utils.escape_path(iri)
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce arguments = [escaped_iri, *MODE_ARGUMENTS[with_mode]]
287e76479d68db4134274d4a4fca5fe0fbc9a605Jan Cholasta api_uri = build_api_uri(CMD, arguments, build_query_string)
287e76479d68db4134274d4a4fca5fe0fbc9a605Jan Cholasta perform(api_uri, {}, METHOD)
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce rescue UnfollowableResponseError => error
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce handle_possible_hets_error(error)
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce end
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce end
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorceend
10eae23e2483733d4ca3c21f15b5bdb3f04c9839Simo Sorce