govtrack v0.5.0 Govtrack

Wrapper for the Govtrack.us API that provides programmatic access to information about the U.S. Congress

Summary

Functions

Get information about a specific bill

Example

Govtrack.bill(12700)

More info at: https://www.govtrack.us/developers/api#endpoint_bill

Get a list of all bills

Example

Govtrack.bills

More info at: https://www.govtrack.us/developers/api#endpoint_bill

Get information about a specific committee

Example

Govtrack.committee(2650)

More info at: https://www.govtrack.us/developers/api#endpoint_committee

Get information about a specific committee member

Example

Govtrack.committee_member(207975)

More info at: https://www.govtrack.us/developers/api#endpoint_committee_member

Get a list of all committee members

Example

Govtrack.committee_members

More info at: https://www.govtrack.us/developers/api#endpoint_committee_member

Get a list of all committees

Example

Govtrack.committees

More info at: https://www.govtrack.us/developers/api#endpoint_committee

Get information about a specific cosponsorship

Example

Govtrack.cosponsorship(3291427)

More info at: https://www.govtrack.us/developers/api#endpoint_cosponsorship

Get a list of all cosponsorships

Example

Govtrack.cosponsorships

More info at: https://www.govtrack.us/developers/api#endpoint_cosponsorship

A shortcut for request(:delete, url, options)

A shortcut for request!(:delete, url, options)

A shortcut for request(:get, url, options)

A shortcut for request!(:get, url, options)

A shortcut for request(:head, url, options)

A shortcut for request!(:head, url, options)

A shortcut for request(:options, url, options)

A shortcut for request!(:options, url, options)

A shortcut for request(:patch, url, options)

A shortcut for request!(:patch, url, options)

Get information about a specific person in U.S. Congress

Example

Govtrack.person(400629)

More info at: https://www.govtrack.us/developers/api#endpoint_person

Get a list of all persons in U.S. Congress

Example

Govtrack.persons

More info at: https://www.govtrack.us/developers/api#endpoint_person

A shortcut for request(:post, url, options)

A shortcut for request!(:post, url, options)

A shortcut for request(:put, url, options)

A shortcut for request!(:put, url, options)

Sends an HTTP request

Deprecated form of request; body and headers are now options, see request/3

Like request, but raises HTTPotion.HTTPError if failed

Deprecated form of request with the direct option; body and headers are now options, see request/3

Get information about a specific role

Example

Govtrack.role(42929)

More info at: https://www.govtrack.us/developers/api#endpoint_role

Get a list of all roles

Example

Govtrack.roles

More info at: https://www.govtrack.us/developers/api#endpoint_role

Starts a linked worker process for use with the direct option

Starts a worker process for use with the direct option

Ensures that HTTPotion and its dependencies are started

Get information about a specific vote

Example

Govtrack.vote(13969)

More info at: https://www.govtrack.us/developers/api#endpoint_vote

Get information about how a specific voter voted on a roll call vote

Example

Govtrack.vote_voter(31425718)

More info at: https://www.govtrack.us/developers/api#endpoint_vote_voter

Get a list of all voters in all roll call votes

Example

Govtrack.vote_voter(31425718)

More info at: https://www.govtrack.us/developers/api#endpoint_vote_voter

Get a list of all votes

Example

Govtrack.votes

More info at: https://www.govtrack.us/developers/api#endpoint_vote

Functions

bill(id, query \\ [])

Get information about a specific bill

Example

Govtrack.bill(12700)

More info at: https://www.govtrack.us/developers/api#endpoint_bill

bills(query \\ [])

Get a list of all bills

Example

Govtrack.bills

More info at: https://www.govtrack.us/developers/api#endpoint_bill

committee(id, query \\ [])

Get information about a specific committee

Example

Govtrack.committee(2650)

More info at: https://www.govtrack.us/developers/api#endpoint_committee

committee_member(id, query \\ [])

Get information about a specific committee member

Example

Govtrack.committee_member(207975)

More info at: https://www.govtrack.us/developers/api#endpoint_committee_member

committee_members(query \\ [])

Get a list of all committee members

Example

Govtrack.committee_members

More info at: https://www.govtrack.us/developers/api#endpoint_committee_member

committees(query \\ [])

Get a list of all committees

Example

Govtrack.committees

More info at: https://www.govtrack.us/developers/api#endpoint_committee

cosponsorship(id, query \\ [])

Get information about a specific cosponsorship

Example

Govtrack.cosponsorship(3291427)

More info at: https://www.govtrack.us/developers/api#endpoint_cosponsorship

cosponsorships(query \\ [])

Get a list of all cosponsorships

Example

Govtrack.cosponsorships

More info at: https://www.govtrack.us/developers/api#endpoint_cosponsorship

delete(url, options \\ [])

A shortcut for request(:delete, url, options).

delete!(url, options \\ [])

A shortcut for request!(:delete, url, options).

get(url, options \\ [])

A shortcut for request(:get, url, options).

get!(url, options \\ [])

A shortcut for request!(:get, url, options).

handle_response(response)
head(url, options \\ [])

A shortcut for request(:head, url, options).

head!(url, options \\ [])

A shortcut for request!(:head, url, options).

is_redirect(response)
options(url, options \\ [])

A shortcut for request(:options, url, options).

options!(url, options \\ [])

A shortcut for request!(:options, url, options).

patch(url, options \\ [])

A shortcut for request(:patch, url, options).

patch!(url, options \\ [])

A shortcut for request!(:patch, url, options).

person(id, query \\ [])

Get information about a specific person in U.S. Congress

Example

Govtrack.person(400629)

More info at: https://www.govtrack.us/developers/api#endpoint_person

persons(query \\ [])

Get a list of all persons in U.S. Congress

Example

Govtrack.persons

More info at: https://www.govtrack.us/developers/api#endpoint_person

post(url, options \\ [])

A shortcut for request(:post, url, options).

post!(url, options \\ [])

A shortcut for request!(:post, url, options).

process_options(options)
process_request_body(body)
process_request_headers(headers)
process_response_body(body)
process_response_chunk(chunk)
process_response_headers(headers)
process_response_location(response)
process_status_code(status_code)
process_url(url)
process_url(url, options)
put(url, options \\ [])

A shortcut for request(:put, url, options).

put!(url, options \\ [])

A shortcut for request!(:put, url, options).

request(method, url, options \\ [])

Specs

request(atom, String.t, [{atom, any}]) ::
  %HTTPotion.Response{body: term, headers: term, status_code: term} |
  %HTTPotion.AsyncResponse{id: term} |
  %HTTPotion.ErrorResponse{message: term}

Sends an HTTP request.

Args:

  • method - HTTP method, atom (:get, :head, :post, :put, :delete, etc.)
  • url - URL, binary string or char list
  • options - orddict of options

Options:

  • body - request body, binary string or char list
  • headers - HTTP headers, orddict (eg. ["Accept": "application/json"])
  • timeout - timeout in ms, integer
  • basic_auth - basic auth credentials (eg. {"user", "password"})
  • stream_to - if you want to make an async request, the pid of the process
  • direct - if you want to use ibrowse’s direct feature, the pid of

        the worker spawned by [`spawn_worker_process/2`](#spawn_worker_process/2) or [`spawn_link_worker_process/2`](#spawn_link_worker_process/2)
  • follow_redirects - if true and a response is a redirect, header[:Location] is taken for the next request

Returns HTTPotion.Response or HTTPotion.AsyncResponse if successful. Returns HTTPotion.ErrorResponse if failed.

request(method, url, body, headers, options)

Deprecated form of request; body and headers are now options, see request/3.

request!(method, url, options \\ [])

Specs

request!(atom, String.t, [{atom, any}]) ::
  %HTTPotion.Response{body: term, headers: term, status_code: term} |
  %HTTPotion.AsyncResponse{id: term}

Like request, but raises HTTPotion.HTTPError if failed.

request_direct(conn_pid, method, url, body \\ "", headers \\ [], options \\ [])

Deprecated form of request with the direct option; body and headers are now options, see request/3.

response_ok(response)
role(id, query \\ [])

Get information about a specific role

Example

Govtrack.role(42929)

More info at: https://www.govtrack.us/developers/api#endpoint_role

roles(query \\ [])

Get a list of all roles

Example

Govtrack.roles

More info at: https://www.govtrack.us/developers/api#endpoint_role

spawn_worker_process(url, options \\ [])

Starts a worker process for use with the direct option.

start()

Ensures that HTTPotion and its dependencies are started.

stop_worker_process(pid)

Stops a worker process started with spawn_worker_process/2 or spawn_link_worker_process/2.

transformer(target, method, url, options)
vote(id, query \\ [])

Get information about a specific vote

Example

Govtrack.vote(13969)

More info at: https://www.govtrack.us/developers/api#endpoint_vote

vote_voter(id, query \\ [])

Get information about how a specific voter voted on a roll call vote

Example

Govtrack.vote_voter(31425718)

More info at: https://www.govtrack.us/developers/api#endpoint_vote_voter

vote_voters(query \\ [])

Get a list of all voters in all roll call votes

Example

Govtrack.vote_voter(31425718)

More info at: https://www.govtrack.us/developers/api#endpoint_vote_voter

votes(query \\ [])

Get a list of all votes

Example

Govtrack.votes

More info at: https://www.govtrack.us/developers/api#endpoint_vote