Group
Extension

Matches 4

OAuthomatic ( M/ME/MEKK/OAuthomatic-0.0202.tar.gz, MEKK, 2020; MetaCPAN )
OAuthomatic/lib/OAuthomatic.pm ( view source; MetaCPAN )
on;
use OAuthomatic::Internal::UsageGuard;
use OAuthomatic::Internal::Util qw/serialize_json parse_http_msg_json/;
use OAuthomatic::ServerDef qw/oauthomatic_predefined_for_name/;

####################

}


sub get_json {
    my ($self, $url, $url_args) = @_;

    my $r = $self->execute_request(
        method => "GET", url => $url, url_args => $url_args);

    return parse_http_msg_json($r, 'force'
ent;
}


sub post_json {
    my $self = shift;
    my $url = shift;
    my @args = (method => "POST", 
                url => $url, 
                content_type => 'application/json; charset=utf-8');
OAuthomatic ( M/ME/MEKK/OAuthomatic-0.0202.tar.gz, MEKK, 2020; MetaCPAN )
OAuthomatic/lib/OAuthomatic/Internal/Util.pm ( view source; MetaCPAN )
_json fill_httpmsg_json parse_http_msg_json);

use HTTP::Request;
use HTTP::Response;
use HTTP::Body;
use URI;
use URI::QueryParam;
use Encode;
use utf8;
use JSON qw/decode_json encode_json from_json 
to_json/;
use Try::Tiny;
use Scalar::Util qw(reftype);
use namespace::sweep;

# FIXME: throw on errors


sub fill_httpmsg_form {
    my ($http_message, $params) = @_;

    my $body_form = URI->new('ht
json {
    my $json = shift;

    if(reftype($json) =~ /^(?:HASH|ARRAY)$/) {
        return encode_json($json);    # FIXME rethrow exception as sth better
    }
    elsif(! ref($json) || reftype($json
OAuthomatic ( M/ME/MEKK/OAuthomatic-0.0202.tar.gz, MEKK, 2020; MetaCPAN )
OAuthomatic/lib/OAuthomatic/Caller.pm ( view source; MetaCPAN )
ation/x-www-form-urlencoded');

Specifying C<body> means, that we post non-form body (for example
JSON, XML or even binary data). Example:

    $c->execute_oauth_request(method => "POST",
        url 
OAuthomatic ( M/ME/MEKK/OAuthomatic-0.0202.tar.gz, MEKK, 2020; MetaCPAN )
OAuthomatic/lib/OAuthomatic/Error.pm ( view source; MetaCPAN )
blem => 'parameter_absent',
        oauth_parameters_absent => 'oauth_consumer_key',
    }

=item JSON error output

For example

    {
        error => { id => '9e9c7bddeff3',
                   mess
ose;
    use Try::Tiny;
    use OAuthomatic::Internal::Util qw/parse_http_msg_form parse_http_msg_json/;
    use Data::Dump qw(dump);
    use namespace::sweep;

    extends 'OAuthomatic::Error';
    w
e =~ m{^application/(?:x-)?json}x) {
            try {
                $reply = parse_http_msg_json($response);
            };
        }

        # FIXME: maybe compact JSON level up if it contains ju

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.