NAME
Net::Heroku - Heroku API
DESCRIPTION
Heroku API
Requires Heroku account - free @ http://heroku.com
Domain functions are untested with new API (v0.20+).
USAGE
my $h = Net::Heroku->new(api_key => api_key);
- or -
my $h = Net::Heroku->new(email => $email, password => $password);
my %res = $h->create;
$h->add_config(name => $res{name}, BUILDPACK_URL => ...);
$h->restart(name => $res{name});
say $_->{name} for $h->apps;
$h->destroy(name => $res{name});
warn 'Error:' . $h->error # Error: App not found.
if not $h->destroy(name => $res{name});
if (!$h->destroy(name => $res{name})) {
my %err = $h->error;
warn "$err{code}, $err{message}"; # 404, App not found.
}
METHODS
new
my $h = Net::Heroku->new(api_key => $api_key);
- or -
my $h = Net::Heroku->new(email => $email, password => $password);
Requires api key or user/pass. Returns Net::Heroku object.
apps
my @apps = $h->apps;
Returns list of hash references with app information.
destroy
my $bool = $h->destroy(name => $name);
Requires app name. Destroys app. Returns true if successful.
create
my $app = $h->create;
Creates a Heroku app. Accepts optional hash list as values, returns hash list. Returns empty list on failure.
add_config
my %config = $h->add_config(name => $name, config_key => $config_value);
Requires app name. Adds config variables passed in hash list. Returns hash config.
config
my %config = $h->config(name => $name);
Requires app name. Returns hash reference of config variables.
add_key
my $bool = $h->add_key(key => ...);
Requires key. Adds ssh public key.
keys
my @keys = $h->keys;
Returns list of keys
remove_key
my $bool = $h->remove_key(key_id => $key_id);
Requires id associated with key. Removes key.
ps
my @processes = $h->ps(name => $name);
Requires app name. Returns list of dynos.
restart
my $bool = $h->restart(name => $name);
my $bool = $h->restart(name => $name, dyno => $dyno);
Requires app name. Restarts app. If dyno is supplied, only dyno is restarted.
stop
my $bool = $h->stop(name => $name, dyno => $dyno);
Requires app name. Stop app dyno.
releases
my @releases = $h->releases(name => $name);
my %release = $h->releases(name => $name, release => $release);
Requires app name. Returns list of hashrefs. If release name specified, returns hash.
add_domain
my $bool = $h->add_domain(name => $name, domain => $domain);
Requires app name. Adds domain.
domains
my @domains = $h->domains(name => $name);
Requires app name. Returns list of hashrefs describing assigned domains.
remove_domain
my $bool = $h->remove_domain(name => $name, domain => $domain);
Requires app name associated with domain. Removes domain.
rollback
my $bool = $h->rollback(name => $name, release => $release_id);
Rolls back to a specified release by id.
error
my $message = $h->error;
my %err = $h->error;
In scalar context, returns error message from last request.
In list context, returns hash with keys: code, message.
If the last request was successful, returns empty list.
SEE ALSO
Mojo::UserAgent, http://mojolicio.us/perldoc/Mojo/UserAgent#DEBUGGING, https://api-docs.heroku.com/
SOURCE
http://github.com/tempire/net-heroku
VERSION
0.20
AUTHOR
Glen Hinkle tempire@cpan.org
CONTRIBUTORS
Brian D. Foy
rage311