| 1 | # | ||
| 2 | # This file is part of Net-Gandi | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2012 by Natal Ngétal. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | package Net::Gandi::Domain; | ||
| 10 | { | ||
| 11 | $Net::Gandi::Domain::VERSION = '1.122180'; | ||
| 12 | } | ||
| 13 | |||
| 14 | # ABSTRACT: Domain interface | ||
| 15 | |||
| 16 | use Moose; | ||
| 17 | use MooseX::Params::Validate; | ||
| 18 | use namespace::autoclean; | ||
| 19 | |||
| 20 | use Net::Gandi::Types Client => { -as => 'Client_T' }; | ||
| 21 | |||
| 22 | use Carp; | ||
| 23 | |||
| 24 | |||
| 25 | has domain => ( is => 'rw', isa => 'Str' ); | ||
| 26 | |||
| 27 | has client => ( | ||
| 28 | is => 'rw', | ||
| 29 | isa => Client_T, | ||
| 30 | required => 1, | ||
| 31 | ); | ||
| 32 | |||
| 33 | |||
| 34 | sub list { | ||
| 35 | my ( $self, $params ) = validated_list( | ||
| 36 | \@_, | ||
| 37 | opts => { isa => 'HashRef', optional => 1 } | ||
| 38 | ); | ||
| 39 | |||
| 40 | $params ||= {}; | ||
| 41 | return $self->client->api_call( "domain.list", $params ); | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
| 45 | sub count { | ||
| 46 | my ( $self, $params ) = validated_list( | ||
| 47 | \@_, | ||
| 48 | opts => { isa => 'HashRef', optional => 1 } | ||
| 49 | ); | ||
| 50 | |||
| 51 | $params ||= {}; | ||
| 52 | return $self->client->api_call('domain.count', $params); | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 56 | sub info { | ||
| 57 | my ( $self ) = @_; | ||
| 58 | |||
| 59 | carp 'Required parameter domain attribute is not defined' | ||
| 60 | if ( ! $self->domain ); | ||
| 61 | return $self->client->api_call( 'domain.info', $self->domain ); | ||
| 62 | } | ||
| 63 | |||
| 64 | 1; | ||
| 65 | |||
| 66 | __END__ |