Sha256: 67d41badef3f004380727a611b255bae66ca1da658c5230a918ccc02d22ed8c6

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

require 'pandorified/version'
require 'pandorified/result'
require 'pandorified/session'

module Pandorified
  # Send a message to a bot and receive a response.
  #
  # See {Pandorified::Result} for ways to handle the response, or use {.talk!} which raises an exception on errors.
  # If you want to remember the {botid} and {custid} between multiple calls, you should use {Pandorabots::Session} instead of this method.
  #
  # @param [String] input Text to say to the bot.
  # @param [String] botid A valid Pandorabots botid.
  # @param [String] custid An itentifier used to keep track of this conversaion.
  #
  # @return [Pandorified::Result] The bot's response as a result object.
  def self.talk(input, botid, custid = nil)
    Pandorified::Session.new(botid, custid).talk(input)
  end

  # Send a message to a bot and receive a response (if successsful).
  #
  # If Pandorabots responds with an error, {Pandorified::PandorabotsError} is raised.
  # If you'd rather check for and handle the error yourself, use {.talk} instead of this method.
  #
  # If you want to remember the {botid} and {custid} between multiple calls, you should use {Pandorabots::Session} instead of this method.
  #
  # @param [String] input Text to say to the bot.
  # @param [String] botid A valid Pandorabots botid.
  # @param [String] custid An itentifier used to keep track of this conversaion.
  #
  # @return [String] The bot's response text.
  def self.talk!(input, botid, custid = nil)
    Pandorified::Session.new(botid, custid).talk!(input).to_s
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pandorified-0.9.3 lib/pandorified.rb
pandorified-0.9.2 lib/pandorified.rb
pandorified-0.9.1 lib/pandorified.rb