class A3rt::Client
Constants
- DOMAIN
Public Class Methods
image_search(apikey: , query: )
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 24 def image_search(apikey: , query: ) params = make_params(apikey: apikey, query: query) http_request("/image_search/v1/search_by_text", :get, params) end
proofreading(apikey: , sentence: , callback: nil, sensitivity: nil)
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 29 def proofreading(apikey: , sentence: , callback: nil, sensitivity: nil) params = make_params(apikey: apikey, sentence: sentence, callback: callback, sensitivity: sensitivity) http_request("/proofreading/v2/typo", :get, params) end
sql_suggest(apikey: , model_id: , text: )
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 34 def sql_suggest(apikey: , model_id: , text: ) params = make_params(apikey: apikey, model_id: model_id, text: text) http_request("/sql_suggest/v1/predict", :get, params) end
talk_api(apikey: , query: , callback: nil)
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 9 def talk_api(apikey: , query: , callback: nil) params = make_params(apikey: apikey, query: query, callback: callback) http_request("/talk/v1/smalltalk", :post, params) end
text_suggest(apikey: , previous_description: , callback: nil, style: nil, separation: nil)
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 14 def text_suggest(apikey: , previous_description: , callback: nil, style: nil, separation: nil) params = make_params(apikey: apikey, previous_description: previous_description, callback: callback, style: style, separation: separation) http_request("/text_suggest/v2/predict", :get, params) end
text_summarization(apikey: , sentences: , linenumber: nil, separation: nil)
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 19 def text_summarization(apikey: , sentences: , linenumber: nil, separation: nil) params = make_params(apikey: apikey, sentences: sentences, linenumber: linenumber, separation: separation) http_request("/text_summarization/v1", :post, params) end
Private Class Methods
http_request(path, method, params = {})
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 45 def http_request(path, method, params = {}) res = Faraday.post(DOMAIN + path, params) if method == :post res = Faraday.get(DOMAIN + path, params) if method == :get JSON.parse(res.body) end
make_params(**params)
click to toggle source
# File lib/a3rt_client/a3rt_client.rb, line 41 def make_params(**params) params.reject{|k, v| v.nil? } end