Domain-Register-TK

 view release on metacpan or  search on metacpan

lib/Domain/Register/TK.pm  view on Meta::CPAN

                    {
                      'hostname' => 'NS3.TESTDOMAIN-0003.TK',
                      'ipaddress' => '192.168.0.11'
                    },
                    {
                      'hostname' => 'NS2.TESTDOMAIN-0003.TK',
                      'ipaddress' => '192.168.20.254'
                    },
                    {
                      'hostname' => 'NS4.TESTDOMAIN-0003.TK',
                      'ipaddress' => '192.168.1.1'
                    },
                    {
                      'hostname' => 'NS1.TESTDOMAIN-0003.TK',
                      'ipaddress' => '192.168.10.1'
                    }
                  ]
        };

=cut

sub host_list {
    my $self   = shift;
    my $domain = shift;
    my $st     = $self->_get_url(
        {
            function   => 'host_list',
            domainname => $domain,
        }
    );
    return $st;
}

=head2 Update domain DNS

Function: C<UPDATEDNS>

Parameters: C<DOMAIN> (Compulsory)

Parameters: (optional) either an array reference of name servers, B<or> a URL for
forwarding.

 # with an array of name servers
 $return_value = $api_object->updatedns('TESTDOMAIN-0003.TK', ['NS1.A.COM.TK', 'NS2.A.COM.TK']);

or

 # with a URL for forwarding
 $return_value = $api_object->updatedns('TESTDOMAIN-0004.TK', 'http://www.icann.org/');

Possible response (regardless of form used):

 $return_value  = {
          'status' => 'NAMESERVERS UPDATED',
          'type' => 'result',
          'domainname' => 'TESTDOMAIN-0004.TK'
        };

=cut

sub updatedns {
    my $self   = shift;
    my $domain = shift;

    my $st;

    if ( ref $_[0] eq 'ARRAY' ) {

        # list of name servers
        $st = $self->_get_url(
            {
                function   => 'updatedns',
                domainname => $domain,
                nameserver => $_[0],
            }
        );
    }
    elsif ( not defined $_[0] ) {

        # no details, so (I guess) reset settings
        $st = $self->_get_url(
            {
                function   => 'updatedns',
                domainname => $domain,
            }
        );
    }
    else {

        # url forwarder
        $st = $self->_get_url(
            {
                function   => 'updatedns',
                domainname => $domain,
                forwardurl => $_[0],
            }
        );
    }
    return $st;
}

=head2 Update WHOIS information

Function: C<updatewhois>

Parameters: (compulsory) C<DOMAIN>, C<HASHREFENCE of keys to change>

This function is called a little differently from everything else. Instead
of passing a large number of parameters in a fixed order, it requires a
C<Hash Reference> to a collection of key->value pairs representing the items
in the WHOIS record that are to be changed.

The keys the system recognizes are those mentioned in the main API
documentation under updatewhois, except function, email and password.

For example:

 $result_code = $api_object->updatewhois('TESTDOMAIN-0003.TK', {reg_company => 'Dot TK BV', reg_city => 'Amsterdam', reg_countrycode => 'NL'});

Possible response: 

 $result_code = {
          'status' => 'WHOIS INFORMATION UPDATED',
          'type' => 'result',
          'domainname' => 'TESTDOMAIN-0003.TK'
        };

=cut

sub updatewhois {
    my $self   = shift;
    my $domain = shift;
    my $param  = shift;

    my $temp_st = { function => 'updatewhois', domainname => $domain };
    foreach my $k ( keys %{$param} ) {
        $temp_st->{$k} = $param->{$k};
    }

    my $st = $self->_get_url($temp_st);
    return $st;
}

=head2 Domain Status

Function: C<domain_status>

Parameter: (compulsory) C<DOMAIN>

 $result_code = $api_object->domain_status('TESTDOMAIN-0003.TK');

Possible response:

Depending on the relation between Reseller and Domain, there can be three different types of output:

I<If the domain is available for registration>

 $ result_code = {
          'status' => 'AVAILABLE',
          'type' => 'result',
          'domainname' => 'TESTDOMAIN-0003.TK',
          'pricing' => [
                       {
                         'currency' => 'GBP',
                         'retailprice' => '19.90',
                         'partnerprice' => '9.00',
                         'lengthofregistration' => '2'
                       },
                       {
                         'currency' => 'GBP',
                         'retailprice' => '24.75',
                         'partnerprice' => '13.50',
                         'lengthofregistration' => '3'
                       },
                       {
                         'currency' => 'GBP',
                         'retailprice' => '31.80',
                         'partnerprice' => '18.00',
                         'lengthofregistration' => '4'
                       },
                       {
                         'currency' => 'GBP',
                         'retailprice' => '37.50',
                         'partnerprice' => '22.50',
                         'lengthofregistration' => '5'
                       },
                       {
                         'currency' => 'GBP',
                         'retailprice' => '62.55',
                         'partnerprice' => '40.50',



( run in 2.133 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )