Skip to content

Commit

Permalink
Lists API start
Browse files Browse the repository at this point in the history
  • Loading branch information
semifor committed Oct 24, 2009
1 parent 79dc990 commit 745154c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/Net/Twitter/Role/API/Lists.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package Net::Twitter::Role::API::Lists;
use Moose::Role;
use DateTime::Format::Strptime;

requires qw/username ua/;

has lists_api_url => ( isa => 'Str', is => 'rw', default => 'http://twitter.com' );
has _lists_dt_parser => ( isa => 'Object', is => 'rw', default => sub {
DateTime::Format::Strptime->new(pattern => '%a %b %d %T %z %Y')
}
);

#args *name, mode
sub create_list {
my ($self, $args) = @_;
my $user = $self->username;
my $base = $self->lists_api_url;

my $uri = URI->new(join '/', $base, $user, 'lists.json');

my $res = $self->_authenticated_request('POST', $uri, $args, 1);

return $self->_parse_result($res, {}, $self->_lists_dt_parser);
}

1;

0 comments on commit 745154c

Please sign in to comment.