| 1 | package Exobrain::Agent::Idonethis; | ||
| 2 | use Moose::Role; | ||
| 3 | use Method::Signatures; | ||
| 4 | use WebService::Idonethis 0.22; | ||
| 5 | use POSIX qw(strftime); | ||
| 6 | |||
| 7 | with 'Exobrain::Agent'; | ||
| 8 | |||
| 9 | # ABSTRACT: Roles for to iDonethis agents | ||
| 10 | our $VERSION = '1.08'; # VERSION | ||
| 11 | |||
| 12 | |||
| 13 | sub component_name { "Idonethis" } | ||
| 14 | |||
| 15 | |||
| 16 | has idone => ( is => 'ro', lazy => 1, builder => '_build_idonethis' ); | ||
| 17 | |||
| 18 | method _build_idonethis() { | ||
| 19 | my $config = $self->config; | ||
| 20 | |||
| 21 | my $user = $config->{user} or die "Can't find Idonethis/user"; | ||
| 22 | my $pass = $config->{pass} or die "Can't find Idonethis/pass"; | ||
| 23 | |||
| 24 | return WebService::Idonethis->new( | ||
| 25 | user => $user, | ||
| 26 | pass => $pass, | ||
| 27 | ); | ||
| 28 | } | ||
| 29 | |||
| 30 | |||
| 31 | method to_ymd($epoch_seconds) { | ||
| 32 | return strftime("%Y-%m-%d", localtime( $epoch_seconds )), | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||
| 37 | __END__ |