geocode_records 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/geocode_records.gemspec +2 -0
- data/lib/geocode_records/smarty_streets.rb +7 -1
- data/lib/geocode_records/version.rb +1 -1
- data/lib/geocode_records.rb +1 -1
- data/package.json +1 -1
- data/spec/geocode_records/smarty_streets_spec.rb +2 -8
- data/spec/geocode_records_spec.rb +26 -0
- data/spec/spec_helper.rb +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97c3fbf26bb7ebaec1fac57e9212476b1a3ddf64
|
4
|
+
data.tar.gz: b98b65636292d3b74f53f6045aaacfac99784b07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca4fdc59c870dab258bd10de6c8bcdc10ba7120b6bfa5f620cb7f67249cffd47b8936116326991c09df85cc870479a4d8c4e74d37df9935ed8bf02e7f899cb2
|
7
|
+
data.tar.gz: 47723ada9b16c31654080114a01de9899e7457e4e5022f71510525515322632e78fd9620dacf56adb489012cf2fd98eeae5de1fbc9fe5b42d4023cbc033ef513
|
data/CHANGELOG
CHANGED
data/geocode_records.gemspec
CHANGED
@@ -2,6 +2,8 @@ class GeocodeRecords
|
|
2
2
|
|
3
3
|
module SmartyStreets
|
4
4
|
|
5
|
+
VERSION = '1.6.2'
|
6
|
+
|
5
7
|
def self.bin_path
|
6
8
|
@bin_path ||= if File.exist?('node_modules/.bin/smartystreets')
|
7
9
|
'node_modules/.bin/smartystreets'
|
@@ -10,10 +12,14 @@ class GeocodeRecords
|
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
15
|
+
def self.check_compatible!
|
16
|
+
raise "smartystreets >= #{VERSION} is required" unless SmartyStreets.compatible?
|
17
|
+
end
|
18
|
+
|
13
19
|
def self.compatible?
|
14
20
|
output = run_with_output('-V')
|
15
21
|
current_version = Gem::Version.new output.chomp
|
16
|
-
min_version = Gem::Version.new
|
22
|
+
min_version = Gem::Version.new VERSION
|
17
23
|
current_version >= min_version
|
18
24
|
end
|
19
25
|
|
data/lib/geocode_records.rb
CHANGED
data/package.json
CHANGED
@@ -21,14 +21,8 @@ describe GeocodeRecords::SmartyStreets do
|
|
21
21
|
it { is_expected.to be false }
|
22
22
|
end
|
23
23
|
|
24
|
-
context 'v1.
|
25
|
-
let(:version) { '1.
|
26
|
-
|
27
|
-
it { is_expected.to be false }
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'v1.5.0' do
|
31
|
-
let(:version) { '1.5.0' }
|
24
|
+
context 'v1.6.2' do
|
25
|
+
let(:version) { '1.6.2' }
|
32
26
|
|
33
27
|
it { is_expected.to be true }
|
34
28
|
end
|
@@ -23,6 +23,22 @@ unless ENV['FAST'] == 'true'
|
|
23
23
|
longitude float
|
24
24
|
)
|
25
25
|
SQL
|
26
|
+
psql.command <<-SQL
|
27
|
+
CREATE TABLE glob_homes (
|
28
|
+
id serial primary key,
|
29
|
+
glob text,
|
30
|
+
the_geom geometry(Geometry,4326),
|
31
|
+
the_geom_webmercator geometry(Geometry,3857),
|
32
|
+
house_number_and_street text,
|
33
|
+
house_number int,
|
34
|
+
unit_number text,
|
35
|
+
city text,
|
36
|
+
state text,
|
37
|
+
postcode text,
|
38
|
+
latitude float,
|
39
|
+
longitude float
|
40
|
+
)
|
41
|
+
SQL
|
26
42
|
end
|
27
43
|
|
28
44
|
require 'active_record'
|
@@ -35,6 +51,8 @@ end
|
|
35
51
|
|
36
52
|
class Home < ActiveRecord::Base
|
37
53
|
end
|
54
|
+
class GlobHome < ActiveRecord::Base
|
55
|
+
end
|
38
56
|
|
39
57
|
describe GeocodeRecords do
|
40
58
|
it 'has a version number' do
|
@@ -48,6 +66,14 @@ describe GeocodeRecords do
|
|
48
66
|
expect(home.house_number_and_street).to eq('1038 E Dayton St')
|
49
67
|
end
|
50
68
|
|
69
|
+
it "geocodes an AR::Relation with just a glob" do
|
70
|
+
home = GlobHome.create! glob: '1038 e dayton st, madison, wi 53703'
|
71
|
+
GeocodeRecords.new(GlobHome.all, glob: true).perform
|
72
|
+
home.reload
|
73
|
+
expect(home.house_number_and_street).to eq('1038 E Dayton St')
|
74
|
+
expect(home.postcode).to eq('53703')
|
75
|
+
end
|
76
|
+
|
51
77
|
it "doesn't break on float-format postcode" do
|
52
78
|
home = Home.create! house_number_and_street: '1038 e deyton st', postcode: '53703.0'
|
53
79
|
GeocodeRecords.new(Home.all).perform
|
data/spec/spec_helper.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description: A quick way to re-geocode a table
|
140
154
|
email:
|
141
155
|
- seamus@abshere.net
|