File Coverage

blib/lib/WebService/DigitalOcean/Role/Droplets.pm
Criterion Covered Total %
statement 21 30 70.0
branch n/a
condition n/a
subroutine 7 10 70.0
pod 4 4 100.0
total 32 44 72.7


line stmt bran cond sub pod time code
1             package WebService::DigitalOcean::Role::Droplets;
2             # ABSTRACT: Droplets role for DigitalOcean WebService
3 2     2   853 use utf8;
  2         2  
  2         9  
4 2     2   47 use Moo::Role;
  2         2  
  2         10  
5 2     2   371 use feature 'state';
  2         3  
  2         120  
6 2     2   29 use Types::Standard qw/Str Object Dict ArrayRef Optional Bool Int/;
  2         4  
  2         12  
7 2     2   1369 use Type::Utils;
  2         2  
  2         8  
8 2     2   1634 use Type::Params qw/compile/;
  2         2  
  2         9  
9              
10             requires 'make_request';
11              
12             our $VERSION = '0.025'; # VERSION
13              
14             sub droplet_create {
15 1     1 1 1114 state $check = compile(Object,
16             Dict[
17             name => Str,
18             region => Str,
19             size => Str,
20             image => Str,
21             user_data => Optional[ Str ],
22             ssh_keys => Optional[ ArrayRef ],
23             backups => Optional[ Bool ],
24             ipv6 => Optional[ Bool ],
25             private_networking => Optional[ Bool ],
26             ],
27             );
28 1         17654 my ($self, $opts) = $check->(@_);
29              
30 1         213 return $self->make_request(POST => '/droplets', $opts);
31             }
32              
33             sub droplet_list {
34 0     0 1   state $check = compile(Object);
35 0           my ($self) = $check->(@_);
36              
37 0           return $self->make_request(GET => '/droplets');
38             }
39              
40             sub droplet_get {
41 0     0 1   state $check = compile(Object, Int);
42 0           my ($self, $id) = $check->(@_);
43              
44 0           return $self->make_request(GET => "/droplets/$id");
45             }
46              
47             sub droplet_delete {
48 0     0 1   state $check = compile(Object, Int);
49 0           my ($self, $id) = $check->(@_);
50              
51 0           return $self->make_request(DELETE => "/droplets/$id");
52             }
53              
54             1;
55              
56             __END__
57              
58             =pod
59              
60             =encoding UTF-8
61              
62             =head1 NAME
63              
64             WebService::DigitalOcean::Role::Droplets - Droplets role for DigitalOcean WebService
65              
66             =head1 VERSION
67              
68             version 0.025
69              
70             =head1 DESCRIPTION
71              
72             Implements the droplets methods.
73              
74             =head1 METHODS
75              
76             =head2 droplet_create
77              
78             =head2 droplet_list
79              
80             =head2 droplet_get
81              
82             =head2 droplet_delete
83              
84             See main documentation in L<WebService::DigitalOcean>.
85              
86             =head1 AUTHOR
87              
88             André Walker <andre@cpan.org>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is Copyright (c) 2015 by André Walker.
93              
94             This is free software, licensed under:
95              
96             The GNU General Public License, Version 2, June 1991
97              
98             =cut