File Coverage

blib/lib/WG/API/WoT.pm
Criterion Covered Total %
statement 9 34 26.4
branch n/a
condition n/a
subroutine 4 29 13.7
pod 25 26 96.1
total 38 89 42.7


line stmt bran cond sub pod time code
1             package WG::API::WoT;
2              
3 2     2   494 use Const::Fast;
  2         1085  
  2         21  
4              
5 2     2   162 use Moo;
  2         4  
  2         16  
6              
7             with 'WG::API::Base';
8              
9             =head1 NAME
10              
11             WG::API::WoT - Module to work with Wargaming.net Public API for World of Tanks
12              
13             =head1 VERSION
14              
15             Version v0.13
16              
17             =cut
18              
19             our $VERSION = 'v0.13';
20              
21             const my $api_uri => '//api.worldoftanks.ru/';
22              
23             sub _api_uri {
24 1     1   4 my ($self) = @_;
25              
26 1         13 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 $wot = WG::API->new( application_id => 'demo' )->wot();
38             ...
39             my $player = $wot->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             - api_uri
54              
55             =head1 METHODS
56              
57             =head2 Account
58              
59             =over 1
60              
61             =item B<account_list( [ %params ] )>
62              
63             Method returns partial list of players. The list is filtered by initial characters of user name and sorted alphabetically
64              
65             =over 2
66              
67             =item I<required fields:>
68              
69             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.
70              
71             =back
72              
73             =cut
74              
75             sub account_list {
76             return shift->_request(
77 0     0 1 0 'get', 'wot/account/list/', [ 'language', 'fields', 'type', 'search', 'limit' ], ['search'],
78             @_
79             );
80             }
81              
82             =item B<account_info( [ %params ] )>
83              
84             Method returns player details.
85              
86             =over 2
87              
88             =item I<required fields:>
89              
90             account_id - Account ID. Max limit is 100. Min value is 1.
91              
92             =back
93              
94             =cut
95              
96             sub account_info {
97             return shift->_request(
98 1     1 1 10705 'get', 'wot/account/info/', [ 'language', 'fields', 'access_token', 'extra', 'account_id' ],
99             ['account_id'], @_
100             );
101             }
102              
103             =item B<account_tanks( [ %params ] )>
104              
105             Method returns details on player's vehicles.
106              
107             =over 2
108              
109             =item I<required fields:>
110              
111             account_id - Account ID. Max limit is 100. Min value is 1.
112              
113             =back
114              
115             =cut
116              
117             sub account_tanks {
118             return shift->_request(
119 0     0 1   'get', 'wot/account/tanks/', [ 'language', 'fields', 'access_token', 'account_id', 'tank_id' ],
120             ['account_id'], @_
121             );
122             }
123              
124             =item B<account_achievements( [ %params ] )>
125              
126             Method returns players' achievement details.
127              
128             Achievement properties define the achievements field values:
129              
130             1-4 for Mastery Badges and Stage Achievements (type: "class");
131             maximum value of Achievement series (type: "series");
132             number of achievements earned from sections: Battle Hero, Epic Achievements, Group Achievements, Special Achievements, etc. (type: "repeatable, single, custom").
133              
134             =over 2
135              
136             =item I<required fields:>
137              
138             account_id - Account ID. Max limit is 100. Min value is 1.
139              
140             =back
141              
142             =cut
143              
144             sub account_achievements {
145 0     0 1   return shift->_request( 'get', 'wot/account/achievements/', [ 'language', 'fields', 'account_id' ], ['account_id'], @_ );
146             }
147              
148             =item B<stronghold_claninfo( [ %params ] )>
149              
150             Method returns general information and the battle statistics of clans in the Stronghold mode. Please note that information about the number of battles fought as well as the number of defeats and victories is updated once every 24 hours.
151              
152             =over 2
153              
154             =item I<required_fields:>
155              
156             clan_id - Clan IDs. Maximum limit: 100
157              
158             =back
159              
160             =cut
161              
162             sub stronghold_claninfo {
163 0     0 1   return shift->_request( 'get', 'wot/stronghold/claninfo/', [ 'clan_id', 'fields', 'language' ], ['clan_id'], @_ );
164             }
165              
166             =item B<stronghold_clanreserves( [ %params ] )>
167              
168             Method returns information about available Reserves and their current status.
169              
170             =over 2
171              
172             =item I<required_fields:>
173              
174             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
175              
176             =back
177              
178             =back
179              
180             =cut
181              
182             sub stronghold_clanreserves {
183 0     0 1   return shift->_request( 'get', 'wot/stronghold/clanreserves/', [ 'access_token', 'fields', 'language' ], ['access_token'], @_ );
184             }
185              
186             =head2 Encyclopedia
187              
188             =over 1
189              
190             =item B<encyclopedia_vehicles( [ %params ] )>
191              
192             Method returns list of available vehicles.
193              
194             =cut
195              
196             sub encyclopedia_vehicles {
197 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/vehicles/', [ 'fields', 'language', 'limit', 'nation', 'page_no', 'tank_id', 'tier', 'type' ], undef, @_ );
198             }
199              
200             =item B<encyclopedia_vehicleprofile( [ %params ] )>
201              
202             =over 2
203              
204             =item I<required fields>
205              
206             tank_id - vehicle id
207              
208             =back
209              
210             =cut
211              
212             sub encyclopedia_vehicleprofile {
213             return shift->_request(
214 0     0 1   'get', 'wot/encyclopedia/vehicleprofile/',
215             [ 'tank_id', 'engine_id', 'fields', 'gun_id', 'language', 'profile_id', 'radio_id', 'suspension_id', 'turret_id' ],
216             ['tank_id'],
217             @_
218             );
219             }
220              
221             =item B<encyclopedia_achievements( [ %params ] )>
222              
223             Method returns information about achievements.
224              
225             =cut
226              
227             sub encyclopedia_achievements {
228 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/achievements/', [ 'fields', 'language' ], undef, @_ );
229             }
230              
231             =item B<encyclopedia_info( [ %params ] )>
232              
233             Method returns information about Tankopedia.
234              
235             =cut
236              
237             sub encyclopedia_info {
238 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/info/', [ 'fields', 'language' ], undef, @_ );
239             }
240              
241             =item B<encyclopedia_arenas( [ %params ] )>
242              
243             Method returns information about maps.
244              
245             =cut
246              
247             sub encyclopedia_arenas {
248 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/arenas/', [ 'fields', 'language' ], undef, @_ );
249             }
250              
251             =item B<encyclopedia_provisions( [ %params ] )>
252              
253             Method returns a list of available equipment and consumables.
254              
255             =cut
256              
257             sub encyclopedia_provisions {
258 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/provisions/', [ 'fields', 'language', 'limit', 'page_no', 'provision_id', 'type' ], undef, @_ );
259             }
260              
261             =item B<encyclopedia_personalmissions( [ %params ] )>
262              
263             Method returns details on Personal Missions on the basis of specified campaign IDs, operation IDs, mission branch and tag IDs.
264              
265             =cut
266              
267             sub encyclopedia_personalmissions {
268 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/personalmissions/', [ 'compaign_id', 'fields', 'language', 'operation_id', 'set_id', 'tag' ], undef, @_ );
269             }
270              
271             =item B<encyclopedia_boosters( [ %params ] )>
272              
273             Method returns information about Personal Reserves.
274              
275             =cut
276              
277             sub encyclopedia_boosters {
278 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/boosters/', [ 'fields', 'language' ], undef, @_ );
279             }
280              
281             =item B<encyclopedia_vehicleprofiles( [ %params ] )>
282              
283             Method returns vehicle configuration characteristics.
284              
285             =over 2
286              
287             =item I<required fields>
288              
289             tank_id - vehicle id.
290              
291             =back
292              
293             =cut
294              
295             sub encyclopedia_vehicleprofiles {
296 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/vehicleprofiles/', [ 'tank_id', 'fields', 'language', 'order_by' ], ['tank_id'], @_ );
297             }
298              
299             =item B<encyclopedia_modules( [ %params ] )>
300              
301             Method returns list of available modules that can be installed on vehicles, such as engines, turrets, etc. At least one input filter parameter (module ID, type) is required to be indicated.
302              
303             =cut
304              
305             sub encyclopedia_modules {
306 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/modules/', [ 'extra', 'fields', 'language', 'limit', 'module_id', 'nation', 'page_no', 'type' ], undef, @_ );
307             }
308              
309             =item B<encyclopedia_badges( [ %params ] )>
310              
311             Method returns list of available badges a player can gain in Ranked Battles.
312              
313             =cut
314              
315             sub encyclopedia_badges {
316 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/badges/', [ 'fields', 'language' ], undef, @_ );
317             }
318              
319             =item B<encyclopedia_crewroles( [ %params ] )>
320              
321             Method returns full description of all crew qualifications.
322              
323             =cut
324              
325             sub encyclopedia_crewroles {
326 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/crewroles/', [ 'fields', 'language', 'role' ], undef, @_ );
327             }
328              
329             =item B<encyclopedia_crewskills( [ %params ] )>
330              
331             Method returns full description of all crew skills.
332              
333             =cut
334              
335             sub encyclopedia_crewskills {
336 0     0 1   return shift->_request( 'get', 'wot/encyclopedia/crewskills/', [ 'fields', 'language', 'role', 'skill' ], undef, @_ );
337             }
338              
339             =back
340              
341             =head2 Clan ratings
342              
343             =over 1
344              
345             =item B<clanratings_types()>
346              
347             Method returns details on ratings types and categories.
348              
349             =cut
350              
351             sub clanratings_types {
352 0     0 1   return shift->_request( 'get', 'wot/clanratings/types/', [], [], @_ );
353             }
354              
355             =item B<calnratings_dates( [ %params ] )>
356              
357             Method returns dates with available rating data.
358              
359             =cut
360              
361             sub clanratings_dates {
362 0     0 0   return shift->_request( 'get', 'wot/clanratings/dates/', ['limit'], undef, @_ );
363             }
364              
365             =item B<clanratings_clans>
366              
367             Method returns clan ratings by specified IDs.
368              
369             =over 2
370              
371             =item I<required_fields:>
372              
373             clan_id - Clan IDs. Maximum limit: 100
374              
375             =back
376              
377             =cut
378              
379             sub clanratings_clans {
380 0     0 1   return shift->_request( 'get', 'wot/clanratings/clans/', [ 'clan_id', 'date', 'fields', 'language' ], ['clan_id'], @_ );
381             }
382              
383             =item B<clanratings_neighbors( [ %params ] )>
384              
385             Method returns list of adjacent positions in specified clan rating
386              
387             =over 2
388              
389             =item I<required_fields:>
390              
391             clan_id - Clan IDs. Maximum limit: 100
392             rank_field - Rating category
393              
394             =back
395              
396             =cut
397              
398             sub clanratings_neighbors {
399 0     0 1   return shift->_request( 'get', 'wot/clanratings/neighbors/', [ 'clan_id', 'rank_field', 'date', 'fields', 'language', 'limit' ], [ 'clan_id', 'rank_field' ], @_ );
400             }
401              
402             =item B<clanratings_top( [ %params ] )>
403              
404             Method returns the list of top clans by specified parameters
405              
406             =over 2
407              
408             =item I<required_fields:>
409              
410             rank_field - Rating category
411              
412             =back
413              
414             =back
415              
416             =cut
417              
418             sub clanratings_top {
419 0     0 1   return shift->_request( 'get', 'wot/clanratings/top/', [ 'rank_field', 'date', 'fields', 'language', 'limit', 'page_no' ], ['rank_field'], @_ );
420             }
421              
422             =head2 Player's vehicles
423              
424             =over 1
425              
426             =item B<tanks_stats( [ %params ] )>
427              
428             Method returns overall statistics, Tank Company statistics, and clan statistics per each vehicle for each user.
429              
430             =over 2
431              
432             =item I<required fields:>
433              
434             account_id - Account ID. Max limit is 100. Min value is 1.
435              
436             =cut
437              
438             sub tanks_stats {
439             return shift->_request(
440 0     0 1   'get', 'wot/tanks/stats/',
441             [ 'language', 'fields', 'access_token', 'account_id', 'tank_id', 'in_garage', 'extra' ],
442             ['account_id'], @_
443             );
444             }
445              
446             =item B<tanks_achievements( [ %params ] )>
447              
448             Method returns list of achievements on all vehicles.
449              
450             Achievement properties define the achievements field values:
451              
452             1-4 for Mastery Badges and Stage Achievements (type: "class");
453             maximum value of Achievement series (type: "series");
454             number of achievements earned from sections: Battle Hero, Epic Achievements, Group Achievements, Special Achievements, etc. (type: "repeatable, single, custom").
455              
456             =over 2
457              
458             =item I<required fields:>
459              
460             account_id - Account ID. Max limit is 100. Min value is 1.
461              
462             =back
463              
464             =back
465              
466             =cut
467              
468             sub tanks_achievements {
469             return shift->_request(
470 0     0 1   'get', 'wot/tanks/achievements/',
471             [ 'language', 'fields', 'access_token', 'account_id', 'tank_id', 'in_garage' ],
472             ['account_id'], @_
473             );
474             }
475              
476             =back
477              
478             =head1 BUGS
479              
480             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.
481              
482             =head1 SUPPORT
483              
484             You can find documentation for this module with the perldoc command.
485              
486             perldoc WG::API
487              
488             You can also look for information at:
489              
490             =over 4
491              
492             =item * RT: Gitlab's request tracker (report bugs here)
493              
494             L<https://gitlab.com/cynovg/WG-API/issues>
495              
496             =item * AnnoCPAN: Annotated CPAN documentation
497              
498             L<http://annocpan.org/dist/WG-API>
499              
500             =item * CPAN Ratings
501              
502             L<http://cpanratings.perl.org/d/WG-API>
503              
504             =item * Search CPAN
505              
506             L<https://metacpan.org/pod/WG::API>
507              
508             =back
509              
510              
511             =head1 ACKNOWLEDGEMENTS
512              
513             ...
514              
515             =head1 SEE ALSO
516              
517             WG API Reference L<https://developers.wargaming.net/>
518              
519             =head1 AUTHOR
520              
521             Cyrill Novgorodcev , C<< <cynovg at cpan.org> >>
522              
523             =head1 LICENSE AND COPYRIGHT
524              
525             Copyright 2015 Cyrill Novgorodcev.
526              
527             This program is free software; you can redistribute it and/or modify it
528             under the terms of the the Artistic License (2.0). You may obtain a
529             copy of the full license at:
530              
531             L<http://www.perlfoundation.org/artistic_license_2_0>
532              
533             Any use, modification, and distribution of the Standard or Modified
534             Versions is governed by this Artistic License. By using, modifying or
535             distributing the Package, you accept this license. Do not use, modify,
536             or distribute the Package, if you do not accept this license.
537              
538             If your Modified Version has been derived from a Modified Version made
539             by someone other than you, you are nevertheless required to ensure that
540             your Modified Version complies with the requirements of this license.
541              
542             This license does not grant you the right to use any trademark, service
543             mark, tradename, or logo of the Copyright Holder.
544              
545             This license includes the non-exclusive, worldwide, free-of-charge
546             patent license to make, have made, use, offer to sell, sell, import and
547             otherwise transfer the Package with respect to any patent claims
548             licensable by the Copyright Holder that are necessarily infringed by the
549             Package. If you institute patent litigation (including a cross-claim or
550             counterclaim) against any party alleging that the Package constitutes
551             direct or contributory patent infringement, then this Artistic License
552             to you shall terminate on the date that such litigation is filed.
553              
554             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
555             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
556             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
557             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
558             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
559             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
560             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
561             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
562              
563              
564             =cut
565              
566             1; # End of WG::API::WoT