Skip to content

Instantly share code, notes, and snippets.

@mago0
Created April 13, 2012 03:18
Show Gist options
  • Save mago0/2373363 to your computer and use it in GitHub Desktop.
Save mago0/2373363 to your computer and use it in GitHub Desktop.
use warnings;
use Data::Dumper;
use DMEApiClient;
use App::Rad;
App::Rad->run();
my $client = DMEApiClient->new(
base_url => 'http://api.dnsmadeeasy.com/V1.2/domains/ctsandbox.com'
);
sub setup {
my $c = shift;
$c->register_commands({
add => 'Add an A record',
remove => 'Remove an A record',
list => 'Print records',
});
$c->load_config('dnsmeapi');
}
sub add {
my $ip = shift;
my $client = DMEApiClient->new(
base_url => 'http://api.dnsmadeeasy.com/V1.2/domains/ctsandbox.com'
);
return $client->add_a_record($ip);
}
sub remove {
my $id = shift;
my $client = DMEApiClient->new(
base_url => 'http://api.dnsmadeeasy.com/V1.2/domains/ctsandbox.com'
);
return $client->del_a_record($id);
}
sub list {
my $client = DMEApiClient->new(
base_url => 'http://api.dnsmadeeasy.com/V1.2/domains/ctsandbox.com'
);
my @records = $client->get_records();
my @ips;
for my $record (@records){
print Dumper $record;
if ($record->{name} eq '') { push @ips, $record->{data}; }
}
#return Dumper @ips
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment