geocode_records 0.1.0 → 0.1.1

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: 2cec9b1bf42ae7aa40359d9a4d84f0ab30273358
4
- data.tar.gz: 6aa1c9fab15253fd0f16b7ba5ba12a3d73390d1e
3
+ metadata.gz: 8c7e219b14eec9ca84501e8e816d9509b5c5b4a6
4
+ data.tar.gz: 2655080db277f56a6c079d952c3fecd32bba9907
5
5
  SHA512:
6
- metadata.gz: 805f6cf61202f52be4078e6df883ddefc8eee9cb559742ee912fd9f5b1469f2c06de840218030f8ab1b682254dca515eaec2a5f57b66dc76b5fea00b9eeb8112
7
- data.tar.gz: 17fbb907970b4bc2608250598366159dd5501f14568bb649c3070f5b67b27314fe8e16d1e1013de21e2539c3466a85825664e62078d9cafb2745994ed154290a
6
+ metadata.gz: 5a56b58bad11648b5706e6af03a9e4406d2f9128d72f3ca85395bfdf8799ef12a522d4a6528f185a2113e23acb47f8ea0657ebdde14eae2224bc95a98b7e7cf7
7
+ data.tar.gz: a4407de14279b949e9aea326e7c2f9a16045789df69cfdc616df8bbf8b8465cbada07db93351af9d60100d1207fb687d85003b5d7d6dec23bb2388660fc9a721
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.1.1 / 2016-03-16
2
+
3
+ * Enhancements
4
+
5
+ * Overwrite provided city with SmartyStreet's default_city_name
6
+
1
7
  0.1.0 / 2016-02-01
2
8
 
3
9
  * Enhancements
@@ -90,6 +90,7 @@ class GeocodeRecords
90
90
  'postcode' => 'ss_zipcode',
91
91
  'latitude' => 'ss_latitude',
92
92
  'longitude' => 'ss_longitude',
93
+ 'default_city' => 'ss_default_city_name',
93
94
  }.freeze
94
95
 
95
96
  def recode_columns
@@ -19,6 +19,9 @@ class GeocodeRecords
19
19
  if hn = row['house_number']
20
20
  row['house_number'] = hn.to_i
21
21
  end
22
+ if default_city = row.delete('default_city')
23
+ row['city'] = default_city
24
+ end
22
25
  selector = { id: row.delete('id') }
23
26
  setter = row
24
27
  upsert.row selector, setter
@@ -1,3 +1,3 @@
1
1
  class GeocodeRecords
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -111,6 +111,20 @@ describe GeocodeRecords do
111
111
  expect(home.house_number_and_street).to eq('1039 E Dayton St')
112
112
  end
113
113
 
114
+ it "overwrites unit" do
115
+ home = Home.create! house_number_and_street: '123 n blount st apt 403', city: 'madison', state: 'wisconsin'
116
+ GeocodeRecords.new(Home.all, include_invalid: true).perform
117
+ home.reload
118
+ expect(home.house_number_and_street).to eq('123 N Blount St Unit 403')
119
+ end
120
+
121
+ it "overwrites city name with default_city_name" do
122
+ home = Home.create! house_number_and_street: '7333 Bay Bridge Rd', city: 'eastvale', state: 'ca'
123
+ GeocodeRecords.new(Home.all, include_invalid: true).perform
124
+ home.reload
125
+ expect(home.city).to eq('Corona')
126
+ end
127
+
114
128
  describe 'known issues' do
115
129
  it "doesn't fix float-format postcode on records that it can't geocode" do
116
130
  home = Home.create! house_number_and_street: 'gibberish', postcode: '53703.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocode_records
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord