File Coverage

blib/lib/Regru/API/Domain.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::Domain;
2              
3             # ABSTRACT: REG.API v2 domain names management
4              
5 1     1   685 use strict;
  1         3  
  1         30  
6 1     1   5 use warnings;
  1         4  
  1         24  
7 1     1   5 use Moo;
  1         2  
  1         6  
8 1     1   2750 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 { 'domain' },
17             );
18              
19 1     1   6 sub available_methods {[qw(
20             nop
21             get_prices
22             get_suggest
23             get_premium
24             get_deleted
25             check
26             create
27             transfer
28             get_rereg_data
29             set_rereg_bids
30             get_user_rereg_bids
31             get_docs_upload_uri
32             update_contacts
33             update_private_person_flag
34             register_ns
35             delete_ns
36             get_nss
37             update_nss
38             delegate
39             undelegate
40             transfer_to_another_account
41             look_at_entering_list
42             accept_or_refuse_entering_list
43             cancel_transfer
44             request_to_transfer
45             )]}
46              
47             __PACKAGE__->namespace_methods;
48             __PACKAGE__->meta->make_immutable;
49              
50             1; # End of Regru::API::Domain
51              
52             __END__
53              
54             =pod
55              
56             =encoding UTF-8
57              
58             =head1 NAME
59              
60             Regru::API::Domain - REG.API v2 domain names management
61              
62             =head1 VERSION
63              
64             version 0.050
65              
66             =head1 DESCRIPTION
67              
68             REG.API domain names management methods such as applying registration, initiating transfer to REG.RU, update administrative
69             contacts, placing bids on freeing domain names, retrive/update DNS servers for domain and many others.
70              
71             =head1 ATTRIBUTES
72              
73             =head2 namespace
74              
75             Always returns the name of category: C<domain>. For internal uses only.
76              
77             =head1 REG.API METHODS
78              
79             =head2 nop
80              
81             For testing purposes. Scope: B<everyone>. Typical usage:
82              
83             $resp = $client->domain->nop(
84             dname => 'sonic-screwdriver.com',
85             );
86              
87             Returns success response.
88              
89             More info at L<Domain management: nop|https://www.reg.com/support/help/api2#domain_nop>.
90              
91             =head2 get_prices
92              
93             Get prices for domain registration/renewal in all available zones. Scope: B<everyone>. Typical usage:
94              
95             $resp = $client->domain->get_prices;
96              
97             # or
98             $resp = $client->domain->get_prices(
99             currency => 'USD',
100             );
101              
102             Additional options might be passed to this method. Returns a list available zones and cost of domain registration/renewal
103             onto the minimal required term.
104              
105             More info at L<Domain management: get_prices|https://www.reg.com/support/help/api2#domain_get_prices>.
106              
107             =head2 get_suggest
108              
109             Gets the domain names suggestions for given word or two (as additional parameter). Scope: B<partners>. Typical usage:
110              
111             $resp = $client->domain->get_suggest(
112             word => 'teselecta',
113             tlds => 'ru',
114             tlds => 'com',
115             );
116              
117             Returns a list of alternatives and its availability in given zones. Result set is limited to I<100> items.
118              
119             More info at L<Domain management: get_suggest|https://www.reg.com/support/help/api2#domain_get_suggest>.
120              
121             =head2 get_premium
122              
123             Gets a list of the premium domains available for registration. Scope: B<partners>. Typical usage:
124              
125             $resp = $client->domain->get_premium(
126             tld => 'ru', # default zone
127             tld => 'orgcyr', # IDN @ .ORG
128             limit => 10,
129             );
130              
131             Answer contains a list each element of it contains premium domain name and its price.
132              
133             More info at L<Domain management: get_premium|https://www.reg.com/support/help/api2#domain_get_premium>.
134              
135             =head2 get_deleted
136              
137             Gets a list of freeing domain names in zones C<.ru>, C<.su> and C<.рф>. This one similar to the
138             L<Deleted Domains|https://www.reg.com/domain/new/freeing_domains> page. Scope: B<partners>. Typical usage:
139              
140             $resp = $client->domain->get_deleted(
141             tlds => 'ru', # look up .ru
142             tlds => 'su', # look up .su
143             deleted_from => '2013-10-01',
144             deleted_to => '2013-11-01',
145             min_pr => 2, # Google PR
146             min_cy => 1, # Yandex CY
147             );
148              
149             Answer will contains a field C<domains> with a list of domain names that satisfied by request criteria. Also each element
150             will includes domain status, first registration date, freeing date and values of ranks (Google PR and Yandex CY).
151             Maximum returned elements in list equals to 50000.
152              
153             More info at L<Domain management: get_deleted|https://www.reg.com/support/help/api2#domain_get_deleted>.
154              
155             =head2 check
156              
157             Use this method to check availability of a domain name for registration. Scope: B<partners>. Typical usage:
158              
159             $resp = $client->domain->check(
160             domain_name => 'trenzalore.net',
161             );
162              
163             # or
164             $resp = $client->domain->check(
165             domains => [
166             { dname => 'apalapucia.com' },
167             { dname => 'gallifrey.ru' },
168             ],
169             );
170              
171             Response answer contains C<domains> field with list of hashes providing information about domain names and their
172             availability or error code.
173              
174             More info at L<Domain management: check|https://www.reg.com/support/help/api2#domain_check>.
175              
176             =head2 create
177              
178             Apply for domain name registration. Scope: B<clients>. Typical usage:
179              
180             $resp = $client->domain->create(
181             domain_name => 'messaline.ru',
182             contacts => {
183             # set of contact fields goes here (depends on zone)
184             ...
185             },
186             nss => {
187             ns0 => 'ns1.messaline.ru',
188             ns0ip => '172.16.10.1', # The glue record for the name server at the same domain
189             ns1 => 'ns2.messaline.com',
190             },
191             );
192              
193             Successful response will contains a list of domains and billing information.
194              
195             More info at L<Domain management: create|https://www.reg.com/support/help/api2#domain_create>.
196              
197             =head2 transfer
198              
199             Apply for a transfer of a domain name from foreign registrar. Scope: B<clients>. Typical usage:
200              
201             $resp = $client->domain->transfer(
202             authinfo => 'f8gL-rGi/*8_VB',
203             domain_name => 'midnight.net',
204             );
205              
206             This method has request fields similar to L<#create> method call. For the most part of the international zones such as
207             C<.com>, C<.net>, C<.org> should be provided transfer key by specifying parameter authinfo.
208              
209             More info at L<Domain management: transfer|https://www.reg.com/support/help/api2#domain_transfer>.
210              
211             =head2 get_rereg_data
212              
213             Gets a list of freeing domain names and their details. Scope: B<partners>. Typical usage:
214              
215             $resp = $client->domain->get_rereg_data(
216             min_pr => 2,
217             max_chars => 5,
218             sort => 'price',
219             );
220              
221             Returns a domain names list for the given parameters.
222              
223             More info at L<Domain management: get_rereg_data|https://www.reg.com/support/help/api2#domain_get_rereg_data>.
224              
225             =head2 set_rereg_bids
226              
227             Places a bid or bids for the freeing domain names. Scope: B<clients>. Typical usage:
228              
229             $resp = $client->domain->set_rereg_bids(
230             contacts => {
231             # similar to apply domain name registration
232             ...
233             },
234             nss => {
235             # this one too
236             ...
237             },
238             domains => [
239             { dname => 'pyrovilia.su', price => 400 },
240             { dname => 'saturnyne.ru', price => 225 },
241             ],
242             );
243              
244             Answer will be contains a list of domain names and their bid status. Additionally a payment status for the placed
245             bids will be returned.
246              
247             More info at L<Domain management: set_rereg_bids|https://www.reg.com/support/help/api2#domain_set_rereg_bids>.
248              
249             =head2 get_user_rereg_bids
250              
251             Gets the bids placed on. Scope: B<clients>. Typical usage:
252              
253             $resp = $client->domain->get_user_rereg_bids;
254              
255             Returns a list of a domain names for which user has placed bids on.
256              
257             More info at L<Domain management: get_user_rereg_bids|https://www.reg.com/support/help/api2#domain_get_user_rereg_bids>.
258              
259             =head2 get_docs_upload_uri
260              
261             Gets a link for uploading registrant identification documents (only for B<.RU>, B<.SU> and B<.РФ> zones).
262             Scope: B<clients>. Typical usage:
263              
264             $resp = $client->domain->get_docs_upload_uri(
265             dname => 'test.ru',
266             );
267              
268             Answer will be contains an url that should be used to upload documents.
269              
270             More info at L<Domain management: get_docs_upload_uri|https://www.reg.com/support/help/api2#domain_get_docs_upload_uri>.
271              
272             =head2 update_contacts
273              
274             Make changes of the domain name contact data. Scope: B<clients>. Typical usage:
275              
276             $resp = $client->domain->update_contacts(
277             domains => [
278             { dname => 'griffoth.com' },
279             { dname => 'jahoo.net' },
280             ],
281             contacts => {
282             # XXX keys of the contacts data may differ from zone to zone
283              
284             # Domain name Owner contact data (o_*)
285             o_company => 'Private person',
286             o_first_name => 'Madame',
287             o_last_name => 'Kovarian',
288             o_email => 'patch-lady@kovarian.com',
289             ...
290             o_country_code => 'US',
291             ...
292              
293             # Domain name Administrative contact data (a_*)
294             ...
295              
296             # Domain name Technical contact data (t_*)
297             ...
298              
299             # Domain name Billing contact data (b_*)
300             ...
301              
302             # Additional data
303             private_person_flag => 1,
304             },
305             );
306              
307             Answer will contains a domains field with list of domain names each item consist of dname, service_id and/or error_code
308             parameters.
309              
310             More info at L<Domain management: update_contacts|https://www.reg.com/support/help/api2#domain_update_contacts>.
311              
312             =head2 update_private_person_flag
313              
314             Change settings of the Private Person and Total Private Person flags (show/hide contact data in WHOIS answers).
315             Scope: B<clients>. Typical usage:
316              
317             $resp = $client->domain->update_private_person_flag(
318             domains => [
319             { dname => 'griffoth.com' },
320             { dname => 'jahoo.net' },
321             ],
322             private_person_flag => 1, # or 0, to expose contacts data
323             );
324              
325             Answer will contains a domains field with list of domain names and operation status.
326              
327             More info at L<Domain management: update_private_person_flag|https://www.reg.com/support/help/api2#domain_update_private_person_flag>.
328              
329             =head2 register_ns
330              
331             Domain name server registration in the NSI registry ((for internatonal domains only). Scope: B<clients>. Typical usage:
332              
333             $resp = $client->domain->register_ns(
334             domain_name => 'griffoth.com',
335             ns0 => 'ns1.griffoth.com',
336             ns0ip => '172.20.21.1',
337             );
338              
339             Answer will contains a C<resp> field with a detailed response from the NSI registry, typically a hash. Available
340             in sussessful resposnses only.
341              
342             More info at L<Domain management: register_ns|https://www.reg.com/support/help/api2#domain_register_ns>.
343              
344             =head2 delete_ns
345              
346             Deletion of a domain name server from the NSI registry (for international domains only). Scope: B<clients>. Typical usage:
347              
348             $resp = $client->domain->delete_ns(
349             domain_name => 'griffoth.com',
350             ns0 => 'ns1.griffoth.com',
351             ns0ip => '172.20.21.1',
352             );
353              
354             Answer will contains a C<resp> field with a detailed response from the NSI registry, typically a hash. Available
355             in sussessful resposnses only.
356              
357             More info at L<Domain management: delete_ns|https://www.reg.com/support/help/api2#domain_delete_ns>.
358              
359             =head2 get_nss
360              
361             Retrive a domane name servers for domain name(s). Scope: B<clients>. Typical usage:
362              
363             $resp = $client->domain->get_nss(
364             domain_name => 'griffoth.com',
365             );
366              
367             # or
368             $resp = $client->domain->get_nss(
369             domains => [
370             { dname => 'griffoth.com' },
371             { dname => 'jahoo.net' },
372             ],
373             );
374              
375             Answer will contains a list of domain names and nameservers (and ip addresses if any) and/or error codes.
376              
377             More info at L<Domain management: get_nss|https://www.reg.com/support/help/api2#domain_get_nss>.
378              
379             =head2 update_nss
380              
381             Change DNS servers of the domain name. Also this function enables/disables domain name delegation (for partners only).
382             Scope: B<clients>/B<partners>. Typical usage:
383              
384             $resp = $client->domain->update_nss(
385             domains => [
386             { dname => 'koorharn.ru' },
387             { dname => 'stormcage.ru' },
388             ],
389             nss => {
390             ns0 => 'ns1.barcelona.net',
391             ns1 => 'ns2.barcelona.org',
392             ns3 => 'ns3.barcelona.com',
393             },
394             );
395              
396             Answer will contains a list of domain names with the parameters dname, service_id and/or a service identification error_code.
397              
398             More info at L<Domain management: update_nss|https://www.reg.com/support/help/api2#domain_update_nss>.
399              
400             =head2 delegate
401              
402             Turn on a domain name delegation flag. Scope: B<partners>. Typical usage:
403              
404             $resp = $client->domain->delegate(
405             domains => [
406             { dname => 'koorharn.ru' },
407             { dname => 'stormcage.ru' },
408             ],
409             );
410              
411             Answer will contains a list of domain names with the parameters dname, service_id and/or a service identification error_code.
412              
413             More info at L<Domain management: delegate|https://www.reg.com/support/help/api2#domain_delegate>.
414              
415             =head2 undelegate
416              
417             Turn off a domain name delegation flag. Scope: B<partners>. Typical usage:
418              
419             $resp = $client->domain->undelegate(
420             domains => [
421             { dname => 'koorharn.ru' },
422             { dname => 'stormcage.ru' },
423             ],
424             );
425              
426             Answer will contains a list of domain names with the parameters dname, service_id and/or a service identification error_code.
427              
428             More info at L<Domain management: undelegate|https://www.reg.com/support/help/api2#domain_undelegate>.
429              
430             =head2 transfer_to_another_account
431              
432             Transfer a domain name to another account within REG.RU. Scope: B<partners>. Typical usage:
433              
434             $resp = $client->domain->transfer_to_another_account(
435             domain_name => 'stormcage.ru',
436             new_user_name => 'river-song',
437             );
438              
439             Answer will contains a list of domain names transferred to another account. In case of success, the field
440             C<result> there will be the B<request_is_sent> value for each domain name in the C<result> field, otherwise an
441             error code will be returned.
442              
443             More info at L<Domain management: transfer_to_another_account|https://www.reg.com/support/help/api2#domain_transfer_to_another_account>.
444              
445             =head2 look_at_entering_list
446              
447             Show the list of domain names transferred to current account. Scope: B<partners>. Typical usage:
448              
449             $resp = $client->domain->look_at_entering_list;
450              
451             Answer will contains a list of messages about domain names transfer. Each message contains an ID and the name of
452             the transferred domain. Upon each transfer domain names are assigned to new user ID.
453              
454             More info at L<Domain management: look_at_entering_list|https://www.reg.com/support/help/api2#domain_look_at_entering_list>.
455              
456             =head2 accept_or_refuse_entering_list
457              
458             Accept or decline domain names transferred to current account. Scope: B<partners>. Typical usage:
459              
460             $resp = $client->domain->accept_or_refuse_entering_list(
461             dname => 'stormcage.ru',
462             id => 895901,
463             action_type => 'accept', # accept/refuse; yes/no; 1/0
464             );
465              
466             Answer will contains a list of domain names with result for each domain name.
467              
468             More info at L<Domain management: accept_or_refuse_entering_list|https://www.reg.com/support/help/api2#domain_accept_or_refuse_entering_list>.
469              
470             =head2 cancel_transfer
471              
472             Shut down transfers of the domain names. Scope: B<partners>. Typical usage:
473              
474             $resp = $client->domain->cancel_transfer(
475             domains => [
476             { dname => 'koorharn.ru' },
477             { dname => 'stormcage.ru' },
478             ],
479             );
480              
481             Answer will contains a list of domain names with result for each domain name.
482              
483             More info at L<Domain management: cancel_transfer|https://www.reg.com/support/help/api2#domain_cancel_transfer>.
484              
485             =head2 request_to_transfer
486              
487             Send request to transfer a domain name to foreign registrar. Scope: B<partners>. Typical usage:
488              
489             $resp = $client->domain->cancel_transfer(
490             domain_name => 'felspoon.com',
491             );
492              
493             Answer will contains a list of domain names with result for each domain name.
494              
495             More info at L<Domain management: request_to_transfer|https://www.reg.com/support/help/api2#domain_request_to_transfer>.
496              
497             =head1 SEE ALSO
498              
499             L<Regru::API>
500              
501             L<Regru::API::Role::Client>
502              
503             L<REG.API Domain management|https://www.reg.com/support/help/api2#domain_functions>
504              
505             L<REG.API Common error codes|https://www.reg.com/support/help/api2#common_errors>
506              
507             =head1 BUGS
508              
509             Please report any bugs or feature requests on the bugtracker website
510             L<https://github.com/regru/regru-api-perl/issues>
511              
512             When submitting a bug or request, please include a test-file or a
513             patch to an existing test-file that illustrates the bug or desired
514             feature.
515              
516             =head1 AUTHORS
517              
518             =over 4
519              
520             =item *
521              
522             Polina Shubina <shubina@reg.ru>
523              
524             =item *
525              
526             Anton Gerasimov <a.gerasimov@reg.ru>
527              
528             =back
529              
530             =head1 COPYRIGHT AND LICENSE
531              
532             This software is copyright (c) 2013 by REG.RU LLC.
533              
534             This is free software; you can redistribute it and/or modify it under
535             the same terms as the Perl 5 programming language system itself.
536              
537             =cut