module A3rt::Talk
Constants
- ENDPOINT
- VERSION
Public Class Methods
api_key()
click to toggle source
# File lib/a3rt/talk.rb, line 16 def api_key Thread.current[:a3rt_talk_api_key] end
talk(query, api_key = A3rt::Talk.api_key)
click to toggle source
# File lib/a3rt/talk.rb, line 20 def talk(query, api_key = A3rt::Talk.api_key) req = Net::HTTP::Post.new(uri.path) req.set_form_data({ 'query' => query, 'apikey' => api_key }) res = http.request(req) data = JSON.parse(res.body) Response.new(data) end
Private Class Methods
http()
click to toggle source
# File lib/a3rt/talk.rb, line 34 def http @http ||= Net::HTTP.new(uri.host, uri.port).tap do |e| e.use_ssl = true e.verify_mode = OpenSSL::SSL::VERIFY_NONE end end
uri()
click to toggle source
# File lib/a3rt/talk.rb, line 30 def uri @uri ||= URI.parse(ENDPOINT) end