package Echo::StreamServer::MuxRequest;
use 5.008008;
use strict;
use warnings;
use JSON;
our $VERSION = '0.01';
our @MUX_METHODS = ( 'search', 'count' );
our $MUX_MAX_REQUESTS = 100; # server-sid
calls TO_JSON() method on the blessed hash.
# This method returns a "plain" hash to render the document.
#
# NOTE: The convert_blessed flag must be set (false by default).
# my $json = JSON->new->con
# ======================================================================
my $json = JSON->new->convert_blessed;
sub TO_JSON {
my $self = shift;
my %hash = %$self;
return \%hash;
}
sub new {
my
onds
);
my $json_hash_ref = send_request($self->{'account'}, 'feeds/register', \%params);
# Return true on success.
if (exists($json_hash_ref->{'result'}) and ($json_hash_ref->{'re
rl,
);
my $json_hash_ref = send_request($self->{'account'}, 'feeds/unregister', \%params);
# Return true on success.
if (exists($json_hash_ref->{'result'}) and ($json_hash_ref->{'r
Server::Core;
use strict;
use HTTP::Headers;
use HTTP::Request;
use LWP::UserAgent;
use URI;
use JSON;
use Data::Dumper;
use Echo::StreamServer::Settings;
# =======================================
====================================================================
# REST API: Document Format: JSON
# ======================================================================
my $HTTP_HEADERS = HTTP
L $VERSION)");
$HTTP_HEADERS->header('Accept' => 'application/json');
$HTTP_HEADERS->header('Content-Type' => 'application/json');
# ============================================================
=============================
# JSON.pm calls TO_JSON() method on the blessed hash.
#
# NOTE: The convert_blessed flag must be set (false by default).
# my $json = JSON->new->convert_blessed;
# ======
================================================================
use JSON;
my $json = JSON->new->convert_blessed;
our @USER_SUBJECTS = ( 'roles', 'state', 'markers', 'poco' );
sub get {
my ($self,
$raise_not_found) = @_;
my %params = (
'identityURL' => $identity_url,
);
my $json_hash_ref;
eval {
$json_hash_ref = send_request($self->{'account'}, 'users/get', \%params);
};
# Re
pkey'},
'q' => $query,
);
my $json_hash_ref = send_request($self->{'account'}, 'count', \%params);
if ($DEBUG) { print STDERR "count returned: " . Dumper($json_hash_ref) . "\n"; }
# Ret
urn count or zero when impossible.
if (exists($json_hash_ref->{'count'})) {
return $json_hash_ref->{'count'};
}
else {
return 0;
}
}
sub searc
arams{'since'} = $since;
}
my $json_hash_ref = send_request($self->{'account'}, 'search', \%params);
# Return results data structure.
return $json_hash_ref;
}
sub submit {
my ($s
%params = (
'key' => $key,
'appkey' => $self->{'account'}->{'appkey'},
);
my $json_hash_ref;
eval {
$json_hash_ref = send_request($self->{'account'}, 'kvs/delete', \%params);
};
# Re-raise
}
return $json_hash_ref->{'result'};
}
sub get {
my ($self, $key, $raise_not_found) = @_;
my %params = (
'key' => $key,
'appkey' => $self->{'account'}->{'appkey'},
);
my $json_hash_ref;
alue, when present (may be serialized).
# De-serialize $value data-structure.
my $value = thaw($json_hash_ref->{'value'});
$value = ${ $value } if (ref($value) eq "SCALAR");
return $value;
}
sub