File Coverage

blib/lib/Regru/API/User.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Regru::API::User;
2              
3             # ABSTRACT: REG.API v2 user account management
4              
5 1     1   711 use strict;
  1         2  
  1         31  
6 1     1   5 use warnings;
  1         2  
  1         24  
7 1     1   9 use Moo;
  1         2  
  1         7  
8 1     1   3049 use namespace::autoclean;
  1         2  
  1         6  
9              
10             our $VERSION = '0.050'; # VERSION
11             our $AUTHORITY = 'cpan:CHIM'; # AUTHORITY
12              
13             with 'Regru::API::Role::Client';
14              
15             has '+namespace' => (
16             default => sub { 'user' },
17             );
18              
19 1     1   4 sub available_methods {[qw(
20             nop
21             create
22             get_statistics
23             get_balance
24             )]}
25              
26             __PACKAGE__->namespace_methods;
27             __PACKAGE__->meta->make_immutable;
28              
29             1; # End of Regru::API::User
30              
31             __END__
32              
33             =pod
34              
35             =encoding UTF-8
36              
37             =head1 NAME
38              
39             Regru::API::User - REG.API v2 user account management
40              
41             =head1 VERSION
42              
43             version 0.050
44              
45             =head1 DESCRIPTION
46              
47             REG.API account management methods such as create new user, fetch some statistics and deposit funds to an account.
48              
49             =head1 ATTRIBUTES
50              
51             =head2 namespace
52              
53             Always returns the name of category: C<user>. For internal uses only.
54              
55             =head1 REG.API METHODS
56              
57             =head2 nop
58              
59             For testing purposes. Scope: B<everyone>. Typical usage:
60              
61             $resp = $client->user->nop;
62              
63             Returns success response.
64              
65             More info at L<Account management: nop|https://www.reg.com/support/help/api2#user_nop>.
66              
67             =head2 create
68              
69             Creates a new user account. Scope: B<partners>. Typical usage:
70              
71             $resp = $client->user->create(
72             # required fields
73             user_login => 'digory',
74             user_password => 'gof4iSewvy8aK5at',
75             user_email => 'digory.kirke@wardrobe.co.uk',
76             user_country => 'GB',
77              
78             # optional extra fields
79             ...
80              
81             set_me_as_referer => 1,
82             );
83              
84             Answer will contains an C<user_id> field for newly created user account or error otherwise.
85              
86             There are a lot of optional fields related to user account so check the documentation if you wish to use them.
87             More info at L<Account management: create|https://www.reg.com/support/help/api2#user_create>.
88              
89             =head2 get_statistics
90              
91             Fetch usage statistic for current account. Scope: B<clients>. Typical usage:
92              
93             $resp = $client->user->get_statistics(
94             date_from => '2013-01-01',
95             date_till => '2013-06-30',
96             );
97              
98             Parameters C<date_from> and C<date_till> are optional. Answer will contains a set of metrics such as number of active
99             domain names, number of domain names which are subject to renewal, number of folders, etc.
100              
101             More info at L<Account management: get_statistics|https://www.reg.com/support/help/api2#user_get_statistics>.
102              
103             =head2 get_balance
104              
105             Shows a current user account balance. Scope: B<clients>. Typical usage:
106              
107             $resp = $client->user->get_balance(
108             currency => 'EUR',
109             );
110              
111             Answer will contains a set of fields like amount of available funds, amount of a blocked funds. For resellers (partners)
112             will be shown amount of available credit additionally.
113              
114             More info at L<Account management: get_balance|https://www.reg.com/support/help/api2#user_get_balance>.
115              
116             =head1 SEE ALSO
117              
118             L<Regru::API>
119              
120             L<Regru::API::Role::Client>
121              
122             L<REG.API Account management|https://www.reg.com/support/help/api2#user_functions>
123              
124             L<REG.API Common error codes|https://www.reg.com/support/help/api2#common_errors>
125              
126             =head1 BUGS
127              
128             Please report any bugs or feature requests on the bugtracker website
129             L<https://github.com/regru/regru-api-perl/issues>
130              
131             When submitting a bug or request, please include a test-file or a
132             patch to an existing test-file that illustrates the bug or desired
133             feature.
134              
135             =head1 AUTHORS
136              
137             =over 4
138              
139             =item *
140              
141             Polina Shubina <shubina@reg.ru>
142              
143             =item *
144              
145             Anton Gerasimov <a.gerasimov@reg.ru>
146              
147             =back
148              
149             =head1 COPYRIGHT AND LICENSE
150              
151             This software is copyright (c) 2013 by REG.RU LLC.
152              
153             This is free software; you can redistribute it and/or modify it under
154             the same terms as the Perl 5 programming language system itself.
155              
156             =cut