File Coverage

blib/lib/Regru/API/Folder.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::Folder;
2              
3             # ABSTRACT: REG.API v2 user folders management
4              
5 1     1   542 use strict;
  1         2  
  1         25  
6 1     1   4 use warnings;
  1         2  
  1         20  
7 1     1   4 use Moo;
  1         1  
  1         7  
8 1     1   2245 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 { 'folder' },
17             );
18              
19 1     1   4 sub available_methods {[qw(
20             nop
21             create
22             remove
23             rename
24             get_services
25             add_services
26             remove_services
27             replace_services
28             move_services
29             )]}
30              
31             __PACKAGE__->namespace_methods;
32             __PACKAGE__->meta->make_immutable;
33              
34             1; # End of Regru::API::Folder
35              
36             __END__
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             Regru::API::Folder - REG.API v2 user folders management
45              
46             =head1 VERSION
47              
48             version 0.050
49              
50             =head1 DESCRIPTION
51              
52             REG.API folders management methods such as create/remove/rename folders, get/put services linked to and others.
53              
54             =head1 ATTRIBUTES
55              
56             =head2 namespace
57              
58             Always returns the name of category: C<folder>. For internal uses only.
59              
60             =head1 REG.API METHODS
61              
62             =head2 nop
63              
64             For testing purposes. Scope: B<everyone>. Typical usage:
65              
66             $resp = $client->folder->nop(
67             folder_name => 'our_folder',
68             );
69              
70             Returns success response.
71              
72             More info at L<Folder management: nop|https://www.reg.com/support/help/api2#folder_nop>.
73              
74             =head2 create
75              
76             Creates a folder. Scope: B<clients>. Typical usage:
77              
78             $resp = $client->folder->create(
79             folder_name => 'vehicles',
80             );
81              
82             Returns success response if folder was created or error otherwise.
83              
84             More info at L<Folder management: create|https://www.reg.com/support/help/api2#folder_create>.
85              
86             =head2 remove
87              
88             Deletes an existing folder. Scope: B<clients>. Typical usage:
89              
90             $resp = $client->folder->remove(
91             folder_id => 674908,
92             );
93              
94             Returns success response if folder was deleted or error otherwise.
95              
96             More info at L<Folder management: remove|https://www.reg.com/support/help/api2#folder_remove>.
97              
98             =head2 rename
99              
100             Renames an existing forder. Scope: B<clients>. Typical usage:
101              
102             $resp = $client->folder->rename(
103             folder_name => 'stuff',
104             new_folder_name => 'items',
105             );
106              
107             Returns success response if folder was renamed or error otherwise.
108              
109             More info at L<Folder management: rename|https://www.reg.com/support/help/api2#folder_rename>.
110              
111             =head2 get_services
112              
113             Gets services linked to folder. Scope: B<clients>. Typical usage:
114              
115             $resp = $client->folder->get_services(
116             folder_id => 389765,
117             );
118              
119             A success answer will contains a C<folder_content> with a list of services (domain names, hosting related items, etc) linked
120             to requested folder.
121              
122             More info at L<Folder management: get_services|https://www.reg.com/support/help/api2#folder_get_services>.
123              
124             =head2 add_services
125              
126             "Puts" services to folder. Scope: B<clients>. Typical usage:
127              
128             $resp = $client->folder->add_services(
129             folder_name => 'vehicles',
130             services => [
131             { domain_name => 'crucible.co.uk' },
132             { domain_name => 'ss-madame-de-pompadour.ru' },
133             ],
134             return_folder_contents => 1,
135             );
136              
137             A successful answer will contains a C<services> field with a list of services that was linked to the specified folder
138             and result for each of them. Additionally might be returned a C<folder_content> field.
139              
140             More info at L<Folder management: add_services|https://www.reg.com/support/help/api2#folder_add_services>.
141              
142             =head2 remove_services
143              
144             "Deletes" services from folder. Scope: B<clients>. Typical usage:
145              
146             $resp = $client->folder->remove_services(
147             folder_name => 'vehicles',
148             services => [
149             { domain_name => 'bow-tie.com' },
150             ],
151             );
152              
153             A successful answer will contains a C<services> field with a list of services that was unlinked to the specified folder
154             and result for each of them. Additionally might be returned a C<folder_content> field.
155              
156             More info at L<Folder management: remove_services|https://www.reg.com/support/help/api2#folder_remove_services>.
157              
158             =head2 replace_services
159              
160             "Replaces" services with a new set of services. Scope: B<clients>. Typical usage:
161              
162             $resp = $client->folder->replace_services(
163             folder_name => 'items',
164             services => [
165             { domain_name => 'bow-tie.com' },
166             { service_id => 188650 },
167             { service_id => 239076 },
168             ],
169             );
170              
171             A successful answer will contains a C<services> field with a list of services that was linked to the specified folder
172             and result for each of them. Additionally might be returned a C<folder_content> field.
173              
174             More info at L<Folder management: replace_services|https://www.reg.com/support/help/api2#folder_replace_services>.
175              
176             =head2 move_services
177              
178             "Transfers" services between folders. Scope: B<clients>. Typical usage:
179              
180             $resp = $client->folder->move_services(
181             folder_name => 'vehicles',
182             new_folder_name => 'items',
183             services => [
184             { domain_name => 'bow-tie.cz' },
185             { domain_name => 'hallucinogenic-lipstick.xxx' },
186             { service_id => 783908 },
187             ],
188             );
189              
190             A successful answer will contains a C<services> field with a list of services that was linked to the specified folder
191             and result for each of them. Additionally might be returned a C<folder_content> field with a contents of a destination folder.
192              
193             More info at L<Folder management: move_services|https://www.reg.com/support/help/api2#folder_move_services>.
194              
195             =head1 SEE ALSO
196              
197             L<Regru::API>
198              
199             L<Regru::API::Role::Client>
200              
201             L<REG.API Folders management|https://www.reg.com/support/help/api2#folder_functions>
202              
203             L<REG.API Common error codes|https://www.reg.com/support/help/api2#common_errors>
204              
205             =head1 BUGS
206              
207             Please report any bugs or feature requests on the bugtracker website
208             L<https://github.com/regru/regru-api-perl/issues>
209              
210             When submitting a bug or request, please include a test-file or a
211             patch to an existing test-file that illustrates the bug or desired
212             feature.
213              
214             =head1 AUTHORS
215              
216             =over 4
217              
218             =item *
219              
220             Polina Shubina <shubina@reg.ru>
221              
222             =item *
223              
224             Anton Gerasimov <a.gerasimov@reg.ru>
225              
226             =back
227              
228             =head1 COPYRIGHT AND LICENSE
229              
230             This software is copyright (c) 2013 by REG.RU LLC.
231              
232             This is free software; you can redistribute it and/or modify it under
233             the same terms as the Perl 5 programming language system itself.
234              
235             =cut