version 1.02
Net::Google::CivicInformation::Representatives - All elected representatives for US addresses
my $client = Net::Google::CivicInformation::Representatives->new( api_key => '***' ); my $res = $client->representatives_for_address('123 Main St Springfield MO 12345'); if ( $res->{error} ) { # handle the error hash returned } else { for my $official ( $res->{officals} ) { # use the data hash } }
Requires an address string as the only argument.
On error, the response will contain a key error containing a hashref like:
error
{ 'error' => { 'code' => 400, 'errors' => [ { 'domain' => 'global', 'message' => 'Failed to parse address', 'reason' => 'parseError' } ], 'message' => 'Failed to parse address' } }
On success, the response will contain a key officials containing an arrayref of hashrefs, ordered by descending seniority (head of state down). Each hashref represents a single official: there may be more than one record at the same "rank." The hashref will contain the following keys:
officials
Nick Tonkin <tonkin@cpan.org>
This software is copyright (c) 2021 by Nick Tonkin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Google::CivicInformation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Google::CivicInformation
CPAN shell
perl -MCPAN -e shell install Net::Google::CivicInformation
For more information on module installation, please visit the detailed CPAN module installation guide.