| 1 | package WG::API::WoWp; | ||
| 2 | |||
| 3 | 2 | ▶ | use Const::Fast; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | with 'WG::API::Base'; | |
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | WG::API::WoWp - Module to work with Wargaming.net Public API for World of Warplanes | ||
| 12 | |||
| 13 | =head1 VERSION | ||
| 14 | |||
| 15 | Version v0.11 | ||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | 2 | our $VERSION = 'v0.11'; | |
| 20 | |||
| 21 | 2 | const my $api_uri => '//api.worldofwarplanes.ru/'; | |
| 22 | |||
| 23 | sub _api_uri { | ||
| 24 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
_api_uri: not called CC=1 SCAR=6.9
| |||
| 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 $wowp = WG::API->new( application_id => 'demo' )->wowp(); | ||
| 38 | ... | ||
| 39 | my $player = $wowp->account_info( account_id => '1' ); | ||
| 40 | |||
| 41 | |||
| 42 | =head1 CONSTRUCTOR | ||
| 43 | |||
| 44 | =head2 new | ||
| 45 | |||
| 46 | Create new object with params. Rerquired application id: L<https://developers.wargaming.net/documentation/guide/getting-started/> | ||
| 47 | |||
| 48 | Params: | ||
| 49 | |||
| 50 | - application_id * | ||
| 51 | - languare | ||
| 52 | - api_uri | ||
| 53 | |||
| 54 | =head1 METHODS | ||
| 55 | |||
| 56 | =head2 Accounts | ||
| 57 | |||
| 58 | =over 1 | ||
| 59 | |||
| 60 | =item B<account_list( [ %params ] )> | ||
| 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 account_list { | ||
| 75 | return shift->_request( | ||
| 76 | 0 | ▶ | 'get', 'wowp/account/list/', [ 'language', 'fields', 'type', 'search', 'limit' ], ['search'], |
|
Subroutine
account_list: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 77 | @_ | ||
| 78 | ); | ||
| 79 | } | ||
| 80 | |||
| 81 | =item B<account_info( [ %params ] )> | ||
| 82 | |||
| 83 | Method returns player details. | ||
| 84 | |||
| 85 | =over 2 | ||
| 86 | |||
| 87 | =item I<required fields:> | ||
| 88 | |||
| 89 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 90 | |||
| 91 | =back | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | sub account_info { | ||
| 96 | return shift->_request( | ||
| 97 | 0 | ▶ | 'get', 'wowp/account/info/', [ 'language', 'fields', 'access_token', 'account_id' ], |
|
Subroutine
account_info: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 98 | ['account_id'], @_ | ||
| 99 | ); | ||
| 100 | } | ||
| 101 | |||
| 102 | =item B<account_planes( [ %params ] )> | ||
| 103 | |||
| 104 | Method returns details on player's aircrafts. | ||
| 105 | |||
| 106 | =over 2 | ||
| 107 | |||
| 108 | =item I<required fields:> | ||
| 109 | |||
| 110 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 111 | |||
| 112 | =back | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | sub account_planes { | ||
| 117 | return shift->_request( | ||
| 118 | 0 | ▶ | 'get', 'wowp/account/planes/', [ 'language', 'fields', 'access_token', 'account_id', 'in_garage', 'plane_id' ], |
|
Subroutine
account_planes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 119 | ['account_id'], @_ | ||
| 120 | ); | ||
| 121 | } | ||
| 122 | |||
| 123 | =back | ||
| 124 | |||
| 125 | =head2 Encyclopedia | ||
| 126 | |||
| 127 | =over 1 | ||
| 128 | |||
| 129 | =item B<encyclopedia_planes( [ %params ] )> | ||
| 130 | |||
| 131 | Method returns list of all aircrafts from Encyclopedia | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub encyclopedia_planes { | ||
| 136 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/planes/', [ 'fields', 'language', 'nation', 'type' ], undef, @_ ); |
|
Subroutine
encyclopedia_planes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 137 | } | ||
| 138 | |||
| 139 | =item B<encyclopedia_planeinfo( [ %params ] )> | ||
| 140 | |||
| 141 | Method returns aircraft details from Encyclopedia. | ||
| 142 | |||
| 143 | =over 2 | ||
| 144 | |||
| 145 | =item I<required fields> | ||
| 146 | |||
| 147 | plane_id - aircraft id | ||
| 148 | |||
| 149 | =back | ||
| 150 | |||
| 151 | =cut | ||
| 152 | |||
| 153 | sub encyclopedia_planeinfo { | ||
| 154 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/planeinfo/', [ 'plane_id', 'fields', 'language' ], ['plane_id'], @_ ); |
|
Subroutine
encyclopedia_planeinfo: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 155 | } | ||
| 156 | |||
| 157 | =item B<encyclopedia_planemodules( [ %params ] )> | ||
| 158 | |||
| 159 | Method returns information from Encyclopedia about modules available for specified aircrafts. | ||
| 160 | |||
| 161 | =over 2 | ||
| 162 | |||
| 163 | =item I<required fields> | ||
| 164 | |||
| 165 | plane_id - aircraft id | ||
| 166 | |||
| 167 | =back | ||
| 168 | |||
| 169 | =cut | ||
| 170 | |||
| 171 | sub encyclopedia_planemodules { | ||
| 172 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/planemodules/', [ 'plane_id', 'fields', 'language', 'type' ], ['plane_id'], @_ ); |
|
Subroutine
encyclopedia_planemodules: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 173 | } | ||
| 174 | |||
| 175 | =item B<encyclopedia_planeupgrades( [ %params ] )> | ||
| 176 | |||
| 177 | Method returns information from Encyclopedia about slots of aircrafts and lists of modules which are compatible with specified slots. | ||
| 178 | |||
| 179 | =over 2 | ||
| 180 | |||
| 181 | =item I<required fields> | ||
| 182 | |||
| 183 | plane_id - aircraft id | ||
| 184 | |||
| 185 | =back | ||
| 186 | |||
| 187 | =cut | ||
| 188 | |||
| 189 | sub encyclopedia_planeupgrades { | ||
| 190 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/planeupgrades/', [ 'plane_id', 'fields', 'language' ], ['plane_id'], @_ ); |
|
Subroutine
encyclopedia_planeupgrades: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 191 | } | ||
| 192 | |||
| 193 | =item B<encyclopedia_planespecification( [ %params ] )> | ||
| 194 | |||
| 195 | =over 2 | ||
| 196 | |||
| 197 | =item I<required fields> | ||
| 198 | |||
| 199 | plane_id - aircraft id | ||
| 200 | |||
| 201 | =back | ||
| 202 | |||
| 203 | =cut | ||
| 204 | |||
| 205 | sub encyclopedia_planespecification { | ||
| 206 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/planespecification/', [ 'plane_id', 'bind_id', 'fields', 'language', 'module_id' ], ['plane_id'], @_ ); |
|
Subroutine
encyclopedia_planespecification: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 207 | } | ||
| 208 | |||
| 209 | =item B<encyclopedia_achievements( [ %params ] )> | ||
| 210 | |||
| 211 | Method returns dictionary of achievements from Encyclopedia. | ||
| 212 | |||
| 213 | =cut | ||
| 214 | |||
| 215 | sub encyclopedia_achievements { | ||
| 216 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/achievements/', [ 'fields', 'language' ], undef, @_ ); |
|
Subroutine
encyclopedia_achievements: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 217 | } | ||
| 218 | |||
| 219 | =item B<encyclopedia_info( [ %params ] )> | ||
| 220 | |||
| 221 | Method returns information about Encyclopedia. | ||
| 222 | |||
| 223 | =cut | ||
| 224 | |||
| 225 | sub encyclopedia_info { | ||
| 226 | 0 | ▶ | return shift->_request( 'get', 'wowp/encyclopedia/info/', undef, undef, @_ ); |
|
Subroutine
encyclopedia_info: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 227 | } | ||
| 228 | |||
| 229 | =back | ||
| 230 | |||
| 231 | =head2 Ratings | ||
| 232 | |||
| 233 | =over 1 | ||
| 234 | |||
| 235 | =item B<ratings_types( [ %params ] )> | ||
| 236 | |||
| 237 | Method returns dictionary of rating periods and ratings details. | ||
| 238 | |||
| 239 | =cut | ||
| 240 | |||
| 241 | sub ratings_types { | ||
| 242 | 0 | ▶ | return shift->_request( 'get', 'wowp/ratings/types/', [ 'language', 'fields' ], undef, @_ ); |
|
Subroutine
ratings_types: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 243 | } | ||
| 244 | |||
| 245 | =item B<ratings_accounts( [ %params ] )> | ||
| 246 | |||
| 247 | Method returns player ratings by specified IDs. | ||
| 248 | |||
| 249 | =over 2 | ||
| 250 | |||
| 251 | =item I<required fields:> | ||
| 252 | |||
| 253 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 254 | type - Rating period. For valid values, check the Types of ratings method. | ||
| 255 | |||
| 256 | =back | ||
| 257 | |||
| 258 | =cut | ||
| 259 | |||
| 260 | sub ratings_accounts { | ||
| 261 | return shift->_request( | ||
| 262 | 0 | ▶ | 'get', 'wowp/ratings/accounts/', |
|
Subroutine
ratings_accounts: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 263 | [ 'language', 'fields', 'type', 'date', 'account_id' ], | ||
| 264 | [ 'type', 'account_id' ], @_ | ||
| 265 | ); | ||
| 266 | } | ||
| 267 | |||
| 268 | =item B<ratings_neighbors( [ %params ] )> | ||
| 269 | |||
| 270 | Method returns list of adjacent positions in specified rating. | ||
| 271 | |||
| 272 | =over 2 | ||
| 273 | |||
| 274 | =item I<required fields:> | ||
| 275 | |||
| 276 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 277 | type - Rating period. For valid values, check the Types of ratings method. | ||
| 278 | rank_field - Rating category. | ||
| 279 | |||
| 280 | =back | ||
| 281 | |||
| 282 | =cut | ||
| 283 | |||
| 284 | sub ratings_neighbors { | ||
| 285 | return shift->_request( | ||
| 286 | 0 | ▶ | 'get', 'wowp/ratings/neighbors/', |
|
Subroutine
ratings_neighbors: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 287 | [ 'language', 'fields', 'type', 'date', 'account_id', 'rank_field', 'limit' ], | ||
| 288 | [ 'type', 'account_id', 'rank_field' ], @_ | ||
| 289 | ); | ||
| 290 | } | ||
| 291 | |||
| 292 | =item B<ratings_top( [ %params ] )> | ||
| 293 | |||
| 294 | Method returns the list of top players by specified parameter. | ||
| 295 | |||
| 296 | =over 2 | ||
| 297 | |||
| 298 | =item I<required fields:> | ||
| 299 | |||
| 300 | type - Rating period. For valid values, check the Types of ratings method. | ||
| 301 | rank_field - Rating category. | ||
| 302 | |||
| 303 | =back | ||
| 304 | |||
| 305 | =cut | ||
| 306 | |||
| 307 | sub ratings_top { | ||
| 308 | return shift->_request( | ||
| 309 | 0 | ▶ | 'get', 'wowp/ratings/top/', |
|
Subroutine
ratings_top: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 310 | [ 'language', 'fields', 'type', 'date', 'rank_field', 'limit', 'page_no' ], | ||
| 311 | [ 'type', 'rank_field' ], @_ | ||
| 312 | ); | ||
| 313 | } | ||
| 314 | |||
| 315 | =item B<ratings_dates( [ %params ] )> | ||
| 316 | |||
| 317 | Method returns dates with available rating data. | ||
| 318 | |||
| 319 | =over 2 | ||
| 320 | |||
| 321 | =item I<required fields:> | ||
| 322 | |||
| 323 | type - Rating period. For valid values, check the Types of ratings method. | ||
| 324 | |||
| 325 | =back | ||
| 326 | |||
| 327 | =cut | ||
| 328 | |||
| 329 | sub ratings_dates { | ||
| 330 | 0 | ▶ | return shift->_request( 'get', 'wowp/ratings/dates/', [ 'language', 'fields', 'type', 'account_id' ], ['type'], @_ ); |
|
Subroutine
ratings_dates: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 331 | } | ||
| 332 | |||
| 333 | =back | ||
| 334 | |||
| 335 | =head2 Aircraft | ||
| 336 | |||
| 337 | =over 1 | ||
| 338 | |||
| 339 | =item B<planes_stats( [ %params ] )> | ||
| 340 | |||
| 341 | Method returns statistics on player's aircraft. | ||
| 342 | |||
| 343 | =over 2 | ||
| 344 | |||
| 345 | =item I<required fields:> | ||
| 346 | |||
| 347 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 348 | |||
| 349 | =back | ||
| 350 | |||
| 351 | =cut | ||
| 352 | |||
| 353 | sub planes_stats { | ||
| 354 | 0 | ▶ | return shift->_request( 'get', 'wowp/planes/stats/', [ 'account_id', 'access_token', 'fields', 'in_garage', 'language', 'plane_id' ], ['account_id'], @_ ); |
|
Subroutine
planes_stats: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 355 | } | ||
| 356 | |||
| 357 | =item B<planes_achievements( [ %params ] )> | ||
| 358 | |||
| 359 | Method returns achievements on player's aircraft. | ||
| 360 | |||
| 361 | =over 2 | ||
| 362 | |||
| 363 | =item I<requires_fields:> | ||
| 364 | |||
| 365 | account_id - Account ID. Max limit is 100. Min value is 1. | ||
| 366 | |||
| 367 | =back | ||
| 368 | |||
| 369 | =cut | ||
| 370 | |||
| 371 | sub planes_achievements { | ||
| 372 | 0 | ▶ | return shift->_request( 'get', 'wowp/planes/achievements/', [ 'account_id', 'fields', 'language', 'plane_id' ], ['account_id'], @_ ); |
|
Subroutine
planes_achievements: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 373 | } | ||
| 374 | |||
| 375 | =back | ||
| 376 | |||
| 377 | =head1 BUGS | ||
| 378 | |||
| 379 | 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. | ||
| 380 | |||
| 381 | =head1 SUPPORT | ||
| 382 | |||
| 383 | You can find documentation for this module with the perldoc command. | ||
| 384 | |||
| 385 | perldoc WG::API | ||
| 386 | |||
| 387 | You can also look for information at: | ||
| 388 | |||
| 389 | =over 4 | ||
| 390 | |||
| 391 | =item * RT: Gitlab's request tracker (report bugs here) | ||
| 392 | |||
| 393 | L<https://gitlab.com/cynovg/WG-API/issues> | ||
| 394 | |||
| 395 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 396 | |||
| 397 | L<http://annocpan.org/dist/WG-API> | ||
| 398 | |||
| 399 | =item * CPAN Ratings | ||
| 400 | |||
| 401 | L<http://cpanratings.perl.org/d/WG-API> | ||
| 402 | |||
| 403 | =item * Search CPAN | ||
| 404 | |||
| 405 | L<https://metacpan.org/pod/WG::API> | ||
| 406 | |||
| 407 | =back | ||
| 408 | |||
| 409 | |||
| 410 | =head1 ACKNOWLEDGEMENTS | ||
| 411 | |||
| 412 | ... | ||
| 413 | |||
| 414 | =head1 SEE ALSO | ||
| 415 | |||
| 416 | WG API Reference L<https://developers.wargaming.net/> | ||
| 417 | |||
| 418 | =head1 AUTHOR | ||
| 419 | |||
| 420 | Cyrill Novgorodcev , C<< <cynovg at cpan.org> >> | ||
| 421 | |||
| 422 | =head1 LICENSE AND COPYRIGHT | ||
| 423 | |||
| 424 | Copyright 2015 Cyrill Novgorodcev. | ||
| 425 | |||
| 426 | This program is free software; you can redistribute it and/or modify it | ||
| 427 | under the terms of the the Artistic License (2.0). You may obtain a | ||
| 428 | copy of the full license at: | ||
| 429 | |||
| 430 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 431 | |||
| 432 | Any use, modification, and distribution of the Standard or Modified | ||
| 433 | Versions is governed by this Artistic License. By using, modifying or | ||
| 434 | distributing the Package, you accept this license. Do not use, modify, | ||
| 435 | or distribute the Package, if you do not accept this license. | ||
| 436 | |||
| 437 | If your Modified Version has been derived from a Modified Version made | ||
| 438 | by someone other than you, you are nevertheless required to ensure that | ||
| 439 | your Modified Version complies with the requirements of this license. | ||
| 440 | |||
| 441 | This license does not grant you the right to use any trademark, service | ||
| 442 | mark, tradename, or logo of the Copyright Holder. | ||
| 443 | |||
| 444 | This license includes the non-exclusive, worldwide, free-of-charge | ||
| 445 | patent license to make, have made, use, offer to sell, sell, import and | ||
| 446 | otherwise transfer the Package with respect to any patent claims | ||
| 447 | licensable by the Copyright Holder that are necessarily infringed by the | ||
| 448 | Package. If you institute patent litigation (including a cross-claim or | ||
| 449 | counterclaim) against any party alleging that the Package constitutes | ||
| 450 | direct or contributory patent infringement, then this Artistic License | ||
| 451 | to you shall terminate on the date that such litigation is filed. | ||
| 452 | |||
| 453 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||
| 454 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||
| 455 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
| 456 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||
| 457 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||
| 458 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||
| 459 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||
| 460 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 461 | |||
| 462 | |||
| 463 | =cut | ||
| 464 | |||
| 465 | 2 | 1; # End of WG::API::WoWp | |
| 466 | |||