census_api 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/census_api/client.rb +2 -1
- data/lib/census_api/version.rb +1 -1
- data/spec/census_api/client_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1e42362ccc80926634c273b9a7a1eb5372226b0
|
4
|
+
data.tar.gz: 82964eda9cfe6f7d764f96575882c57e41133e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982d9a504da1de9f2254dc0eb2116e647228a6c1447564fb3e9c101b0e601a0bdf6dbcebf9bd8efac888a0b3ea60fc08a7c020bbd70835e3336cc4f2b6529935
|
7
|
+
data.tar.gz: 7493ed0eb2d8a301ed7032321c15d0833600e6325425dfc8e8c392b7eefdcf5899cf3e3874438c595b0d49b4156367dc960a49589143fe2313ed218da1a79b75
|
data/lib/census_api/client.rb
CHANGED
@@ -19,6 +19,7 @@ module CensusApi
|
|
19
19
|
end
|
20
20
|
|
21
21
|
@api_key = api_key
|
22
|
+
@api_vintage = options[:vintage] || 2010
|
22
23
|
if options[:dataset]
|
23
24
|
@dataset = options[:dataset].downcase if DATASETS.include? options[:dataset].downcase
|
24
25
|
end
|
@@ -26,7 +27,7 @@ module CensusApi
|
|
26
27
|
|
27
28
|
def find(fields, level, *within)
|
28
29
|
raise "Client has not been assigned a dataset to query. Try @client.dataset = 'SF1' or anything from #{DATASETS}" if self.dataset.nil?
|
29
|
-
Request.find(dataset, {key: @api_key, fields: fields, level: level, within: within})
|
30
|
+
Request.find(dataset, {key: @api_key, vintage: @api_vintage, fields: fields, level: level, within: within})
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/census_api/version.rb
CHANGED
@@ -28,14 +28,14 @@ describe CensusApi::Client do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should request sf1' do
|
31
|
-
source, options = 'sf1', {:key=> api_key, :fields => 'P0010001', :level => 'STATE:06', :within=>[]}
|
31
|
+
source, options = 'sf1', {:key=> api_key, :vintage => 2010, :fields => 'P0010001', :level => 'STATE:06', :within=>[]}
|
32
32
|
@client = CensusApi::Client.new(api_key, dataset: source)
|
33
33
|
CensusApi::Request.should_receive(:find).with(@client.dataset, options)
|
34
34
|
@client.find(options[:fields], options[:level])
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should request acs5' do
|
38
|
-
source, options = 'acs5', {:key=> api_key, :fields => 'B00001_001E', :level => 'STATE:06', :within=>[]}
|
38
|
+
source, options = 'acs5', {:key=> api_key, :vintage => 2010, :fields => 'B00001_001E', :level => 'STATE:06', :within=>[]}
|
39
39
|
@client = CensusApi::Client.new(api_key, dataset: source)
|
40
40
|
CensusApi::Request.should_receive(:find).with(@client.dataset, options)
|
41
41
|
@client.find(options[:fields], options[:level])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: census_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ty Rauber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|