census_api 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c53cd28cfb5e25ffe09f1b7cb9b3e65f4dc350a4
4
- data.tar.gz: 1ddefcdec5e8a53be784ed65afa4be1b72886076
3
+ metadata.gz: 4c6080f79695746c9da16b9a6a39eaaeb8f8932d
4
+ data.tar.gz: bb8d0ce3088e0c78fc36beba6b8bed9b1b95a604
5
5
  SHA512:
6
- metadata.gz: b186c3a3ce6f225680c9b6693feda4300cfe94b5d8d20b63594c99c99f81afce952f4147011c145f3ee7c808353634ea47b27920440ec1f541b33eb214c17db7
7
- data.tar.gz: 2ac5084552f5b1616fc19ff0c87d8116b774a36eff680a17f1d98cc46d599a1673a92f70e0c8788f7d38e2a6a8bcaf3480ce26bb59dcb3947a2ad8fcc723091b
6
+ metadata.gz: bde1d5a14e91651c1b29156fa4ddb23a9fc05c5206a2a42d9f28b7e2e968d38e0a7ec11bb696f619d6c6f3253f5956738d033e85fdae9103ce657d49f9b32889
7
+ data.tar.gz: 88a0931b9c90edde163cf67c6711e2b483ae0f5b951a9585e49912007c0a9ae002843f62e1aa9ac4c2c0b63f39a35a79a32b70f3cb9c58beba612b3197914d7f
@@ -20,10 +20,10 @@ module CensusApi
20
20
  fields = options[:fields]
21
21
  fields = fields.split(',').push('NAME').join(',') if fields.is_a? String
22
22
  fields = fields.push('NAME').join(',') if fields.is_a? Array
23
- level = format(options[:level], false)
23
+ level = format(options[:level], false, source)
24
24
  params = { key: options[:key], get: fields, for: level }
25
25
  unless (options[:within].nil? || (options[:within].is_a?(Array) && options[:within].compact.empty?))
26
- params.merge!(in: format(options[:within][0], true))
26
+ params.merge!(in: format(options[:within][0], true, source))
27
27
  end
28
28
  options.merge!(vintage: 2010) unless options[:vintage]
29
29
  request = new(options[:vintage], source, params)
@@ -61,11 +61,12 @@ module CensusApi
61
61
  }
62
62
  end
63
63
 
64
- def self.format(str, truncate)
64
+ def self.format(str, truncate, source=nil)
65
65
  result = str.split('+').map do |s|
66
66
  s = s.match(':') ? s.split(':') : [s, '*']
67
67
  shp = shapes[s[0].upcase]
68
- s.shift && s.unshift(shp['name'].downcase.gsub(' ', '+')) unless shp.nil?
68
+ name = shp[[source,'name'].compact.join("_")]||shp['name']
69
+ s.shift && s.unshift(name.downcase.gsub(' ', '+')) unless shp.nil?
69
70
  s.unshift(s.shift.split('/')[0]) if !s[0].scan('home+land').empty? && truncate
70
71
  s.join(':')
71
72
  end
@@ -1,4 +1,4 @@
1
1
  # => CensusApi::Version
2
2
  module CensusApi
3
- VERSION = '1.1.1'
3
+ VERSION = '1.2.0'
4
4
  end
@@ -21,6 +21,7 @@ SUBMCD:
21
21
  sumlevel: '067'
22
22
  slug: SUBMCD
23
23
  name: Subminor Civil Subdivision
24
+ acs5_name: Subminor Civil Division
24
25
  description: state-county-county subdivision-subminor civil subdivision
25
26
  path: SUBMCD/2010
26
27
  TABBLOCK:
@@ -63,8 +63,8 @@ module CensusExamples
63
63
  ['B00001_001E', 'COUNTY:001', 'STATE:06'],
64
64
  ['B00001_001E', 'COUSUB', 'STATE:02+COUNTY:290'],
65
65
  ['B00001_001E', 'COUSUB:86690', 'STATE:02+COUNTY:290'],
66
- #['B00001_001E', 'SUBMCD', 'STATE:72+COUNTY:127+COUSUB:79693'],
67
- #['B00001_001E', 'SUBMCD:02350', 'STATE:72+COUNTY:127+COUSUB:79693'],
66
+ ['B00001_001E', 'SUBMCD', 'STATE:72+COUNTY:127+COUSUB:79693'],
67
+ ['B00001_001E', 'SUBMCD:02350', 'STATE:72+COUNTY:127+COUSUB:79693'],
68
68
  ['B00001_001E', 'PLACE', 'STATE:02+COUNTY:290+COUSUB:86690'],
69
69
  ['B00001_001E', 'PLACE:05750', 'STATE:02+COUNTY:290+COUSUB:86690'],
70
70
  ['B00001_001E', 'TRACT', 'STATE:02+COUNTY:290+COUSUB:86690+PLACE:05750'],
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.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Rauber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http