NAME

Net::Heroku - Heroku API

DESCRIPTION

Heroku API

Requires Heroku account - free @ http://heroku.com

USAGE

my $h = Net::Heroku->new(api_key => ...);
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 (api_key => $api_key)

Requires api key. Returns Net::Heroku object.

apps

Returns list of hash references with app information

destroy (name => $name)

Requires app name. Destroys app. Returns true if successful.

create

Creates a Heroku app. Accepts optional hash list as values, returns hash list.

add_config (name => $name, %()) -> %()

Requires app name. Adds config variables passed in hash list. Returns hash.

config (name => $name)

Requires app name. Returns hash reference of config variables.

add_key (key => $key)

Requires key. Adds ssh public key.

keys

Returns list of keys.

remove_key (key_name => $key_name)

Requires name associated with key. Removes key.

ps (name => $name)

Requires app name. Returns list of processes.

run (name => $name, command => $command)

Requires app name and command. Runs command once.

restart (name => $name, <ps => $ps>, <type => $type>)

Requires app name. Restarts app. If ps is supplied, only process is restarted.

stop (name => $name, <ps => $ps>, <type => $type>)

Requires app name. Stop app process.

releases(name => $name, <release => $release>)

Requires app name. Returns list of hashrefs. If release name specified, returns hash.

rollback(name => $name, release => $release)

Rolls back to a specified releases

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.01

AUTHOR

Glen Hinkle tempire@cpan.org