Group
Extension

Matches 4

WebService-SOP-Auth-V1_1 ( Y/YO/YOWCOW/WebService-SOP-Auth-V1_1-0.04.tar.gz, YOWCOW, 2016; MetaCPAN )
WebService-SOP-Auth-V1_1/lib/WebService/SOP/Auth/V1_1/Request/PUT_JSON.pm ( view source; MetaCPAN )
package WebService::SOP::Auth::V1_1::Request::PUT_JSON;
use strict;
use warnings;
use Carp ();
use JSON::XS qw(encode_json);
use HTTP::Request::Common qw(PUT);
use WebService::SOP::Auth::V1_1::Util qw
nt = encode_json($params);
    my $sig = create_signature($content, $app_secret);

    my $req = PUT $uri, Content => $content;
    $req->headers->header('content-type' => 'application/json');
    $re
Service::SOP::Auth::V1_1::Request::PUT_JSON

=head1 DESCRIPTION

To create a valid L<HTTP::Request> object for C<PUT> request with content type C<application/json>.

=head1 FUNCTIONS

=head2 $class->c
WebService-SOP-Auth-V1_1 ( Y/YO/YOWCOW/WebService-SOP-Auth-V1_1-0.04.tar.gz, YOWCOW, 2016; MetaCPAN )
WebService-SOP-Auth-V1_1/lib/WebService/SOP/Auth/V1_1/Request/POST_JSON.pm ( view source; MetaCPAN )
package WebService::SOP::Auth::V1_1::Request::POST_JSON;
use strict;
use warnings;
use Carp ();
use JSON::XS qw(encode_json);
use HTTP::Request::Common qw(POST);
use WebService::SOP::Auth::V1_1::Util 
t = encode_json($params);
    my $sig = create_signature($content, $app_secret);

    my $req = POST $uri, Content => $content;
    $req->headers->header('content-type' => 'application/json');
    $re
ebService::SOP::Auth::V1_1::Request::POST_JSON

=head1 DESCRIPTION

To create a valid L<HTTP::Request> object for given C<POST> request parameters to send JSON data.

=head1 METHODS

=head2 $class->cr
WebService-SOP-Auth-V1_1 ( Y/YO/YOWCOW/WebService-SOP-Auth-V1_1-0.04.tar.gz, YOWCOW, 2016; MetaCPAN )
WebService-SOP-Auth-V1_1/lib/WebService/SOP/Auth/V1_1.pm ( view source; MetaCPAN )
;
use WebService::SOP::Auth::V1_1::Request::POST_JSON;
use WebService::SOP::Auth::V1_1::Request::PUT;
use WebService::SOP::Auth::V1_1::Request::PUT_JSON;
use WebService::SOP::Auth::V1_1::Util qw(is_si
UserAgent->new->request($req);

When making a POST request with JSON data to API:

    my $req = $auth->create_request(
        POST_JSON => 'http://<API_HOST>/path/to/endpoint' => {
            hoge 
w-form-urlencoded>.

=item C<POST_JSON>

For HTTP POST request to SOP endpoint with signature as request header
C<X-Sop-Sig> of request content type C<application/json>.

=item C<PUT>

For HTTP PUT re
WebService-SOP-Auth-V1_1 ( Y/YO/YOWCOW/WebService-SOP-Auth-V1_1-0.04.tar.gz, YOWCOW, 2016; MetaCPAN )
WebService-SOP-Auth-V1_1/lib/WebService/SOP/Auth/V1_1/Util.pm ( view source; MetaCPAN )
warnings;
use Carp ();
use Digest::SHA qw(hmac_sha256_hex);
use Exporter qw(import);
use JSON::XS qw(decode_json);

our @EXPORT_OK = qw( create_signature is_signature_valid );

our $SIG_VALID_FOR_SEC 

    $time ||= time;

    my $req_time = ref($params) ? $params->{time}
                 : decode_json($params)->{time};

    return if not $req_time;
    return if $req_time < ($time - $SIG_VALID_FOR

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