class Ruboty::Qanda::Actions::Qanda
Constants
- DOCOMO_QANDA_API_URL
Public Class Methods
new(message)
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 7 def initialize(message) @message = message end
Public Instance Methods
call()
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 11 def call message.reply(qanda) end
Private Instance Methods
connection()
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 25 def connection Faraday.new do |connection| connection.request :url_encoded connection.adapter :net_http connection.response :json end end
params()
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 37 def params { APIKEY: ENV["DOCOMO_API_KEY"], q: @message[:keyword] } end
qanda()
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 17 def qanda response.body["message"]["textForDisplay"] end
response()
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 21 def response connection.get(url, params) end
url()
click to toggle source
# File lib/ruboty/qanda/actions/qanda.rb, line 33 def url DOCOMO_QANDA_API_URL end