geocode_records 1.2.0 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1bb6e6ee4a30c021bd9f73c98b924c8036dbab8
4
- data.tar.gz: 25397fe6679e1252f8e65d5b9c0c53dfc01f7dc5
3
+ metadata.gz: '0029323e5f514aa576ae5e004ef8cf67cf2bf7ad'
4
+ data.tar.gz: 0d259095fec73b543de21b9dc4dc29df6c86b235
5
5
  SHA512:
6
- metadata.gz: 35ba47791b0b92eee27adffb5c158e6c15e7bbcd3c84e160ba910e41e2d28f9b421cb9a2d484b1e35d66ef9355d3aadc6d6e0f25d5dc78d3d2431ed28cab9b02
7
- data.tar.gz: 152742e01ff0060af7f3e45d7ec0f17fee6ab64a29a3fc631cabb0776df9275707cc30e273bf2f295d8b42b4a76ee43c0bc2cbe60a47455c099a5581c5fab874
6
+ metadata.gz: 4b3cd140b300378d863d75b3ed627970144e46933f36baa59efdfa909b4f424f175fcf761a008fee7f011995bb694cb3a39991c718ba163fff7fa60b0e9f039b
7
+ data.tar.gz: 5fb84c6b8f813a02738f5bde02a497051e915ece5b59c90ce59454860a4fd714f2179618f323082aeb033007af851a90cd87cb98fad536909dc8161fcc411eb6
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.3.0 / 2018-02-22
2
+
3
+ * Breaking changes
4
+
5
+ * Set street/street2
6
+
1
7
  1.2.0 / 2018-02-14
2
8
 
3
9
  * Breaking changes
@@ -11,6 +11,10 @@ class GeocodeRecords
11
11
  COLUMN_DEFINITION = {
12
12
  delivery_line_1: true,
13
13
  components: {
14
+ street_predirection: true,
15
+ street_name: true,
16
+ street_suffix: true,
17
+ street_postdirection: true,
14
18
  primary_number: true,
15
19
  secondary_number: true,
16
20
  city_name: true,
@@ -3,6 +3,10 @@ class GeocodeRecords
3
3
  CREATE_TABLE_SQL = (<<-SQL).gsub(' ', '').freeze
4
4
  CREATE TABLE $TMP_TABLE_NAME (
5
5
  id uuid primary key,
6
+ ss_street_predirection text,
7
+ ss_street_name text,
8
+ ss_street_suffix text,
9
+ ss_street_postdirection text,
6
10
  ss_delivery_line_1 text,
7
11
  ss_primary_number text,
8
12
  ss_secondary_number text,
@@ -18,6 +22,10 @@ class GeocodeRecords
18
22
 
19
23
  DESIRED_COLUMNS = %w{
20
24
  id
25
+ ss_street_predirection
26
+ ss_street_name
27
+ ss_street_suffix
28
+ ss_street_postdirection
21
29
  ss_delivery_line_1
22
30
  ss_primary_number
23
31
  ss_secondary_number
@@ -35,6 +43,7 @@ class GeocodeRecords
35
43
  UPDATE_TABLE_SQL = (<<-SQL).gsub(' ', '').freeze
36
44
  UPDATE $TABLE_NAME AS target
37
45
  SET
46
+ street$NUM_SUFFIX = concat_ws(' ', src.ss_street_predirection, src.ss_street_name, src.ss_street_suffix, src.ss_street_postdirection),
38
47
  house_number_and_street$NUM_SUFFIX = src.ss_delivery_line_1,
39
48
  house_number$NUM_SUFFIX = CASE
40
49
  WHEN src.ss_primary_number IS NULL THEN NULL
@@ -1,3 +1,3 @@
1
1
  class GeocodeRecords
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -4,18 +4,24 @@ describe GeocodeRecords do
4
4
  subject { GeocodeRecords.new(database_url: ENV.fetch('DATABASE_URL'), table_name: 'homes').perform }
5
5
 
6
6
  it "geocodes" do
7
- home = Home.create! house_number_and_street: '1038 e deyton st', postcode: '53703'
7
+ home = Home.create! house_number_and_street: '123 n blount st apt 403', postcode: '53703'
8
8
  subject
9
9
  home.reload
10
- expect(home.house_number_and_street).to eq('1038 E Dayton St')
10
+ expect(home.house_number_and_street).to eq('123 N Blount St Unit 403')
11
+ expect(home.street).to eq('N Blount St')
12
+ expect(home.unit_number).to eq('403')
13
+ expect(home.house_number).to eq(123)
11
14
  expect(home.latitude).to be_present
12
15
  end
13
16
 
14
17
  it "geocodes addr 2" do
15
- home = Home.create! house_number_and_street2: '1038 e deyton st', postcode2: '53703'
18
+ home = Home.create! house_number_and_street2: '123 n blount st apt 403', postcode2: '53703'
16
19
  GeocodeRecords.new(database_url: ENV.fetch('DATABASE_URL'), table_name: 'homes', num: 2).perform
17
20
  home.reload
18
- expect(home.house_number_and_street2).to eq('1038 E Dayton St')
21
+ expect(home.house_number_and_street2).to eq('123 N Blount St Unit 403')
22
+ expect(home.street2).to eq('N Blount St')
23
+ expect(home.unit_number2).to eq('403')
24
+ expect(home.house_number2).to eq(123)
19
25
  expect(home.latitude2).to be_present
20
26
  end
21
27
 
data/spec/spec_helper.rb CHANGED
@@ -22,6 +22,7 @@ unless ENV['FAST'] == 'true'
22
22
  the_geom geometry(Geometry,4326),
23
23
  the_geom_webmercator geometry(Geometry,3857),
24
24
  glob text,
25
+ street text,
25
26
  house_number_and_street text,
26
27
  house_number int,
27
28
  unit_number text,
@@ -32,6 +33,7 @@ unless ENV['FAST'] == 'true'
32
33
  latitude float,
33
34
  longitude float,
34
35
  glob2 text,
36
+ street2 text,
35
37
  house_number_and_street2 text,
36
38
  house_number2 int,
37
39
  unit_number2 text,
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: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-14 00:00:00.000000000 Z
11
+ date: 2018-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport