class Clarinet::Client
@!visibility private
Public Class Methods
new(api_key)
click to toggle source
# File lib/clarinet/client.rb, line 15 def initialize(api_key) @auth_headers = { 'Authorization' => "Key #{api_key}" } end
Public Instance Methods
concept(id)
click to toggle source
# File lib/clarinet/client.rb, line 80 def concept(id) with_response_parsing do self.class.get "/concepts/#{id}", headers: @auth_headers end end
concepts(options = {})
click to toggle source
# File lib/clarinet/client.rb, line 74 def concepts(options = {}) with_response_parsing do self.class.get '/concepts', headers: @auth_headers, query: options end end
concepts_search(query)
click to toggle source
# File lib/clarinet/client.rb, line 86 def concepts_search(query) body = { concept_query: query } with_response_parsing do self.class.post '/concepts/searches', headers: @auth_headers, body: body.to_json end end
input_delete(id)
click to toggle source
# File lib/clarinet/client.rb, line 116 def input_delete(id) with_response_parsing do self.class.delete "/inputs/#{id}", headers: @auth_headers end end
inputs(options = {})
click to toggle source
# File lib/clarinet/client.rb, line 102 def inputs(options = {}) with_response_parsing do self.class.get '/inputs', headers: @auth_headers, query: options end end
inputs_create(concepts)
click to toggle source
# File lib/clarinet/client.rb, line 94 def inputs_create(concepts) body = { concepts: concepts } with_response_parsing do self.class.post '/concepts', headers: @auth_headers, body: body.to_json end end
inputs_delete(ids)
click to toggle source
# File lib/clarinet/client.rb, line 122 def inputs_delete(ids) body = { ids: ids } with_response_parsing do self.class.delete '/inputs', headers: @auth_headers, body: body.to_json end end
inputs_delete_all()
click to toggle source
# File lib/clarinet/client.rb, line 130 def inputs_delete_all body = { delete_all: true } with_response_parsing do self.class.delete '/inputs', headers: @auth_headers, body: body.to_json end end
inputs_status()
click to toggle source
# File lib/clarinet/client.rb, line 138 def inputs_status with_response_parsing do self.class.get '/inputs/status', headers: @auth_headers end end
inputs_update(data)
click to toggle source
# File lib/clarinet/client.rb, line 144 def inputs_update(data) with_response_parsing do self.class.patch '/inputs', headers: @auth_headers, body: data.to_json end end
model(id)
click to toggle source
# File lib/clarinet/client.rb, line 27 def model(id) with_response_parsing do self.class.get "/models/#{id}", headers: @auth_headers end end
model_output_info(id)
click to toggle source
# File lib/clarinet/client.rb, line 33 def model_output_info(id) with_response_parsing do self.class.get "/models/#{id}/output_info", headers: @auth_headers end end
model_train(id)
click to toggle source
# File lib/clarinet/client.rb, line 39 def model_train(id) with_response_parsing do self.class.post "/models/#{id}/versions", header: @auth_headers end end
model_versions(id, options = {})
click to toggle source
# File lib/clarinet/client.rb, line 45 def model_versions(id, options = {}) with_response_parsing do self.class.get "/models/#{id}/versions", headers: @auth_headers, query: options end end
models(options = {})
click to toggle source
# File lib/clarinet/client.rb, line 21 def models(options = {}) with_response_parsing do self.class.get '/models', headers: @auth_headers, query: options end end
models_search(query)
click to toggle source
# File lib/clarinet/client.rb, line 51 def models_search(query) body = { model_query: query } with_response_parsing do self.class.post '/models/searches', headers: @auth_headers, body: body.to_json end end
models_update(data)
click to toggle source
# File lib/clarinet/client.rb, line 59 def models_update(data) with_response_parsing do self.class.patch '/models', headers: @auth_headers, body: data.to_json end end
outputs(model_id, inputs, config = {})
click to toggle source
# File lib/clarinet/client.rb, line 65 def outputs(model_id, inputs, config = {}) body = { inputs: inputs } body[:model] = { output_info: { output_config: config } } unless config.empty? with_response_parsing do self.class.post "/models/#{model_id}/outputs", headers: @auth_headers, body: body.to_json end end
Private Instance Methods
with_response_parsing() { || ... }
click to toggle source
# File lib/clarinet/client.rb, line 153 def with_response_parsing(&block) response = yield data = JSON.parse response.parsed_response, symbolize_names: true Clarinet::Utils.check_response_status data[:status] data end