Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add autogenerated list_ back in

  • Loading branch information...
commit c50b28f7ff407e9b19e7458e9bfb2940ca5ac9b7 1 parent f127735
@simonwistow simonwistow authored
View
44 lib/Net/Fastly.pm
@@ -25,10 +25,14 @@ BEGIN {
my $name = $class->_path;
- foreach my $method (qw(get create update delete)) {
+ foreach my $method (qw(get create update delete list)) {
my $code = "sub { shift->_$method('$class', \@_) }";
my $glob = "${method}_${name}";
$glob .= "s" if $method eq 'list';
+ # don't create this if it's a list and something isn't listable ...
+ next if $method eq $list && !defined $class->_list_path;
+ # or if it already exists (i.e it's been overidden)
+ next if *$glob;
*$glob = eval "$code";
}
}
@@ -308,23 +312,31 @@ Note - you can also do
=cut
-=head2 list_services
-Get a list of all the services that the current customer has.
-=head2 search_services <param[s]>
+=head2 list_users
-Search all the services that the current customer has.
+=head2 list_customers
-In general you'll want to do
+=head2 list_versions
- my @services = $fastly->search_services(name => $name);
+=head2 list_services
-or
+=head2 list_backends
- my ($service) = $fastly->search_services(name => $name, version => $number);
+=head2 list_directors
-=cut
+=head2 list_domains
+
+=head2 list_healthchecks
+
+=head2 list_matchs
+
+=head2 list_vcls
+
+=head2 list_versions
+
+Get a list of all objects
=head2 list_invoices [<year> <month>]
@@ -334,6 +346,18 @@ If a year and month are passed in returns the invoices for that whole month.
Otherwise it returns the invoices for the current month so far.
+=head2 search_services <param[s]>
+
+Search all the services that the current customer has.
+
+In general you'll want to do
+
+ my @services = $fastly->search_services(name => $name);
+
+or
+
+ my ($service) = $fastly->search_services(name => $name, version => $number);
+
=cut
sub _list {
View
1  lib/Net/Fastly/Invoice.pm
@@ -56,6 +56,7 @@ sub _post_path { die "You can't POST to an invoice" }
sub _put_path { die "You can't PUT to an invoice" }
sub _delete_path { die "You can't DELETE to an invoice" }
+
=head2 save
Save this object. Equivalent to
View
3  lib/Net/Fastly/Model.pm
@@ -52,7 +52,8 @@ sub _post_path {
}
sub _list_path { shift->_post_path(@_) }
-
+
+
sub _put_path {
my $class = shift;
my $obj = shift;
View
6 lib/Net/Fastly/Service.pm
@@ -130,12 +130,6 @@ sub version {
package Net::Fastly;
-sub list_services {
- my $self = shift;
- my %opts = @_;
- return $self->_list("Net::Fastly::Service", %opts);
-}
-
sub search_services {
my $self = shift;
my %opts = @_;
View
2  lib/Net/Fastly/Settings.pm
@@ -44,7 +44,7 @@ sub _as_hash {
return %$settings;
}
-sub _list_path { die "You can't list settings" }
+sub _list_path { undef }
sub _post_path { die "You can't POST to settings" }
sub _delete_path { die "You can't DELETE to settings" }
Please sign in to comment.
Something went wrong with that request. Please try again.