view release on metacpan or search on metacpan
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
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
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2014 by REG.RU LLC.
This is free software, licensed under:
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the Package
with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
META.json
META.yml
Makefile.PL
README
README.md
lib/API/ParallelsWPB.pm
lib/API/ParallelsWPB/Requests.pm
lib/API/ParallelsWPB/Response.pm
t/00-compile.t
t/01_load_modules.t
t/02_response.t
t/03_f_request.t
t/04_requests.t
t/author-test-eol.t
t/lib/API/ParallelsWPB/Mock.pm
t/lib/Mock.pm
t/release-distmeta.t
t/release-kwalitee.t
t/release-no-tabs.t
t/release-pod-coverage.t
t/release-pod-syntax.t
{
"abstract" : "client for Parallels Presence Builder API",
"author" : [
"Alexander Ruzhnikov <a.ruzhnikov@reg.ru>",
"Polina Shubina <shubina@reg.ru>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.132830",
"license" : [
"perl_5"
],
"meta-spec" : {
],
"namespace" : [
"t::lib"
],
"package" : [
"DB"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.30"
}
},
"develop" : {
"requires" : {
"Pod::Coverage::TrustPod" : "0",
"Test::CPAN::Meta" : "0",
"Test::Kwalitee" : "1.12",
"Test::More" : "0",
"Test::NoTabs" : "0",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"JSON::XS" : "0",
"LWP::Protocol::https" : "0",
"LWP::UserAgent" : "0",
"perl" : "5.008009",
"strict" : "0",
"warnings" : "0"
}
},
"test" : {
"requires" : {
"File::Spec" : "0",
"File::Temp" : "0",
"HTTP::Response" : "6.04",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::Fatal" : "0.010",
"Test::More" : "0.98",
"Test::Pod" : "1.22",
"Test::Warnings" : "0.010"
}
"API::ParallelsWPB::Requests" : {
"file" : "lib/API/ParallelsWPB/Requests.pm",
"version" : "0.03"
},
"API::ParallelsWPB::Response" : {
"file" : "lib/API/ParallelsWPB/Response.pm",
"version" : "0.03"
}
},
"release_status" : "stable",
"resources" : {},
"version" : "0.03",
"x_authority" : "cpan:IMAGO"
}
---
abstract: 'client for Parallels Presence Builder API'
author:
- 'Alexander Ruzhnikov <a.ruzhnikov@reg.ru>'
- 'Polina Shubina <shubina@reg.ru>'
build_requires:
File::Spec: 0
File::Temp: 0
HTTP::Response: 6.04
IO::Handle: 0
IPC::Open3: 0
Test::Fatal: 0.010
Test::More: 0.98
Test::Pod: 1.22
Test::Warnings: 0.010
configure_requires:
ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.132830'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: API-ParallelsWPB
no_index:
directory:
provides:
API::ParallelsWPB:
file: lib/API/ParallelsWPB.pm
version: 0.03
API::ParallelsWPB::Requests:
file: lib/API/ParallelsWPB/Requests.pm
version: 0.03
API::ParallelsWPB::Response:
file: lib/API/ParallelsWPB/Response.pm
version: 0.03
requires:
Carp: 0
JSON::XS: 0
LWP::Protocol::https: 0
LWP::UserAgent: 0
perl: 5.008009
strict: 0
warnings: 0
resources: {}
version: 0.03
x_authority: cpan:IMAGO
Makefile.PL view on Meta::CPAN
use strict;
use warnings;
use 5.008009;
use ExtUtils::MakeMaker 6.30;
my %WriteMakefileArgs = (
"ABSTRACT" => "client for Parallels Presence Builder API",
"AUTHOR" => "Alexander Ruzhnikov <a.ruzhnikov\@reg.ru>, Polina Shubina <shubina\@reg.ru>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.30"
},
"DISTNAME" => "API-ParallelsWPB",
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "API::ParallelsWPB",
"PREREQ_PM" => {
"Carp" => 0,
NAME
API::ParallelsWPB - client for Parallels Presence Builder API
VERSION
version 0.03
SYNOPSIS
my $client = API::ParallelsWPB->new( username => 'admin', password => 'passw0rd', server => 'builder.server.mysite.ru' );
my $response = $client->get_sites_info;
if ( $response->success ) {
for my $site ( @{ $response->response } ) {
say "UUID: ". $site->{uuid};
}
}
else {
warn "Error occured: " . $response->error . ", Status: " . $response->status;
}
METHODS
new($class, %param)
Creates new client instance. Parameters for "new" are:
username
Username for connection to Parallels WebPresence Builder instance.
Required parameter.
password
Password for connection to Parallels WebPresence Builder instance.
Required parameter.
server
Servername or server ip address for connection to Parallels
WebPresence Builder instance. Optional parameter.
api_version
API version, used in API url constructing. Optional parameter.
debug
Debug flag, requests will be loogged to stderr. Optional parameter.
timeout
Connection timeout. Optional parameter.
f_request($self, $url_array_ref, $data)
"Free" request. Now for internal usage only.
$data: req_type : HTTP request type: get, post, put, delete. GET by
default. post_data: data for POST request. Must be hashref.
SEE ALSO
Parallels Presence Builder Guide
<http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-build
er-standalone-installation-administration-guide>
API::ParallelsWPB::Response
API::ParallelsWPB::Requests
AUTHORS
* Alexander Ruzhnikov <a.ruzhnikov@reg.ru>
* Polina Shubina <shubina@reg.ru>
# NAME
API::ParallelsWPB - client for Parallels Presence Builder API
# SYNOPSIS
```perl
my $client = API::ParallelsWPB->new(username => 'admin', password => 'passw0rd', server => 'builder.server.mysite.ru');
my $response = $client->get_sites_info;
if ($response->success) {
for my $site (@{$response->response}) {
say "UUID: ". $site->{ uuid };
}
}
else {
warn "Error occured: " . $response->error . ", Status: " . $response->status;
}
```
# METHODS
## new
Creates new client instance. Parameters for ```new``` are:
- username
Username for connection to Parallels WebPresence Builder instance. Required parameter.
- password
Password for connection to Parallels WebPresence Builder instance. Required parameter.
- server
Servername or server ip address for connection to Parallels WebPresence Builder instance. Optional parameter.
- api_version
API version, used in API url constructing. Optional parameter.
- debug
Debug flag, requests will be loogged to stderr. Optional parameter.
- timeout
Connection timeout. Optional parameter.
# SEE ALSO
[Parallels Presence Builder Guide](http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide)
# AUTHORS
- Alexander Ruzhnikov, "<a.ruzhnikov@reg.ru>"
- Polina Shubina, "<shubina@reg.ru>"
# LICENSE AND COPYRIGHT
This software is copyright (c) 2013 by REG.RU LLC.
lib/API/ParallelsWPB.pm view on Meta::CPAN
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use Carp;
use API::ParallelsWPB::Response;
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;
lib/API/ParallelsWPB.pm view on Meta::CPAN
if ( $data->{req_type} eq 'POST' || $data->{req_type} eq 'PUT' ) {
$data->{post_data} ||= {};
unless ( ref $data->{post_data} eq 'HASH' || ref $data->{post_data} eq 'ARRAY' ) {
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 );
}
$req->authorization_basic( $self->{username}, $self->{password} );
$ua->ssl_opts( verify_hostname => 0 );
$ua->timeout( $self->{timeout} );
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};
}
lib/API/ParallelsWPB.pm view on Meta::CPAN
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
API::ParallelsWPB - client for Parallels Presence Builder API
=head1 VERSION
version 0.03
=head1 SYNOPSIS
my $client = API::ParallelsWPB->new( username => 'admin', password => 'passw0rd', server => 'builder.server.mysite.ru' );
my $response = $client->get_sites_info;
if ( $response->success ) {
for my $site ( @{ $response->response } ) {
say "UUID: ". $site->{uuid};
}
}
else {
warn "Error occured: " . $response->error . ", Status: " . $response->status;
}
=head1 METHODS
=head2 B<new($class, %param)>
Creates new client instance. Parameters for C<new> are:
=over
=item username
Username for connection to Parallels WebPresence Builder instance. Required parameter.
=item password
Password for connection to Parallels WebPresence Builder instance. Required parameter.
=item server
Servername or server ip address for connection to Parallels WebPresence Builder instance. Optional parameter.
=item api_version
API version, used in API url constructing. Optional parameter.
=item debug
Debug flag, requests will be loogged to stderr. Optional parameter.
=item timeout
lib/API/ParallelsWPB.pm view on Meta::CPAN
=head2 B<f_request($self, $url_array_ref, $data)>
"Free" request. Now for internal usage only.
$data:
req_type : HTTP request type: get, post, put, delete. GET by default.
post_data: data for POST request. Must be hashref.
=head1 SEE ALSO
L<Parallels Presence Builder Guide|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide>
L<API::ParallelsWPB::Response>
L<API::ParallelsWPB::Requests>
=head1 AUTHORS
=over 4
=item *
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
$param{ownerInfo} ||= {};
$param{isPromoFooterVisible} ||= '';
my $post_array = [ {
state => $param{state},
publicationSettings => $param{publicationSettings},
ownerInfo => $param{ownerInfo},
isPromoFooterVisible => $param{isPromoFooterVisible}
} ];
my $res = $self->f_request(
['sites'],
{
req_type => 'post',
post_data => $post_array,
}
);
my $uuid = $res->response;
if ( $uuid ) {
$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 );
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
API::ParallelsWPB::Requests - processing of API requests
=head1 VERSION
version 0.03
=head1 METHODS
=head2 B<get_version($self)>
Getting the current version of the Parallels Web Presence Builder instance on the defined server.
=head2 B<create_site($self, %param)>
Creating a site.
%param:
state
trial | suspended | regular
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
This parameter is optional.
ownerInfo
{
"personalName" => "John Doe",
"companyName" => "My Company LTD",
"phone" => "+1-954-555-555",
"email" => "john@example.com",
"address" => "New",
"city" => "New York",
"state" => "New York",
"zip" => "10292",
"country" => "United states"
}
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.
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
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.
L<Creating a Site Based on a Website Topic|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=72111.htm>
=head2 B<get_site_info($self, %param)>
Retrieving information about a specific site.
%param:
uuid
Site UUID. This parameter is mandatory.
L<Retrieving Information About a Specific Site|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=69690.htm>
=head2 B<get_sites_info($self)>
Retrieving information about all sites.
No parameters are required.
L<Retrieving Information About All Sites|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71285.htm>
=head2 B<change_site_properties($self, %param)>
Changes site properties.
%param:
state
trial | suspended | regular
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
ownerInfo
This parameter is optional. It specifies the contact information of the site owner.
isPromoFooterVisible
1 | 0
This parameter is optional. It specifies whether a text box with an advertisement should be shown in the website footer.
L<Changing Site Properties and Settings|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=69692.htm>
=head2 B<publish($self,%param)>
Publish a site.
%param:
uuid
Site UUID.
L<Publishing a Website|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=72112.htm>
=head2 B<delete_site($self, %param)>
Deleting a site.
%param:
uuid
Site UUID.
L<Deleting a Site|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=69669.htm>
=head2 B<get_promo_footer( $self )>
Retrieving the current content of the promotional footer.
L<Retrieving the Current Content of the Promotional Footer|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71979_1.htm>
=head2 B<get_site_custom_variable($self, %param)>
Retrieving a List of Custom Variables for a Website.
%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
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<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
Site Logo module.
script
Script module.
slider
Image Slider module.
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",
lib/API/ParallelsWPB/Requests.pm view on Meta::CPAN
"messages" => {
"upsellDialogTitle" => $title,
"upsellDialogMsg" => $html
}
}
]
L<Configuring the Buy and Publish Dialog Window|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide/index.htm?fileName=71987.htm>
=head1 NAME
API::ParallelsWPB::Requests
=head1 SEE ALSO
L<Parallels Presence Builder Guide|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide>
L<API::ParallelsWPB>
L<API::ParallelsWPB::Response>
=head1 AUTHORS
=over 4
=item *
lib/API/ParallelsWPB/Response.pm view on Meta::CPAN
package API::ParallelsWPB::Response;
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;
}
else {
my $error_json = $res->content;
eval { $error = decode_json( $error_json )->{error}->{message}; 1; }
or do { $error = $error_json };
}
return bless(
{
success => $success,
json => $json_content,
error => $error,
response => $response,
status => $status
},
$class
);
}
sub json {
my $self = shift;
lib/API/ParallelsWPB/Response.pm view on Meta::CPAN
}
sub success {
my $self = shift;
return $self->{success};
}
sub response {
my $self = shift;
return $self->{response};
}
sub status {
my $self = shift;
return $self->{status};
}
lib/API/ParallelsWPB/Response.pm view on Meta::CPAN
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
API::ParallelsWPB::Response - processing of API responses
=head1 VERSION
version 0.03
=head1 METHODS
=head2 B<new($class, $res)>
Creates new API::ParallelsWPB::Response object.
$res - HTTP::Response object.
=head2 B<json($self)>
Returns original JSON answer.
=head2 B<success($self)>
Returns 1 if request succeeded, 0 otherwise.
=head2 B<response($self)>
Returns munged response from service. According to method, it can be scalar, hashref of arrayref.
=head2 B<status($self)>
Returns response status line.
=head2 B<error($self)>
Returns munged error text.
=head1 SEE ALSO
L<Parallels Presence Builder Guide|http://download1.parallels.com/WPB/Doc/11.5/en-US/online/presence-builder-standalone-installation-administration-guide>
L<API::ParallelsWPB>
L<API::ParallelsWPB::Requests>
=head1 AUTHORS
=over 4
=item *
t/01_load_modules.t view on Meta::CPAN
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
success
response
status
/;
for my $response_method ( @response_methods ) {
can_ok('API::ParallelsWPB::Response', $response_method);
}
done_testing();
t/02_response.t view on Meta::CPAN
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 );
ok( !$response->success, 'Response is not succeeded' );
like(
$response->error,
qr/Requested resource does not exist/,
'Error message is ok'
);
ok( !$response->response, 'No content given ok' );
is( $response->status, '404 Not Found', 'Response status is ok' );
};
t/lib/Mock.pm view on Meta::CPAN
*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;
# Mocking HTTP response for different methods
if ( $url =~ m{/api/5.3/sites/$} ) {
# Create site request
$res->code( 200 );
$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;