API-ParallelsWPB

 view release on metacpan or  search on metacpan

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


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 ],
        }

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



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 ]
        }
    );
}

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


    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 ],
        }
    );
}

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

    }

    This parameter is optional.

isPromoFooterVisible

    1 | 0

    This parameter is optional.
    It specifies whether a text box containing an advertisement should be shown in a website footer (a section that appears at the bottom of every page on a site).
    To learn more about how to set the content to be shown in the promotional footer,
    see the section L<Configuring the Promotional Footer|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/71977.htm>.

L<Creating a Site|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=69689.htm>

=head2 B<gen_token($self, %param)>

Generating a Security Token for Accessing a Site

%param:

uuid

    Site UUID. This parameter is mandatory.

localeCode

    This parameter is optional.

    It specifies the language that should be set for the user interface when the user (site owner) logs in to the editor.

    The following languages are supported:

        en_US - American English.
        en_GB - British English.
        de_DE - German.
        es_ES - Spanish.
        fr_FR - French
        it_IT - Italian.
        ja_JP - Japanese.

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

%param:

uuid

    Site UUID.

L<Configuring the Trial Mode|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71623.htm>

L<Setting Trial Mode Messages|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71727.htm>

=head2 B<set_site_custom_variable($self, %param)>

Setting a Custom Variable for a Website

%param:

    uuid
    variable1 => value1
    variable2 => value2
    ...
    variableN => valueN

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

L<Setting Trial Mode Messages|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71727.htm>

=head2 B<get_sites_custom_variables($self)>

Retrieving Custom Variables Defined for All Websites

L<Configuring the Trial Mode|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71623.htm>

L<Setting Trial Mode Messages|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71727.htm>

=head2 B<set_sites_custom_variables($self, %param)>

Setting Custom Variables for All Websites

%param:

    variable1 => value1
    variable2 => value2
    ...
    variableN => valueN

L<Configuring the Trial Mode|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71623.htm>

L<Setting Trial Mode Messages|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71727.htm>

=head2 B<set_custom_trial_messages($self, @param)>

Setting Custom Messages for the Trial Mode

    my $response = $api->set_custom_trial_messages(
        {
            localeCode  => 'en_US',
            messages    => {
                defaultPersonalName => '{message1_en}',
                editorTopMessageTrialSite => '{message2_en}',
                initialMailSubject => '{message3_en}',
                initialMailHtml => '{message4_en}',
                trialSiteSignUpPublishTitle => '{message5_en}',
                trialSiteSignUpPublishMsg => '{message6_en}'
            }

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

Retrieving Custom Messages for the Trial Mode

=head2 B<change_promo_footer($self, %param)>

Changing the Default Content of the Promotional Footer

%param:

    message

=head2 B<set_site_promo_footer_visible($self, %param)>

Showing the Promotional Footer on Websites

%param:

    uuid

=head2 B<set_site_promo_footer_invisible($self, %param)>

Removing the Promotional Footer from Websites

%param:

    uuid

=head2 B<set_limits>

Set limitations for single site

%param:

uuid

    Site UUID.

The next list contains parameters/modules, that can be limited. Value for parameter must be an integer, that means maximum number of elements, that can be added on site. Value -1 means unlimited elements count

t/01_load_modules.t  view on Meta::CPAN

    create_site
    gen_token
    deploy
    get_site_info
    get_sites_info
    change_site_properties
    publish
    delete_site
    get_promo_footer
    get_site_custom_variable
    set_site_custom_variable
    get_sites_custom_variables
    set_sites_custom_variables
    set_custom_trial_messages
    get_custom_trial_messages
    change_promo_footer
    set_site_promo_footer_visible
    set_site_promo_footer_invisible
    _get_uuid
    _send_request
/;

for my $basic_method ( @basic_methods ) {
    can_ok('API::ParallelsWPB', $basic_method);
}

my @request_methods = qw/
    get_version
    create_site
    gen_token
    deploy
    get_site_info
    get_sites_info
    change_site_properties
    publish
    delete_site
    get_promo_footer
    get_site_custom_variable
    set_site_custom_variable
    get_sites_custom_variables
    set_sites_custom_variables
    set_custom_trial_messages
    get_custom_trial_messages
    change_promo_footer
    set_site_promo_footer_visible
    set_site_promo_footer_invisible
    _get_uuid
/;

for my $request_method ( @request_methods ) {
    can_ok('API::ParallelsWPB::Requests', $request_method);
}

my @response_methods = qw/
    new
    json

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

        $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},

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

    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},



( run in 1.477 second using v1.01-cache-2.11-cpan-49f99fa48dc )