File Coverage

blib/lib/WG/API/NET.pm
Criterion Covered Total %
statement 9 20 45.0
branch n/a
condition n/a
subroutine 3 13 23.0
pod 9 9 100.0
total 21 42 50.0


line stmt bran cond sub pod time code
1             package WG::API::NET;
2              
3 2     2   767 use Const::Fast;
  2         1767  
  2         10  
4 2     2   119 use Carp qw/cluck/;
  2         4  
  2         63  
5 2     2   10 use Moo;
  2         2  
  2         12  
6              
7             with 'WG::API::Base';
8              
9             =head1 NAME
10              
11             WG::API::NET - Module to work with Wargaming.net Public API
12              
13             =head1 VERSION
14              
15             Version v0.12
16              
17             =cut
18              
19             our $VERSION = 'v0.12';
20              
21             const my $api_uri => '//api.worldoftanks.ru/';
22              
23             sub _api_uri {
24 0     0     my ($self) = @_;
25              
26 0           return $api_uri;
27             }
28              
29             =head1 SYNOPSIS
30              
31             Wargaming.net Public API is a set of API methods that provide access to Wargaming.net content, including in-game and game-related content, as well as player statistics.
32              
33             This module provide access to WG Public API
34              
35             use WG::API;
36              
37             my $net = WG::API->new( application_id => 'demo' )->net();
38             ...
39             my $player = $net->account_info( account_id => '1' );
40              
41              
42              
43             =head1 CONSTRUCTOR
44              
45             =head2 new
46              
47             Create new object with params. Rerquired application id: L<https://developers.wargaming.net/documentation/guide/getting-started/>
48              
49             Params:
50              
51             - application_id *
52             - languare
53              
54             =head1 METHODS
55              
56             =head2 Accounts
57              
58             =over 1
59              
60             =item B<accounts_list>
61              
62             Method returns partial list of players. The list is filtered by initial characters of user name and sorted alphabetically.
63              
64             =over 2
65              
66             =item I<required fields:>
67              
68             search - Player name search string. Parameter "type" defines minimum length and type of search. Using the exact search type, you can enter several names, separated with commas. Maximum length: 24.
69              
70             =back
71              
72             =cut
73              
74             sub accounts_list {
75 0     0 1   return shift->_request( 'get', 'wgn/account/list/', [ 'fields', 'game', 'type', 'search', 'limit', 'language' ], ['search'], @_ );
76             }
77              
78             =item B<account_info>
79              
80             Method returns Wargaming account details.
81              
82             =over 2
83              
84             =item I<required fields:>
85              
86             account_id - Account ID. Max limit is 100. Min value is 1.
87              
88             =back
89              
90             =back
91              
92             =cut
93              
94             sub account_info {
95             return shift->_request(
96 0     0 1   'get', 'wgn/account/info/', [ 'fields', 'access_token', 'account_id', 'language' ], ['account_id'],
97             @_
98             );
99             }
100              
101             =head2 Clans
102              
103             =over 1
104              
105             =item B<clans>
106              
107             Method searches through clans and sorts them in a specified order.
108              
109             =cut
110              
111             sub clans {
112             return shift->_request(
113 0     0 1   'get', 'wgn/clans/list/',
114             [ 'language', 'fields', 'search', 'limit', 'page_no', 'game' ],
115             undef, @_
116             );
117             }
118              
119             =item B<clans_info>
120              
121             Method returns detailed clan information.
122              
123             =over 2
124              
125             =item I<required fields:>
126              
127             clan_id - Clan ID. Max limit is 100.
128              
129             =back
130              
131             =cut
132              
133             sub clans_info {
134 0     0 1   return shift->_request( 'get', 'wgn/clans/info/', [ 'language', 'fields', 'access_token', 'clan_id', 'extra', 'game', 'members_key' ], ['clan_id'], @_ );
135             }
136              
137             =item B<clans_membersinfo>
138              
139             Method returns clan member info and short info on the clan. Information is available for World of Tanks and World of Warplanes clans.
140              
141             =over 2
142              
143             =item I<required fields:>
144              
145             account_id - Account ID. Max limit is 100. Min value is 1.
146              
147             =back
148              
149             =cut
150              
151             sub clans_membersinfo {
152 0     0 1   return shift->_request( 'get', 'wgn/clans/membersinfo/', [ 'language', 'fields', 'account_id', 'game' ], ['account_id'], @_ );
153             }
154              
155             =item B<clans_glossary>
156              
157             Method returns information on clan entities in World of Tanks and World of Warplanes.
158              
159             =cut
160              
161             sub clans_glossary {
162 0     0 1   return shift->_request( 'get', 'wgn/clans/glossary/', [ 'language', 'fields', 'game' ], undef, @_ );
163             }
164              
165             =item B<clans_messageboard>
166              
167             Method returns messages of clan message board.
168              
169             =over 2
170              
171             =item I<required fields:>
172              
173             access_token - Access token for the private data of a user's account; can be received via the authorization method; valid within a stated time period
174              
175             =back
176              
177             =cut
178              
179             sub clans_messageboard {
180             return shift->_request(
181 0     0 1   'get', 'wgn/clans/mesageboard/', [ 'game', 'fields', 'access_token' ], ['access_token'],
182             @_
183             );
184             }
185              
186             =item B<clans_memberhistory>
187              
188             Method returns information about player's clan history. Data on 10 last clan memberships are presented in the response.
189              
190             =over 2
191              
192             =item I<required fields:>
193              
194             account_id - Account ID. Max limit is 100. Min value is 1.
195              
196             =back
197              
198             =back
199              
200             =cut
201              
202             sub clans_memberhistory {
203             return shift->_request(
204 0     0 1   'get', 'wgn/clans/memberhistory/', [ 'game', 'fields', 'account_id', 'language' ], ['account_id'],
205             @_
206             );
207             }
208              
209             =head2 Servers
210              
211             =over 1
212              
213             =item B<servers_info>
214              
215             Method returns the number of online players on the servers.
216              
217             =back
218              
219             =cut
220              
221             sub servers_info {
222 0     0 1   return shift->_request( 'get', 'wgn/servers/info/', [ 'language', 'fields', 'game' ], undef, @_ );
223             }
224              
225             =head1 BUGS
226              
227             Please report any bugs or feature requests to C<cynovg at cpan.org>, or through the web interface at L<https://gitlab.com/cynovg/WG-API/issues>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
228              
229             =head1 SUPPORT
230              
231             You can find documentation for this module with the perldoc command.
232              
233             perldoc WG::API
234              
235             You can also look for information at:
236              
237             =over 4
238              
239             =item * RT: Gitlab's request tracker (report bugs here)
240              
241             L<https://gitlab.com/cynovg/WG-API/issues>
242              
243             =item * AnnoCPAN: Annotated CPAN documentation
244              
245             L<http://annocpan.org/dist/WG-API>
246              
247             =item * CPAN Ratings
248              
249             L<http://cpanratings.perl.org/d/WG-API>
250              
251             =item * Search CPAN
252              
253             L<https://metacpan.org/pod/WG::API>
254              
255             =back
256              
257              
258             =head1 ACKNOWLEDGEMENTS
259              
260             ...
261              
262             =head1 SEE ALSO
263              
264             WG API Reference L<https://developers.wargaming.net/>
265              
266             =head1 AUTHOR
267              
268             Cyrill Novgorodcev , C<< <cynovg at cpan.org> >>
269              
270             =head1 LICENSE AND COPYRIGHT
271              
272             Copyright 2015 Cyrill Novgorodcev.
273              
274             This program is free software; you can redistribute it and/or modify it
275             under the terms of the the Artistic License (2.0). You may obtain a
276             copy of the full license at:
277              
278             L<http://www.perlfoundation.org/artistic_license_2_0>
279              
280             Any use, modification, and distribution of the Standard or Modified
281             Versions is governed by this Artistic License. By using, modifying or
282             distributing the Package, you accept this license. Do not use, modify,
283             or distribute the Package, if you do not accept this license.
284              
285             If your Modified Version has been derived from a Modified Version made
286             by someone other than you, you are nevertheless required to ensure that
287             your Modified Version complies with the requirements of this license.
288              
289             This license does not grant you the right to use any trademark, service
290             mark, tradename, or logo of the Copyright Holder.
291              
292             This license includes the non-exclusive, worldwide, free-of-charge
293             patent license to make, have made, use, offer to sell, sell, import and
294             otherwise transfer the Package with respect to any patent claims
295             licensable by the Copyright Holder that are necessarily infringed by the
296             Package. If you institute patent litigation (including a cross-claim or
297             counterclaim) against any party alleging that the Package constitutes
298             direct or contributory patent infringement, then this Artistic License
299             to you shall terminate on the date that such litigation is filed.
300              
301             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
302             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
303             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
304             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
305             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
306             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
307             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
308             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
309              
310              
311             =cut
312              
313             1; # End of WG::API::NET
314