Browse Source

Add offset support for get_member_votes

master
Blaine Motsinger 2 years ago
parent
commit
9be39d7bb1
  1. 13
      lib/ProPublica/Congress/Members.pm

13
lib/ProPublica/Congress/Members.pm

@ -192,6 +192,7 @@ sub get_member_votes {
my $self = shift;
my $args = {
member_id => undef,
offset => undef,
@_,
};
@ -203,8 +204,16 @@ sub get_member_votes {
die 'The member_id argument must be a string of alpha numeric characters';
}
if ( defined $args->{offset} && ( $args->{offset} eq q{} || $args->{offset} % 20 ) ) {
die 'The offset argument must be a multiple of 20';
}
my $uri = 'https://api.propublica.org/congress/v1/members/' . $args->{member_id} . '/votes.json';
if ( defined $args->{offset} ) {
$uri .= '?offset=' . $args->{offset};
}
return $self->request( uri => $uri );
}
@ -691,6 +700,10 @@ L<https://projects.propublica.org/api-docs/congress-api/members/#get-a-specific-
=item member_id
=item offset
Must be a multiple of 20.
=back
=head3 RETURNS

Loading…
Cancel
Save