lib/pandorified/session.rb in pandorified-0.2.0 vs lib/pandorified/session.rb in pandorified-0.3.0

- old
+ new

@@ -1,13 +1,24 @@ require 'pandorified/result' module Pandorified class Session + # A new session for conversing with a bot. + # + # @note If you choose not to specify a {custid}, one will be chosen automatically and remembered throughout the session. + # + # @param [String] botid A valid Pandorabots botid. + # @param [String] custid An identifier used to keep track of this conversation. def initialize(botid, custid = nil) @botid = botid @custid = custid end + # Send a message to this session's bot and receive a response. + # + # @param [String] input Text to say to the bot. + # + # @return [String] The bot's response text. def talk(input) result = Pandorified::Result.new(botid: @botid, custid: @custid, input: input) if result.status.zero? @custid ||= result.custid result.that