Skip to content

pon/google-civic-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-civic-info

Wrapper for Google Civic Information API

This API allows you to access information about both Elections and Representatives

Installation

$ npm install google-civic-info

=== ##Creating a GCI Instance Provide an apiKey to create a GCI instance.

var gci = require('google-civic-info')({
  apiKey: 'YOUR_API_KEY
});

=== ##Get Representatives This function allows you to retrieve a list of representatives for a given address or division (more_info). ####getRepresentatives(address, config, callback)

Retrieve representatives based on an address string:

gci.getRepresentatives('2300 Webster St Oakland, CA 94612', function (err, data) {
  //Do something here
});

Retrieve respresenatives based on a division (ocdId) rather than address:

gci.getRepresentatives({
  includeOffices: true,
  ocdId: 'ocd-division/country:us/state:ca/place:oakland',
  recursive: true
}, function (err, data) {
  //Do something here
});

Sample data object:

{
  "kind": "civicinfo#representativeInfoResponse",
  "status": "success",
  "normalizedInput": {
    "line1": "2300 webster st",
    "city": "oakland",
    "state": "CA",
    "zip": "94612"
  },
  "divisions":  [Object],
  "offices":    [Object],
  "officials":  [Object]
}

About

Node Wrapper to the Google Civic Information API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published