Ark-Plugin-ReproxyCallback
view release on metacpan or search on metacpan
lib/Ark/Plugin/ReproxyCallback/OpenSocial.pm view on Meta::CPAN
has reproxy_callback_opensocial_oauth_consumer_model => (
is => 'rw',
isa => 'Str',
lazy => 1,
default => sub {
my ($self) = @_;
$self->class_config->{oauth_consumer_model} || 'oauth_consumer';
},
);
has reproxy_callback_opensocial_api_endpoint => (
is => 'rw',
isa => 'Str',
lazy => 1,
default => sub {
my ($self) = @_;
$self->class_config->{api_endpoint} || 'http://api.mixi-platform.com/os/0.8';
},
);
around reproxy => sub {
my $next = shift;
my $c = shift;
my $args = @_ > 1 ? {@_} : $_[0];
if (my $req = delete $args->{request}) {
my $consumer =
lib/Ark/Plugin/ReproxyCallback/OpenSocial.pm view on Meta::CPAN
sub reproxy_opensocial {
my $c = shift;
my $method = shift;
my $path = shift;
my $args = @_ > 1 ? {@_} : $_[0];
my $cb = delete $args->{callback};
my $params = delete $args->{params};
my $uri = URI->new( $c->reproxy_callback_opensocial_api_endpoint . $path );
$uri->query_form(%$params) if $params;
$c->reproxy(
request => HTTP::Request->new( $method => $uri ),
callback => $cb,
);
}
sub reproxy_people {
my $cb = pop @_;
my ($c, $guid, $target, $params) = @_;
my $uri = URI->new( $c->reproxy_callback_opensocial_api_endpoint );
$uri->path( $uri->path . "/people/${guid}/${target}" );
$uri->query_form(%$params) if $params;
$c->reproxy(
request => HTTP::Request->new( GET => $uri ),
callback => $cb,
);
}
1;
( run in 0.246 second using v1.01-cache-2.11-cpan-cc502c75498 )