AI-CleverbotIO
view release on metacpan or search on metacpan
"Dist::Milla" : "v1.0.15",
"Path::Tiny" : "0.096",
"Template::Perlish" : "1.52",
"Test::Pod" : "1.41"
}
},
"runtime" : {
"requires" : {
"HTTP::Tiny" : "0.070",
"IO::Socket::SSL" : "1.56",
"JSON::PP" : "0",
"Log::Any" : "1.045",
"Moo" : "2.003000",
"Net::SSLeay" : "1.49",
"Ouch" : "0.0410",
"perl" : "5.010"
}
},
"test" : {
"requires" : {
"Path::Tiny" : "0.096",
directory:
- eg
- examples
- inc
- share
- t
- xt
requires:
HTTP::Tiny: '0.070'
IO::Socket::SSL: '1.56'
JSON::PP: '0'
Log::Any: '1.045'
Moo: '2.003000'
Net::SSLeay: '1.49'
Ouch: '0.0410'
perl: '5.010'
resources:
bugtracker: https://github.com/polettix/AI-CleverbotIO/issues
homepage: https://github.com/polettix/AI-CleverbotIO
repository: https://github.com/polettix/AI-CleverbotIO.git
version: '0.002'
BUILD_ua
Called automatically if "ua" is not set. By default, it returns a plain
new instance of HTTP::Tiny, without options.
ask
my $answer = $obj->ask($some_text);
Send a ask API request. The returned $answer is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
response => 'Hullo'
}
create
my $answer = $obj->create();
my $other = $obj->create($other_nick);
Send a create API request. The returned $answer is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
nick => 'NickTheRobot',
}
If the current "nick" has already been used for creation, the API call
will fail partially in that status 200 will be returned, but the status
field in the answer will contain an error about the fact that the nick
already exists (Error: reference name already exists). You can safely
requires 'perl', '5.010';
requires 'HTTP::Tiny', '0.070';
requires 'IO::Socket::SSL', '1.56'; # from HTTP::Tiny 0.070 docs
requires 'JSON::PP'; # core from 5.14, any should do
requires 'Log::Any', '1.045';
requires 'Moo', '2.003000';
requires 'Net::SSLeay', '1.49'; # from HTTP::Tiny 0.070 docs
requires 'Ouch', '0.0410';
on test => sub {
requires 'Test::More', '0.88';
requires 'Path::Tiny', '0.096';
requires 'Test::Exception', '0.43';
};
lib/AI/CleverbotIO.pm view on Meta::CPAN
package AI::CleverbotIO;
use strict;
use warnings;
{ our $VERSION = '0.002'; }
use Moo;
use Ouch;
use Log::Any ();
use Data::Dumper;
use JSON::PP qw< decode_json >;
has endpoints => (
is => 'ro',
default => sub {
return {
ask => 'https://cleverbot.io/1.0/ask',
create => 'https://cleverbot.io/1.0/create',
};
},
);
lib/AI/CleverbotIO.pod view on Meta::CPAN
=head2 BUILD_ua
Called automatically if L</ua> is not set. By default, it returns
a plain new instance of L<HTTP::Tiny>, without options.
=head2 ask
my $answer = $obj->ask($some_text);
Send a I<ask> API request. The returned C<$answer> is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
response => 'Hullo'
}
=head2 create
my $answer = $obj->create();
my $other = $obj->create($other_nick);
Send a I<create> API request. The returned C<$answer> is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
nick => 'NickTheRobot',
}
If the current L</nick> has already been used for creation, the API call
will fail partially in that status 200 will be returned, but the C<status>
field in the answer will contain an error about the fact that the nick
already exists (C<Error: reference name already exists>). You can safely
( run in 1.123 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )