File Coverage

blib/lib/Net/Fastly/Settings.pm
Criterion Covered Total %
statement 6 30 20.0
branch 0 2 0.0
condition n/a
subroutine 2 12 16.6
pod 4 4 100.0
total 12 48 25.0


line stmt bran cond sub pod time code
1             package Net::Fastly::Settings;
2              
3 4     4   13 use strict;
  4         4  
  4         101  
4 4     4   13 use base qw(Net::Fastly::Model);
  4         2  
  4         1236  
5              
6             Net::Fastly::Settings->mk_accessors(qw(service_id version));
7              
8             =head1 NAME
9              
10             Net::Fastly::Invoice - - a representation of a Fastly monthly invoice
11              
12             =head1 ACCESSORS
13              
14             =head2 service_id
15              
16             The id of the service these settings are for
17              
18             =head2 version
19              
20             The version number these settings for
21              
22             =head2 settings
23              
24             A hash ref of all the individual settings
25              
26             =cut
27              
28             sub _get_path {
29 0     0     my $class = shift;
30 0           my $service = shift;
31 0           my $number = shift;
32 0           return "/service/$service/version/$number/settings";
33             }
34              
35             sub _put_path {
36 0     0     my $class = shift;
37 0           my $obj = shift;
38 0           return $class->_get_path($obj->service_id, $obj->version);
39             }
40              
41             sub settings {
42 0     0 1   my $self = shift;
43 0 0         $self->{_settings} = { map { $_ => $self->{$_} } grep !/^(_|service_id$|version$)/, keys %$self } unless $self->{_settings};
  0            
44 0           return $self->{_settings};
45             }
46              
47             sub _as_hash {
48 0     0     my $self = shift;
49 0           my $settings = $self->settings;
50 0           return %$settings;
51             }
52              
53 0     0     sub _skip_list { 1 }
54 0     0     sub _post_path { die "You can't POST to settings" }
55 0     0     sub _delete_path { die "You can't DELETE to settings" }
56              
57             =head2 delete
58              
59             Delete this object. Equivalent to
60              
61             $fastly->delete_($object);
62              
63             =cut
64 0     0 1   sub delete { die "You can't delete an invoice" }
65              
66             package Net::Fastly;
67              
68             sub get_settings {
69 0     0 1   my $self = shift;
70 0           my $class = "Net::Fastly::Settings";
71 0           $self->_get($class, @_);
72             }
73              
74             sub update_settings {
75 0     0 1   my $self = shift;
76 0           my $class = "Net::Fastly::Settings";
77 0           $self->_update($class, @_);
78             }
79             1;