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