Next | Pigs in Space | 30 |
Super-easy web API integration via Stick
Suppose we have a method:
sub current_balance { ... return $current_balance; }
To expose this method in the web API:
use Stick::Publisher; use Stick::Publisher::Publish; with ('Stick::Role::Routable::AutoInstance');
publish current_balance => sub { ... return $current_balance; };
There are some options:
publish terminate_as_of => { -http_method => 'post', -path => 'terminate', term_date => 'Moonpig::DateTime', } => sub { my ($self, $arg) = @_; $self->set_termination_date($arg->{term_date}); ... };
After writing this talk, I wished I'd written a talk about Stick instead
Next | Copyright © 2013 M. J. Dominus |