blib/lib/WG/API/Auth.pm

filter: Statementstmt 66.6% 10 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 100% 3 / 3 totaltotal 62.5% 15 / 24 SCAR 0.4
CC
1
Cov
67%
_api_uri
2.0
login
2.0
prolongate
2.0
CRAP 1.0
« blib/lib/WG/API/NET.pm ↑ Summary Build »
1 package WG::API::Auth;
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::Auth - Auth-module with using OpenID for work with WG PAPI
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.worldoftanks.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 This module implements the possibility of authorization, prolongate and logout from the center of development.
32  
33 use WG::API;
34  
35 my $response = WG::API->new( application_id => 'demo' )->auth()->login( nofollow => '1', redirect_uri => 'yoursite.com/response' );
36  
37 my $redirect_uri = $response->{ 'location' };
38 ...
39  
40 =head1 METHODS
41  
42 =over 1
43  
44 =item B<login>
45  
46 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.
47  
48 Information on authorization status is sent to URL specified in redirect_uri parameter.
49  
50 =back
51  
52 =cut
53  
54 sub login {
55 0 ▶ return shift->_request( 'get', 'wot/auth/login/', [ 'expires_at', 'redirect_uri', 'display', 'nofollow' ], undef, @_ );
Subroutine login: not called CC=1 SCAR=6.9
Pod documented
56 }
57  
58 =over 1
59  
60 =item B<prolongate>
61  
62 Method generates new access_token based on the current token.
63  
64 This method is used when the player is still using the application but the current access_token is about to expire.
65  
66 =over 2
67  
68 =item I<required fields:>
69  
70 access_token - Access token for the private data of a user's account
71 can be received via the authorization method
72 valid within a stated time period
73  
74 =back
75  
76 =back
77  
78 =cut
79  
80 sub prolongate {
81 0 ▶ return shift->_request( 'post', 'wot/auth/prolongate/', [ 'access_token', 'expires_at' ], ['access_token'], @_ );
Subroutine prolongate: not called CC=1 SCAR=6.9
Pod documented
82 }
83  
84 =over 1
85  
86 =item B<logout>
87  
88 Method deletes user's access_token.
89  
90 After this method is called, access_token becomes invalid.
91  
92 =over 2
93  
94 =item I<required fields:>
95  
96 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
97  
98 =back
99  
100 =back
101  
102 =cut
103  
104 sub logout {
105 0 ▶ return shift->_request( 'post', 'wot/auth/logout/', ['access_token'], ['access_token'], @_ );
Subroutine logout: not called CC=1 SCAR=6.9
Pod documented
106 }
107  
108 =head1 BUGS
109  
110 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.
111  
112 =head1 SUPPORT
113  
114 You can find documentation for this module with the perldoc command.
115  
116 perldoc WG::API
117  
118 You can also look for information at:
119  
120 =over 4
121  
122 =item * RT: Gitlab's request tracker (report bugs here)
123  
124 L<https://gitlab.com/cynovg/WG-API/issues>
125  
126 =item * AnnoCPAN: Annotated CPAN documentation
127  
128 L<http://annocpan.org/dist/WG-API>
129  
130 =item * CPAN Ratings
131  
132 L<http://cpanratings.perl.org/d/WG-API>
133  
134 =item * Search CPAN
135  
136 L<https://metacpan.org/pod/WG::API>
137  
138 =back
139  
140  
141 =head1 ACKNOWLEDGEMENTS
142  
143 ...
144  
145 =head1 SEE ALSO
146  
147 WG API Reference L<https://developers.wargaming.net/>
148  
149 =head1 AUTHOR
150  
151 Cyrill Novgorodcev , C<< <cynovg at cpan.org> >>
152  
153 =head1 LICENSE AND COPYRIGHT
154  
155 Copyright 2015 Cyrill Novgorodcev.
156  
157 This program is free software; you can redistribute it and/or modify it
158 under the terms of the the Artistic License (2.0). You may obtain a
159 copy of the full license at:
160  
161 L<http://www.perlfoundation.org/artistic_license_2_0>
162  
163 Any use, modification, and distribution of the Standard or Modified
164 Versions is governed by this Artistic License. By using, modifying or
165 distributing the Package, you accept this license. Do not use, modify,
166 or distribute the Package, if you do not accept this license.
167  
168 If your Modified Version has been derived from a Modified Version made
169 by someone other than you, you are nevertheless required to ensure that
170 your Modified Version complies with the requirements of this license.
171  
172 This license does not grant you the right to use any trademark, service
173 mark, tradename, or logo of the Copyright Holder.
174  
175 This license includes the non-exclusive, worldwide, free-of-charge
176 patent license to make, have made, use, offer to sell, sell, import and
177 otherwise transfer the Package with respect to any patent claims
178 licensable by the Copyright Holder that are necessarily infringed by the
179 Package. If you institute patent litigation (including a cross-claim or
180 counterclaim) against any party alleging that the Package constitutes
181 direct or contributory patent infringement, then this Artistic License
182 to you shall terminate on the date that such litigation is filed.
183  
184 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
185 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
186 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
187 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
188 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
189 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
190 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
191 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
192  
193  
194 =cut
195  
196 2 1; # End of WG::API::Auth
« blib/lib/WG/API/NET.pm ↑ Summary Build »