API-ParallelsWPB
view release on metacpan or search on metacpan
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
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' ],
{
req_type => 'post',
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
}
);
}
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
=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.
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
fr_FR - French
it_IT - Italian.
ja_JP - Japanese.
nl_NL - Dutch.
pl_PL - Polish.
pt_BR - Brazilian Portuguese
ru_RU - Russian.
zh_CN - simplified Chinese.
zh_TW - traditional Chinese.
If no locale is defined, en_US will be used.
sessionLifeTime
This parameter is optional. It specifies the period of inactivity for a user's session in the editor. When this period elapses,
the security token expires and the user needs to log in again. 1800 seconds by default.
L<Generating a Security Token for Accessing a Site|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=69691.htm>
=head2 B<deploy($self, %param)>
Creates site based on a specified topic.
my $response =
$client->deploy( localeCode => 'en_US', templateCode => 'music_blog' );
%param:
uuid
Site UUID. This parameter is mandatory.
localeCode
Locale code. The default value is en_US.
templateCode
Internal topic identification code. This parameter is optional. Default value is 'generic'.
title
Website name. This parameter is optional. Specifies what should be shown as the website name in the browser's title bar.
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
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}'
}
},
{
localeCode => 'de_DE',
messages => {
defaultPersonalName => '{message1_de}',
editorTopMessageTrialSite => '{message2_de}',
initialMailSubject => '{message3_de}',
initialMailHtml => '{message4_de}',
trialSiteSignUpPublishTitle => '{message5_de}',
trialSiteSignUpPublishMsg => '{message6_de}'
}
},
);
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
L<Restricting Resources by Means of the API|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71986.htm>
=head2 B<configure_buy_and_publish_dialog>
Configuration for Buy & Publish dialog box in constructor.
$params:
[
{
"localeCode" => "de_DE",
"messages" => {
"upsellDialogTitle" => $title,
"upsellDialogMsg" => $html
}
},
{
"localeCode" => "ru_RU",
"messages" => {
"upsellDialogTitle" => $title,
"upsellDialogMsg" => $html
}
}
]
t/03_f_request.t view on Meta::CPAN
subtest 'Test POST request with uuid' => sub {
plan tests => 4;
$client->f_request(
[ 'sites', '123', 'token' ],
{
req_type => 'post',
post_data => [
{
localeCode => 'de_DE',
sessionLifeTime => 1000
}
],
}
);
is(
$transfered_params{url},
'https://127.0.0.1/api/5.3/sites/123/token/',
'Url for post with uuid is ok'
);
like( $transfered_params{post_data},
qr/"sessionLifeTime":1000/, 'sessionLifeTime param trasfered' );
like( $transfered_params{post_data},
qr/"localeCode":"de_DE"/, 'LocaleCode trasfered' );
is_deeply(
$transfered_params{data},
{
req_type => 'POST',
post_data => [
{
localeCode => 'de_DE',
sessionLifeTime => 1000
}
]
},
'Request type with uuid is POST'
);
};
subtest 'Test unicode chars' => sub {
( run in 0.670 second using v1.01-cache-2.11-cpan-98e64b0badf )