Gandi.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« Gandi/Types.pm ↑ Summary
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;
10 {
11 $Net::Gandi::VERSION = '1.122180';
12 }
13  
14 # ABSTRACT: A Perl interface for gandi api
15  
16 0 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=2.6
17 use MooseX::Params::Validate;
18 use namespace::autoclean;
19  
20 use Net::Gandi::Client;
21 use Net::Gandi::Types Client => { -as => 'Client_T' };
22  
23 use Net::Gandi::Hosting;
24 use Net::Gandi::Domain;
25 use Net::Gandi::Operation;
26  
27 use 5.010;
28  
29 has client => (
30 is => 'rw',
31 isa => Client_T,
32 required => 1,
33 );
34  
35 sub BUILDARGS {
36 my ( $class, %args ) = @_;
37  
38 my $transport = 'XMLRPC';
39 my $trait = "Net::Gandi::Transport::" . $transport;
40  
41 my $client = Net::Gandi::Client->with_traits($trait)->new(%args);
42 $args{client} = $client;
43  
44 \%args;
45 }
46  
47  
48 sub hosting {
49 my ( $self ) = @_;
50  
51 my $hosting = Net::Gandi::Hosting->new( client => $self->client );
52 $hosting;
53 }
54  
55  
56 sub domain {
57 my ( $self, $id ) = validated_list(
58 \@_,
59 domain => { isa => 'Str', optional => 1 }
60 );
61  
62 my %args = ( client => $self->client );
63 $args{domain} = $id if $id;
64  
65 my $domain = Net::Gandi::Domain->new(%args);
66  
67 return $domain;
68 }
69  
70  
71 sub operation {
72 my ( $self, $id ) = validated_list(
73 \@_,
74 id => { isa => 'Int', optional => 1 }
75 );
76  
77 my %args = ( client => $self->client );
78 $args{id} = $id if $id;
79  
80 my $operation = Net::Gandi::Operation->new(%args);
81  
82 return $operation;
83 }
84  
85 no Moose;
86 __PACKAGE__->meta->make_immutable;
87  
88 1;
89  
90  
91 __END__
« Gandi/Types.pm ↑ Summary