Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 1cd1cbf

Browse files
refactor(pkg): rewrite in direction of our cross-SDK UML Diagram
BREAKING CHANGE: Downward incompatible, please migrate. The whole class structure and usage behavior has changed.
1 parent 41a4061 commit 1cd1cbf

22 files changed

+1727
-1229
lines changed

Makefile

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ O_FILES =
165165
H_FILES =
166166
MAN1PODS =
167167
MAN3PODS = lib/WebService/Hexonet.pm \
168-
lib/WebService/Hexonet/Connector.pm \
169-
lib/WebService/Hexonet/Connector/Connection.pm \
170-
lib/WebService/Hexonet/Connector/Response.pm \
171-
lib/WebService/Hexonet/Connector/Util.pm
168+
lib/WebService/Hexonet/Connector.pm
172169

173170
# Where is the Config information that we are using/depend on
174171
CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h
@@ -193,9 +190,14 @@ PERL_ARCHIVE_AFTER =
193190

194191
TO_INST_PM = lib/WebService/Hexonet.pm \
195192
lib/WebService/Hexonet/Connector.pm \
196-
lib/WebService/Hexonet/Connector/Connection.pm \
193+
lib/WebService/Hexonet/Connector/APIClient.pm \
194+
lib/WebService/Hexonet/Connector/Column.pm \
195+
lib/WebService/Hexonet/Connector/Record.pm \
197196
lib/WebService/Hexonet/Connector/Response.pm \
198-
lib/WebService/Hexonet/Connector/Util.pm
197+
lib/WebService/Hexonet/Connector/ResponseParser.pm \
198+
lib/WebService/Hexonet/Connector/ResponseTemplate.pm \
199+
lib/WebService/Hexonet/Connector/ResponseTemplateManager.pm \
200+
lib/WebService/Hexonet/Connector/SocketConfig.pm
199201

200202

201203
# --- MakeMaker platform_constants section:
@@ -423,16 +425,10 @@ POD2MAN = $(POD2MAN_EXE)
423425

424426
manifypods : pure_all config \
425427
lib/WebService/Hexonet.pm \
426-
lib/WebService/Hexonet/Connector.pm \
427-
lib/WebService/Hexonet/Connector/Connection.pm \
428-
lib/WebService/Hexonet/Connector/Response.pm \
429-
lib/WebService/Hexonet/Connector/Util.pm
428+
lib/WebService/Hexonet/Connector.pm
430429
$(NOECHO) $(POD2MAN) --section=$(MAN3EXT) --perm_rw=$(PERM_RW) -u \
431430
lib/WebService/Hexonet.pm $(INST_MAN3DIR)/WebService::Hexonet.$(MAN3EXT) \
432-
lib/WebService/Hexonet/Connector.pm $(INST_MAN3DIR)/WebService::Hexonet::Connector.$(MAN3EXT) \
433-
lib/WebService/Hexonet/Connector/Connection.pm $(INST_MAN3DIR)/WebService::Hexonet::Connector::Connection.$(MAN3EXT) \
434-
lib/WebService/Hexonet/Connector/Response.pm $(INST_MAN3DIR)/WebService::Hexonet::Connector::Response.$(MAN3EXT) \
435-
lib/WebService/Hexonet/Connector/Util.pm $(INST_MAN3DIR)/WebService::Hexonet::Connector::Util.$(MAN3EXT)
431+
lib/WebService/Hexonet/Connector.pm $(INST_MAN3DIR)/WebService::Hexonet::Connector.$(MAN3EXT)
436432

437433

438434

@@ -890,9 +886,14 @@ pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
890886
$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)], '\''$(PERM_DIR)'\'')' -- \
891887
'lib/WebService/Hexonet.pm' 'blib/lib/WebService/Hexonet.pm' \
892888
'lib/WebService/Hexonet/Connector.pm' 'blib/lib/WebService/Hexonet/Connector.pm' \
893-
'lib/WebService/Hexonet/Connector/Connection.pm' 'blib/lib/WebService/Hexonet/Connector/Connection.pm' \
889+
'lib/WebService/Hexonet/Connector/APIClient.pm' 'blib/lib/WebService/Hexonet/Connector/APIClient.pm' \
890+
'lib/WebService/Hexonet/Connector/Column.pm' 'blib/lib/WebService/Hexonet/Connector/Column.pm' \
891+
'lib/WebService/Hexonet/Connector/Record.pm' 'blib/lib/WebService/Hexonet/Connector/Record.pm' \
894892
'lib/WebService/Hexonet/Connector/Response.pm' 'blib/lib/WebService/Hexonet/Connector/Response.pm' \
895-
'lib/WebService/Hexonet/Connector/Util.pm' 'blib/lib/WebService/Hexonet/Connector/Util.pm'
893+
'lib/WebService/Hexonet/Connector/ResponseParser.pm' 'blib/lib/WebService/Hexonet/Connector/ResponseParser.pm' \
894+
'lib/WebService/Hexonet/Connector/ResponseTemplate.pm' 'blib/lib/WebService/Hexonet/Connector/ResponseTemplate.pm' \
895+
'lib/WebService/Hexonet/Connector/ResponseTemplateManager.pm' 'blib/lib/WebService/Hexonet/Connector/ResponseTemplateManager.pm' \
896+
'lib/WebService/Hexonet/Connector/SocketConfig.pm' 'blib/lib/WebService/Hexonet/Connector/SocketConfig.pm'
896897
$(NOECHO) $(TOUCH) pm_to_blib
897898

898899

Makefile.PL

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ WriteMakefile(
66
VERSION_FROM => 'lib/WebService/Hexonet/Connector.pm',
77
PREREQ_PM => {
88
'LWP::Protocol::https' => 6.07,
9-
'LWP::UserAgent' => 6.35,
10-
'Time::Local' => 0,
11-
'MIME::Base64' => 0,
12-
'Data::Dumper' => 2.161
9+
'LWP::UserAgent' => 6.35,
10+
'Time::Local' => 0,
11+
'MIME::Base64' => 0,
12+
'Data::Dumper' => 2.161
1313
},
1414
TEST_REQUIRES => {
1515
'Test::More' => 0,

docs/connection.html

Lines changed: 0 additions & 90 deletions
This file was deleted.

docs/connector.html

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!--
66
generated by Pod::Simple::HTML v3.35,
77
using Pod::Simple::PullParser v3.35,
8-
under Perl v5.026001 at Fri Aug 3 08:07:48 2018 GMT.
8+
under Perl v5.026001 at Wed Dec 12 10:23:28 2018 GMT.
99
1010
If you want to change this HTML document, you probably shouldn't do that
1111
by changing it directly. Instead, see about changing the calling options
@@ -40,35 +40,33 @@ <h1><a class='u'
4040
cpanm WebService::Hexonet::Connector
4141
# NOTE: We suggest to use cpanm (App::cpanminus) for several reasons.
4242

43-
43+
use 5.014_004;
4444
use strict;
4545
use warnings;
46-
use WebService::Hexonet::Connector;
46+
use WebService::Hexonet::Connector::APIClient;
4747

4848
# Create a connection with the URL, entity, login and password
4949
# Use &#34;1234&#34; as entity for the OT&#38;E, and &#34;54cd&#34; for productive use
5050
# Don&#39;t have a Hexonet Account yet? Get one here: www.hexonet.net/sign-up
51-
my $api = WebService::Hexonet::Connector::connect({
52-
url =&#62; &#39;https://coreapi.1api.net/api/call.cgi&#39;,
53-
entity =&#62; &#39;1234&#39;,
54-
login =&#62; &#39;test.user&#39;,
55-
password =&#62; &#39;test.passw0rd&#39;,
56-
});
51+
my $cl = APIClient-&#62;new();
52+
$cl-&#62;useOTESystem();
53+
$cl-&#62;setCredentials(&#34;test.user&#34;, &#34;test.passw0rd&#34;);
54+
$cl-&#62;setRemoteIPAddress(&#34;1.2.3.4&#34;);
5755

5856
# Call a command
59-
my $response = $api-&#62;call({
57+
my $response = $cl-&#62;request({
6058
command =&#62; &#34;querydomainlist&#34;,
6159
limit =&#62; 5
6260
});
6361

6462
# Display the result in the format you want
65-
my $res = $response-&#62;as_list();
66-
$res = $response-&#62;as_list_hash();
67-
$res = $response-&#62;as_hash();
63+
my $res = $response-&#62;getListHash());
64+
$res = $response-&#62;getHash();
65+
$res = $response-&#62;getPlain();
6866

6967
# Get the response code and the response description
70-
my $code = $response-&#62;code();
71-
my $description = $response-&#62;description();
68+
my $code = $response-&#62;getCode();
69+
my $description = $response-&#62;getDescription();
7270

7371
print &#34;$code $description&#34;;</pre>
7472

@@ -87,48 +85,59 @@ <h1><a class='u'
8785
<p>We&#39;ve split our functionality into submodules to give this module a better structure.</p>
8886

8987
<dl>
90-
<dt><a name="WebService::Hexonet::Connector::Connection_-_API_Client_functionality."
91-
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AConnection" class="podlinkpod"
92-
>WebService::Hexonet::Connector::Connection</a> - API Client functionality.</a></dt>
88+
<dt><a name="WebService::Hexonet::Connector::APIClient_-_API_Client_functionality."
89+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AAPIClient" class="podlinkpod"
90+
>WebService::Hexonet::Connector::APIClient</a> - API Client functionality.</a></dt>
91+
92+
<dd>
93+
<dt><a name="WebService::Hexonet::Connector::Column_-_API_Response_Data_handling_as_&#34;Column&#34;."
94+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AColumn" class="podlinkpod"
95+
>WebService::Hexonet::Connector::Column</a> - API Response Data handling as &#34;Column&#34;.</a></dt>
96+
97+
<dd>
98+
<dt><a name="WebService::Hexonet::Connector::Record_-_API_Response_Data_handling_as_&#34;Record&#34;."
99+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ARecord" class="podlinkpod"
100+
>WebService::Hexonet::Connector::Record</a> - API Response Data handling as &#34;Record&#34;.</a></dt>
93101

94102
<dd>
95103
<dt><a name="WebService::Hexonet::Connector::Response_-_API_Response_functionality."
96104
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponse" class="podlinkpod"
97105
>WebService::Hexonet::Connector::Response</a> - API Response functionality.</a></dt>
98106

99107
<dd>
100-
<dt><a name="WebService::Hexonet::Connector::Util_-_Bundle_of_Helper_methods."
101-
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AUtil" class="podlinkpod"
102-
>WebService::Hexonet::Connector::Util</a> - Bundle of Helper methods.</a></dt>
103-
</dl>
108+
<dt><a name="WebService::Hexonet::Connector::ResponseParser_-_API_Response_Parser_functionality."
109+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponseParser" class="podlinkpod"
110+
>WebService::Hexonet::Connector::ResponseParser</a> - API Response Parser functionality.</a></dt>
104111

105-
<h1><a class='u'
106-
name="METHODS_WebService::Hexonet::Connector"
107-
>METHODS WebService::Hexonet::Connector</a></h1>
112+
<dd>
113+
<dt><a name="WebService::Hexonet::Connector::ResponseTemplate_-_API_Response_Template_functionality."
114+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponseTemplate" class="podlinkpod"
115+
>WebService::Hexonet::Connector::ResponseTemplate</a> - API Response Template functionality.</a></dt>
108116

109-
<dl>
110-
<dt><a name="connect(url,_entity,_login,_password,_user,_role)"
111-
><code>connect(url, entity, login, password, user, role)</code></a></dt>
117+
<dd>
118+
<dt><a name="WebService::Hexonet::Connector::ResponseTemplateManager_-_API_Response_Template_Manager_functionality."
119+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3AResponseTemplateManager" class="podlinkpod"
120+
>WebService::Hexonet::Connector::ResponseTemplateManager</a> - API Response Template Manager functionality.</a></dt>
112121

113122
<dd>
114-
<p>Function connect Returns a Connection object connected to the API Server (URL, ENTITY, LOGIN, PASSWORD are mandatory to connect the server, ROLE ans USER are optional)</p>
115-
</dd>
123+
<dt><a name="WebService::Hexonet::Connector::SocketConfig_-_API_Communication_Configuration_functionality."
124+
><a href="http://search.cpan.org/perldoc?WebService%3A%3AHexonet%3A%3AConnector%3A%3ASocketConfig" class="podlinkpod"
125+
>WebService::Hexonet::Connector::SocketConfig</a> - API Communication Configuration functionality.</a></dt>
116126
</dl>
117127

118128
<h1><a class='u'
119-
name="AUTHOR"
120-
>AUTHOR</a></h1>
129+
name="LICENSE_AND_COPYRIGHT"
130+
>LICENSE AND COPYRIGHT</a></h1>
121131

122-
<p>Hexonet GmbH</p>
123-
124-
<p><a href="https://www.hexonet.net" class="podlinkurl"
125-
>https://www.hexonet.net</a></p>
132+
<p>This program is licensed under the <a href="https://raw.githubusercontent.com/hexonet/perl-sdk/master/LICENSE" class="podlinkurl"
133+
>MIT License</a>.</p>
126134

127135
<h1><a class='u'
128-
name="LICENSE"
129-
>LICENSE</a></h1>
136+
name="AUTHOR"
137+
>AUTHOR</a></h1>
130138

131-
<p>MIT</p>
139+
<p><a href="https://www.hexonet.net" class="podlinkurl"
140+
>HEXONET GmbH</a></p>
132141

133142
<!-- end doc -->
134143

docs/hexonet.html

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!--
66
generated by Pod::Simple::HTML v3.35,
77
using Pod::Simple::PullParser v3.35,
8-
under Perl v5.026001 at Fri Aug 3 08:07:48 2018 GMT.
8+
under Perl v5.026001 at Wed Dec 12 10:23:28 2018 GMT.
99
1010
If you want to change this HTML document, you probably shouldn't do that
1111
by changing it directly. Instead, see about changing the calling options
@@ -26,6 +26,12 @@ <h1><a class='u'
2626
<p>WebService::Hexonet - Namespace package for modules provided by <a href="https://www.hexonet.net/" class="podlinkurl"
2727
>HEXONET</a>.</p>
2828

29+
<h1><a class='u'
30+
name="VERSION"
31+
>VERSION</a></h1>
32+
33+
<p>This documentation refers to WebService::Hexonet version v1.12.1.</p>
34+
2935
<h1><a class='u'
3036
name="DESCRIPTION"
3137
>DESCRIPTION</a></h1>
@@ -46,19 +52,18 @@ <h1><a class='u'
4652
</dl>
4753

4854
<h1><a class='u'
49-
name="AUTHOR"
50-
>AUTHOR</a></h1>
55+
name="LICENSE_AND_COPYRIGHT"
56+
>LICENSE AND COPYRIGHT</a></h1>
5157

52-
<p>Hexonet GmbH</p>
53-
54-
<p><a href="https://www.hexonet.net" class="podlinkurl"
55-
>https://www.hexonet.net</a></p>
58+
<p>This program is licensed under the <a href="https://raw.githubusercontent.com/hexonet/perl-sdk/master/LICENSE" class="podlinkurl"
59+
>MIT License</a>.</p>
5660

5761
<h1><a class='u'
58-
name="LICENSE"
59-
>LICENSE</a></h1>
62+
name="AUTHOR"
63+
>AUTHOR</a></h1>
6064

61-
<p>MIT</p>
65+
<p><a href="https://www.hexonet.net" class="podlinkurl"
66+
>HEXONET GmbH</a></p>
6267

6368
<!-- end doc -->
6469

docs/response.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!--
66
generated by Pod::Simple::HTML v3.35,
77
using Pod::Simple::PullParser v3.35,
8-
under Perl v5.026001 at Fri Aug 3 08:07:48 2018 GMT.
8+
under Perl v5.026001 at Wed Dec 12 10:23:29 2018 GMT.
99
1010
If you want to change this HTML document, you probably shouldn't do that
1111
by changing it directly. Instead, see about changing the calling options

0 commit comments

Comments
 (0)