Census v0.1.3 Census.Query View Source
Struct representing an API query.
Link to this section Summary
Link to this section Types
Link to this type
t()
View Source
t() :: %Census.Query{client: term, foreach: term, get: term, within: term}
Link to this section Functions
Link to this function
new(client, params)
View Source
new(Census.Client.t, Keyword.t) :: Census.Query.t
Create a new query.
Usage:
iex> client = Census.Client.new("YOUR_API_KEY")
iex> Census.Query.new(client, get: "NAME,P0010001", foreach: "COUNTY:*", within: "STATE:55")
%Census.Query{
client: %Census.Client{api_key: "YOUR_API_KEY", dataset: "SF1", vintage: "2010"},
foreach: "COUNTY:*",
get: "NAME,P0010001",
within: "STATE:55"
}
Returns the api url for a given query.
Usage:
iex> client = Census.Client.new("YOUR_API_KEY")
iex> query = Census.Query.new(client, get: "NAME", foreach: "COUNTY:*", within: "STATE:55")
iex> Census.Query.url(query)
"http://api.census.gov/data/2010/sf1?key=YOUR_API_KEY&get=NAME&for=COUNTY:*&in=STATE:55"