blib/lib/WG/API/Auth.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 100% 3 / 3 totaltotal 58.8% 20 / 34 CC 2 SCAR 8.9
CC
2
Cov
57%
login
6.0
prolongate
2.0
logout
2.0
CRAP 2.4
« blib/lib/WG/API/WoT/Clans.pm ↑ Summary _build/lib/MyBuilder.pm »
1 package WG::API::Auth;
2  
3 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base qw/WG::API/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 =head1 NAME
9  
10 WG::API::Auth - Auth-module with using OpenID for work with WG PAPI
11  
12 =head1 VERSION
13  
14 Version v0.05
15  
16 =cut
17  
18 1 our $VERSION = 'v0.05';
19  
20 =head1 SYNOPSIS
21  
22 This module implements the possibility of authorization, prolongate and logout from the center of development.
23  
24 use WG::API::Auth;
25  
26 my $response = WG::API::Auth->new({ application_id => 'demo' })->login({ nofollow => '1', redirect_uri => 'yoursite.com/response' } );
27
28 my $redirect_uri = $response->{ 'location' };
29 ...
30  
31 =head1 METHODS
32  
33 =head2 AUTH
34  
35 =head3 login
36  
37 Method authenticates user based on Wargaming.net ID (OpenID) which is used in World of Tanks, World of Tanks Blitz, World of Warplanes, and WarGag.ru. To log in, player must enter email and password used for creating account, or use a social network profile. Authentication is not available for iOS Game Center users in the following cases: the account is not linked to a social network account, or email and password are not specified in the profile.
38  
39 Information on authorization status is sent to URL specified in redirect_uri parameter.
40  
41 =cut
42  
43 sub login {
44 0 ▶ $_[0]->_request( 'post', 'auth/login', ['expires_at', 'redirect_uri', 'display', 'nofollow'], undef, $_[1] );
Subroutine login: not called CC=2 SCAR=17.9
Pod documented
45  
46 0 ▶ return $_[0]->status eq 'ok' ? $_[0]->response : undef;
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->status eq 'ok' ? : 0 0 0
47 }
48  
49 =head3 prolongate
50  
51 Method generates new access_token based on the current token.
52  
53 This method is used when the player is still using the application but the current access_token is about to expire.
54  
55 =cut
56  
57 0 ▶sub prolongate { $_[0]->_request( 'post', 'auth/prolongate', ['access_token', 'expires_at'], ['access_token'], $_[1] ) }
Subroutine prolongate: not called CC=1 SCAR=6.9
Pod documented
58  
59 =head3 logout
60  
61 Method deletes user's access_token.
62  
63 After this method is called, access_token becomes invalid.
64  
65 =cut
66  
67 0 ▶sub logout { $_[0]->_request( 'post', 'auth/logout', ['access_token'], ['access_token'], $_[1] ) }
Subroutine logout: not called CC=1 SCAR=6.9
Pod documented
68  
69 sub _init {
70 0 ▶ my $self = shift;
Subroutine _init: not called CC=1 SCAR=6.9
71  
72 0 $self->{ 'api_uri' } = 'api.worldoftanks.ru/wot';
73 0 $self->SUPER::_init();
74  
75 0 return $self;
76 }
77  
78 =head1 BUGS
79  
80 Please report any bugs or feature requests to C<cynovg at cpan.org>, or through the web interface at L<https://github.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.
81  
82 =head1 SUPPORT
83  
84 You can find documentation for this module with the perldoc command.
85  
86 perldoc WG::API
87  
88 You can also look for information at:
89  
90 =over 4
91  
92 =item * RT: GitHub's request tracker (report bugs here)
93  
94 L<https://github.com/cynovg/WG-API/issues>
95  
96 =item * AnnoCPAN: Annotated CPAN documentation
97  
98 L<http://annocpan.org/dist/WG-API>
99  
100 =item * CPAN Ratings
101  
102 L<http://cpanratings.perl.org/d/WG-API>
103  
104 =item * Search CPAN
105  
106 L<http://search.cpan.org/dist/WG-API/>
107  
108 =back
109  
110  
111 =head1 ACKNOWLEDGEMENTS
112  
113 ...
114  
115 =head1 SEE ALSO
116  
117 WG API Reference L<http://ru.wargaming.net/developers/>
118  
119 =head1 AUTHOR
120  
121 cynovg , C<< <cynovg at cpan.org> >>
122  
123 =head1 LICENSE AND COPYRIGHT
124  
125 Copyright 2015 Cyrill Novgorodcev.
126  
127 This program is free software; you can redistribute it and/or modify it
128 under the terms of the the Artistic License (2.0). You may obtain a
129 copy of the full license at:
130  
131 L<http://www.perlfoundation.org/artistic_license_2_0>
132  
133 Any use, modification, and distribution of the Standard or Modified
134 Versions is governed by this Artistic License. By using, modifying or
135 distributing the Package, you accept this license. Do not use, modify,
136 or distribute the Package, if you do not accept this license.
137  
138 If your Modified Version has been derived from a Modified Version made
139 by someone other than you, you are nevertheless required to ensure that
140 your Modified Version complies with the requirements of this license.
141  
142 This license does not grant you the right to use any trademark, service
143 mark, tradename, or logo of the Copyright Holder.
144  
145 This license includes the non-exclusive, worldwide, free-of-charge
146 patent license to make, have made, use, offer to sell, sell, import and
147 otherwise transfer the Package with respect to any patent claims
148 licensable by the Copyright Holder that are necessarily infringed by the
149 Package. If you institute patent litigation (including a cross-claim or
150 counterclaim) against any party alleging that the Package constitutes
151 direct or contributory patent infringement, then this Artistic License
152 to you shall terminate on the date that such litigation is filed.
153  
154 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
155 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
156 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
157 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
158 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
159 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
160 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
161 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
162  
163  
164 =cut
165  
166 1 1; # End of WG::API::Auth
« blib/lib/WG/API/WoT/Clans.pm ↑ Summary _build/lib/MyBuilder.pm »