API-ParallelsWPB

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

    received the program in object code or executable form alone.)

Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License.  However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.

  5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions.  You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.

  7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of the license which applies to it and "any

LICENSE  view on Meta::CPAN

may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.

6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.

7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.

8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.

9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

The End

lib/API/ParallelsWPB.pm  view on Meta::CPAN


use base qw/ API::ParallelsWPB::Requests /;

# ABSTRACT:  client for Parallels Presence Builder API

our $VERSION = '0.03'; # VERSION
our $AUTHORITY = 'cpan:IMAGO'; # AUTHORITY


# Constuctor
sub new {
    my $class = shift;

    $class = ref $class || $class;

    my $self = {
        username    => '',
        password    => '',
        server      => '',
        api_version => '5.3',
        debug       => 0,

lib/API/ParallelsWPB.pm  view on Meta::CPAN


    map { confess "Field '" . $_ . "' required!" unless $self->{ $_ } } qw/username password server/;

    return bless $self, $class;
}

# "free" request. Basic method for requests



sub f_request {
    my ( $self, $url_array, $data ) = @_;

    confess "$url_array is not array!" unless ( ref $url_array eq 'ARRAY' );

    $data->{req_type} ||= 'GET';
    $data->{req_type} = uc $data->{req_type};

    #compile URL
    my $url = 'https://' . $self->{server} . '/api/' . $self->{api_version} . '/';
    $url .= join( '/', @{ $url_array }) . '/';

lib/API/ParallelsWPB.pm  view on Meta::CPAN

            confess "parameter post_data must be hashref or arrayref!"
        }
        $post_data = $self->_json->encode($data->{post_data});
    }
    $post_data ||= '{}';

    my $response = $self->_send_request($data, $url, $post_data);
    return $response;
}

sub _send_request {
    my ( $self, $data, $url, $post_data ) = @_;

    my $ua = LWP::UserAgent->new();
    my $req = HTTP::Request->new( $data->{req_type} => $url );

    if ( $data->{req_type} eq 'POST' || $data->{req_type} eq 'PUT' ) {
        $req->header( 'content-type' => 'application/json' );
        $req->content( $post_data );
    }

lib/API/ParallelsWPB.pm  view on Meta::CPAN


    warn $req->as_string if ( $self->{debug} );

    my $res = $ua->request( $req );
    warn $res->as_string if ( $self->{debug} );

    my $response = API::ParallelsWPB::Response->new( $res );
    return $response;
}

sub _json {
    my ( $self ) = @_;

    unless( $self->{_json} ) {
        $self->{_json} = JSON::XS->new;
    }
    return $self->{_json};
}

1;

lib/API/ParallelsWPB/Requests.pm  view on Meta::CPAN

    DEFAULT_CREATE_SITE_STATE => 'trial',
    DEFAULT_SESSIONLIFETIME   => '1800',
};

# ABSTRACT: processing of API requests

our $VERSION = '0.03'; # VERSION
our $AUTHORITY = 'cpan:IMAGO'; # AUTHORITY


sub get_version {
    my ( $self ) = @_;

    return $self->f_request( [qw/ system version /], { req_type => 'get' } );
}


sub create_site {
    my ( $self, %param ) = @_;

    $param{state}                ||= DEFAULT_CREATE_SITE_STATE;
    $param{publicationSettings}  ||= {};
    $param{ownerInfo}            ||= {};
    $param{isPromoFooterVisible} ||= '';

    my $post_array = [ {
        state                => $param{state},
        publicationSettings  => $param{publicationSettings},

lib/API/ParallelsWPB/Requests.pm  view on Meta::CPAN

        $self->{uuid} = $uuid;
    }
    else {
        carp "parameter uuid not found";
    }

    return $res;
}


sub gen_token {
    my ( $self, %param ) = @_;

    $param{localeCode}      ||= DEFAULT_LOCALE_CODE;
    $param{sessionLifeTime} ||= DEFAULT_SESSIONLIFETIME;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request(
        [ 'sites', $uuid, 'token' ],
        {

lib/API/ParallelsWPB/Requests.pm  view on Meta::CPAN

            post_data => [
                {
                    localeCode => $param{localeCode},
                    sessionLifeTime => $param{sessionLifeTime},
                } ],
        }
    );
}


sub deploy {
    my ( $self, %param ) = @_;

    $param{localeCode}   ||= $self->DEFAULT_LOCALE_CODE;
    $param{templateCode} ||= $self->DEFAULT_TEMPLATE_CODE;
    my $siteuuid = $self->_get_uuid( %param );

    my @post_data = map { $param{$_} } qw/templateCode localeCode title/;

    return $self->f_request(
        [ 'sites', $siteuuid, 'deploy' ],
        {
            req_type  => 'post',
            post_data => \@post_data
        }
    );
}



sub get_site_info {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request( [ 'sites', $uuid ], { req_type => 'get' } );
}



sub get_sites_info {
    my ( $self ) = @_;

    return $self->f_request( [qw/ sites /], { req_type => 'get' } );
}


sub change_site_properties {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );
    return $self->f_request(
        [ 'sites', $uuid ],
        {
            req_type  => 'put',
            post_data => [\%param]
        }
    );
}



sub publish {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );
    return $self->f_request(
        [ 'sites', $uuid, 'publish' ],
        {
            req_type  => 'post',
        }
    );
}



sub delete_site {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request( [ 'sites', $uuid ], { req_type => 'delete' } );
}



sub get_promo_footer {
    my ( $self ) = @_;

    return $self->f_request( [qw/ system promo-footer /],
        { req_type => 'get' } );
}


sub get_site_custom_variable {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request( [ 'sites', $uuid, 'custom-properties' ], { req_type => 'get' } );
}


sub set_site_custom_variable {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    delete $param{uuid} if ( exists $param{uuid} );
    return $self->f_request( [ 'sites', $uuid, 'custom-properties' ],
        {
            req_type  => 'put',
            post_data => [ \%param ],
        }
    );
}


sub get_sites_custom_variables {
    my ( $self ) = @_;

    return $self->f_request( [qw/ system custom-properties /],
        { req_type => 'get' } );
}


sub set_sites_custom_variables {
    my ( $self, %param ) = @_;

    return $self->f_request( [ qw/ system custom-properties / ],
        {
            req_type  => 'put',
            post_data => [ \%param ],
        }
    );
}


sub set_custom_trial_messages {
    my ( $self, @param ) = @_;

    return $self->f_request( [ qw/ system trial-mode messages / ],
        {
            req_type  => 'put',
            post_data => [ \@param ]
        }
    );
}


sub get_custom_trial_messages {
    my ( $self ) = @_;

    return $self->f_request( [qw/ system trial-mode messages /],
        { req_type => 'get' } );
}


sub change_promo_footer {
    my ( $self, %param ) = @_;

    confess "Required parameter message!" unless ( $param{message} );

    return $self->f_request( [ qw/ system promo-footer / ],
        {
           req_type  => 'put',
           post_data => [ $param{message} ],
        }
    );
}


sub set_site_promo_footer_visible {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request( [ 'sites', $uuid ], {
            req_type  => 'put',
            post_data => [ { isPromoFooterVisible => 'true' } ],
        }
    );
}


sub set_site_promo_footer_invisible {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request( [ 'sites', $uuid ], {
            req_type  => 'put',
            post_data => [ { isPromoFooterVisible => 'false' } ],
        }
    );
}



sub set_limits {
    my ( $self, %param ) = @_;

    my $uuid = $self->_get_uuid( %param );

    return $self->f_request( [ 'sites', $uuid, 'limits' ], {
            req_type  => 'put',
            post_data => [ \%param ],
        }
    );
}


sub configure_buy_and_publish_dialog {
    my ( $self, $params ) = @_;

    return $self->f_request(['system', 'trial-mode', 'messages'], {req_type => 'put', post_data => [ $params ]});

}

sub _get_uuid {
    my ( $self, %param ) = @_;

    my $uuid = $param{uuid} ? $param{uuid} : $self->{uuid};
    confess "Required parameter uuid!" unless ( $uuid );

    return $uuid;
}


1;

lib/API/ParallelsWPB/Response.pm  view on Meta::CPAN

use strict;
use warnings;
use JSON::XS qw/decode_json/;

# ABSTRACT: processing of API responses

our $VERSION = '0.03'; # VERSION
our $AUTHORITY = 'cpan:IMAGO'; # AUTHORITY


sub new {
    my ( $class, $res ) = @_;

    my $success    = $res->is_success;
    my $status     = $res->status_line;

    my ( $json_content, $response, $error );

    if ( $success ) {
        $json_content = $res->content;
        $response = decode_json( $json_content )->{response} if $json_content;

lib/API/ParallelsWPB/Response.pm  view on Meta::CPAN

            json     => $json_content,
            error    => $error,
            response => $response,
            status   => $status
        },
        $class
    );
}


sub json {
    my $self = shift;

    return $self->{json};
}


sub success {
    my $self = shift;

    return $self->{success};
}


sub response {
    my $self = shift;

    return $self->{response};
}


sub status {
    my $self = shift;

    return $self->{status};
}



sub error {
    my $self = shift;

    return $self->{error};
}

1;

__END__

=pod

t/02_response.t  view on Meta::CPAN


use strict;
use warnings;

use Test::More tests => 2;
use Data::Dumper;
use API::ParallelsWPB::Response;
use HTTP::Response;
use API::ParallelsWPB;

subtest 'Response ok' => sub {

    plan tests => 3;

    my $r = HTTP::Response->new;
    $r->code( 200 );
    $r->content( '{"response":"b6a09c08f880f229c091de03b91bdbc3"}' );

    my $response = API::ParallelsWPB::Response->new( $r );

    ok( $response->success, 'Response status succeeded' );
    is(
        $response->response,
        'b6a09c08f880f229c091de03b91bdbc3',
        'Response content is ok'
    );

    is( $response->status, '200 OK', 'Status line is ok' );
};

subtest 'Response errored' => sub {

    plan tests => 4;

    my $r = HTTP::Response->new;
    $r->code( 404 );
    $r->content(
'{"error":{"message":"Requested resource does not exist by URI: /api/5.3/sites/"}}'
    );

    my $response = API::ParallelsWPB::Response->new( $r );

t/03_f_request.t  view on Meta::CPAN

use Data::Dumper;
use API::ParallelsWPB;
use API::ParallelsWPB::Response;
use utf8;

my %transfered_params = ();

{
    no warnings 'redefine';

    *API::ParallelsWPB::_send_request = sub {
        my ( $self, $data, $url, $post_data ) = @_;
        %transfered_params = (
            self      => $self,
            data      => $data,
            url       => $url,
            post_data => $post_data
        );
    };
}

my $client = API::ParallelsWPB->new(
    username => 'test',
    password => 'passw0rd',
    server   => '127.0.0.1'
);

subtest 'Test GET request' => sub {

    plan tests => 2;

    $client->f_request( [qw/ system version /], { req_type => 'get' } );

    is( $transfered_params{url}, 'https://127.0.0.1/api/5.3/system/version/',
        'URL is ok' );

    is_deeply(
        $transfered_params{data},
        { req_type => 'GET' },
        'Request type is GET'
    );

};

subtest 'Test POST request' => sub {

    plan tests => 3;

    $client->f_request(
        ['sites'],
        {
            req_type  => 'post',
            post_data => [ { state => 'trial' } ]
        }
    );

t/03_f_request.t  view on Meta::CPAN

    is( $transfered_params{post_data},
        qq/[{"state":"trial"}]/, 'POST data is ok' );

    is_deeply(
        $transfered_params{data},
        { req_type => 'POST', post_data => [ { state => 'trial' } ] },
        'Request type is POST'
    );
};

subtest 'Test POST request with uuid' => sub {

    plan tests => 4;

    $client->f_request(
        [ 'sites', '123', 'token' ],
        {
            req_type  => 'post',
            post_data => [
                {
                    localeCode      => 'de_DE',

t/03_f_request.t  view on Meta::CPAN

                    localeCode      => 'de_DE',
                    sessionLifeTime => 1000
                }
            ]
        },
        'Request type with uuid is POST'
    );
};


subtest 'Test unicode chars' => sub {
    plan tests => 1;

    $client->f_request(
        [ 'sites', '123' ],
        {
            req_type  => 'put',
            post_data => [
                {
                    ownerInfo => {
                        personalName => 'Василиус Пупкинус'

t/03_f_request.t  view on Meta::CPAN

    );

    like(
        $transfered_params{post_data},
        qr/Василиус Пупкинус/,
        'Unicode char is ok in request'
    );
};


subtest 'Test utf-8' => sub {
    no utf8;
    plan tests => 1;

    $client->f_request(
        [ 'sites', '123' ],
        {
            req_type  => 'put',
            post_data => [
                {
                    ownerInfo => {

t/04_requests.t  view on Meta::CPAN

use API::ParallelsWPB::Response;

use t::lib::Mock;

my $client = t::lib::Mock->new(
    username => 'test',
    password => 'passw0rd',
    server   => '127.0.0.1'
);

subtest 'get_version' => sub {
    plan tests => 2;

    $client->get_version;
    my $p = $client->get_request_params;

    like( $p->{url}, qr{/api/5.3/system/version/},
        'URL for get version is ok' );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_version is ok' );
};

subtest 'create_site' => sub {
    plan tests => 3;

    # after site creation uuid goes to $client, and methods with uuid required can be called without uuid in params
    my $client = t::lib::Mock->new(
        username => 'test',
        password => 'passw0rd',
        server   => '127.0.0.1'
    );

    $client->create_site( state => 'regular' );
    my $p = $client->get_request_params;

    like( $p->{url}, qr{/api/5.3/sites/}, 'URL for create_site is ok' );
    like( $p->{post_data}, qr{"state":"regular"},
        'post_data for create_site is ok' );
    is( $p->{data}->{req_type}, 'POST', 'Reqtype for create_site is ok' );
};

subtest 'gen_token' => sub {
    $client->gen_token( uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360' );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/token/},
        'URL for gen_token is ok'
    );
    like( $p->{post_data}, qr{"sessionLifeTime":"1800"},
        'post_data for gen_token is ok' );
    is( $p->{data}->{req_type}, 'POST', 'Reqtype for gen_token is ok' );
};

# URI: /api/5.3/sites/{site_uuid}/deploy
subtest 'deploy' => sub {
    $client->deploy(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
        title => 'Tiitle'
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/deploy},
        'URL for deploy is ok'
    );

    like( $p->{post_data}, qr{"generic","en_US","Tiitle"}, 'post_data for deploy is ok' );

    is( $p->{data}->{req_type}, 'POST', 'Reqtype for deploy is ok' );
};

# /api/5.3/sites/{site_uuid}/
subtest 'get_site_info' => sub {
    $client->get_site_info(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/},
        'URL for get_site_info is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_site_info is ok' );

};


#  /api /5.3/sites/
subtest 'get_sites_info' => sub {
    $client->get_sites_info;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/},
        'URL for get_sites_info is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_sites_info is ok' );
};

# /api/5.3/sites/{site_uuid}/
subtest 'change_site_properties' => sub {
    $client->change_site_properties(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
        state => 'trial'
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/},
        'URL for change_site_properties is ok'
    );

    like( $p->{post_data}, qr{"state":"trial"}, 'post_data for change_site_properties is ok' );

    is( $p->{data}->{req_type}, 'PUT', 'Reqtype for change_site_properties is ok' );
};


# /api/5.3/sites/{siteUuid}/publish
subtest 'publish' => sub {
    $client->publish(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/publish/},
        'URL for publish is ok'
    );

    is( $p->{data}->{req_type}, 'POST', 'Reqtype for publish is ok' );
};



# /api/5.3/sites/{siteUuid}/
subtest 'delete_site' => sub {
    $client->delete_site(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/},
        'URL for delete_site is ok'
    );

    is( $p->{data}->{req_type}, 'DELETE', 'Reqtype for delete_site is ok' );
};


# /api/5.3/system/promo-footer
subtest 'get_promo_footer' => sub {
    $client->get_promo_footer;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/promo-footer},
        'URL for get_promo_footer is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_promo_footer is ok' );
};


#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_site_custom_variable' => sub {
    $client->get_site_custom_variable(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/custom-properties},
        'URL for get_site_custom_variable is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_site_custom_variable is ok' );
};


#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'set_site_custom_variable' => sub {
    $client->set_site_custom_variable(
        uuid  => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
    );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/sites/[\d\w\-]+/custom-properties},
        'URL for set_site_custom_variable is ok'
    );

    is( $p->{data}->{req_type}, 'PUT', 'Reqtype for set_site_custom_variable is ok' );
};

#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_sites_custom_variables' => sub {
    $client->get_sites_custom_variables;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/custom-properties},
        'URL for get_sites_custom_variables is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_sites_custom_variables is ok' );
};

#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_sites_custom_variables' => sub {
    $client->get_sites_custom_variables;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/custom-properties},
        'URL for get_sites_custom_variables is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_sites_custom_variables is ok' );
};

#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'set_sites_custom_variables' => sub {
    $client->set_sites_custom_variables;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/custom-properties},
        'URL for set_sites_custom_variables is ok'
    );

    is( $p->{data}->{req_type}, 'PUT', 'Reqtype for set_sites_custom_variables is ok' );
};

#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'set_custom_trial_messages' => sub {
    $client->set_custom_trial_messages;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/trial-mode/messages},
        'URL for set_custom_trial_messages is ok'
    );

    is( $p->{data}->{req_type}, 'PUT', 'Reqtype for set_custom_trial_messages is ok' );
};

#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_custom_trial_messages' => sub {
    $client->get_custom_trial_messages;
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/trial-mode/messages},
        'URL for get_custom_trial_messages is ok'
    );

    is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_custom_trial_messages is ok' );
};

#  /api/5.3/sites/{site_uuid}/custom-properties
subtest 'change_promo_footer' => sub {
    $client->change_promo_footer( message => 'test' );
    my $p = $client->get_request_params;

    like(
        $p->{url},
        qr{/api/5.3/system/promo-footer},
        'URL for change_promo_footer is ok'
    );

    is( $p->{post_data}, q/["test"]/, 'Post data for change_promo_footer is ok');

t/lib/Mock.pm  view on Meta::CPAN


# ABSTRACT: mock for testing API::ParallelsWPB

# VERSION
# AUTHORITY

my %send_request_params = ();

{
    no warnings 'redefine';
    *API::ParallelsWPB::_send_request = sub {
        my ( $self, $data, $url, $post_data ) = @_;

        %send_request_params = (
            self      => $self,
            url       => $url,
            data      => $data,
            post_data => $post_data
        );

        my $res = HTTP::Response->new;

t/lib/Mock.pm  view on Meta::CPAN

            $res->content( '{"response":"6d3f6f9f-55b2-899f-5fb4-ae04b325e360"}' );
        }
        else {
            $res->code( 200 );
        }

        return API::ParallelsWPB::Response->new( $res );
    };
}

sub get_request_params { \%send_request_params }

1;



( run in 0.776 second using v1.01-cache-2.11-cpan-88abd93f124 )