a status
$ curl -d '{"text":"hello, world!"}' http://localhost:5000/timelines/home/statuses.json
=back
See L<BusyBird::Manual::Tutorial> for detail.
=head1 DOCUMENTATION
=over
=item L<BusyB
qw(set_param split_with_entities);
use Carp;
use Try::Tiny;
use Scalar::Util qw(weaken);
use JSON qw(to_json);
use Text::Xslate qw(html_builder html_escape);
use File::Spec;
use Encode ();
use JavaScr
te => 'error.tx', args => {error => $message},
code => $http_code
);
}
sub response_json {
my ($self, $res_code, $response_object) = @_;
my $message = try {
die "response
}
to_json($response_object, {ascii => 1})
}catch {
undef
};
if(defined($message)) {
return [
$res_code, ['Content-Type' => 'application/json; charset=ut
/timelines/home/statuses.json
C<< POST /timelines/home/statuses.json >> endpoint inputs statuses to the "home" timeline.
Statuses are in the HTTP request body, encoded in JSON.
You can input more th
o, Alice!", "user":{"screen_name":"Bob"}}]' \
http://127.0.0.1:5000/timelines/home/statuses.json
This time, the statuses have C<user.screen_name> fields.
L<BusyBird> renders this field as the p
bird_input_feed https://metacpan.org/feed/recent -p http://127.0.0.1:5000/timelines/home/statuses.json
=back
After that, you can see the imported feed items (in this case, Perl modules recently uplo
quests with the message body,
data format of the body must be JSON encoded by UTF-8,
so C<Content-Type> header should be C<application/json; charset=utf-8>.
The data format of HTTP responses is deter
=item C<timeline> = STR (required)
Timeline name.
=item C<format> = {json,html} (required)
Response format. It is either C<json> or C<html>.
If C<html> format is specified, the response message is
s C<json>.
It is useful when you transfer statuses from one L<BusyBird> instance to another.
=back
B<Response>
In success, the HTTP response code is 200.
=over
=item *
If C<format> is C<json> an
BusyBird::Manual::Status - Status object specification
=head1 SYNOPSIS
use JSON;
my $status = decode_json(<<'STATUS');
{
"id": "http://api.example.com/2291",
"create
in JSON format). It should be serializable to
JSON and deserializable from JSON.
=head1 FIELDS
The following fields in a status object is used by BusyBird.
Note that the following list uses JSON f
atus->{$key};
}
$status->{$key} = "$api_url/statuses/show/" . $status->{$key} . ".json";
}
return $status;
}
sub filter_twitter_status_id {
my ($api_url) = @_;
return
);
use BusyBird::DateTime::Format;
use Storable qw(dclone);
use Carp;
use List::Util qw(min);
use JSON;
use Try::Tiny;
sub new {
my ($class, %options) = @_;
my $self = bless {
timelin
lepath to write.");
return 0;
}
my $success;
try {
print $file encode_json($self->{timelines});
$success = 1;
}catch {
my $e = shift;
$self->_lo
ccess;
try {
my $text = do { local $/; <$file> };
$self->{timelines} = decode_json($text);
$success = 1;
}catch {
my $e = shift;
$self->_log("error", "E
_or sql_lt sql_le sql_raw);
use BusyBird::DateTime::Format;
use BusyBird::Util qw(set_param);
use JSON;
use Scalar::Util qw(looks_like_number);
use DateTime::Format::Strptime;
use DateTime;
no autoviv
>{created_at});
$record->{content} = to_json($status);
return $record;
}
sub _from_status_record {
my ($record) = @_;
my $status = from_json($record->{content});
$status->{id} = $
imple;
use Plack::Request;
use Plack::Builder ();
use Plack::App::File;
use Try::Tiny;
use JSON qw(decode_json);
use Scalar::Util qw(looks_like_number);
use List::Util qw(min);
use Carp;
use Exporter
;
$tl_mapper->connect('/statuses.json',
{method => '_handle_tl_post_statuses'}, {method => 'POST'});
$tl_mapper->connect('/ack.json',
{method =>
'_handle_tl_ack'}, {method => 'POST'});
$tl_mapper->connect('/updates/unacked_counts.json',
{method => '_handle_tl_get_unacked_counts'}, {method => 'GET'});
$tl_mapper