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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfc6e01f883ce3a016471d9e3f74198bf47a341a
4
- data.tar.gz: d48772e3d9cd635d3adf03c83871ffd3a467a6e5
3
+ metadata.gz: 97c3fbf26bb7ebaec1fac57e9212476b1a3ddf64
4
+ data.tar.gz: b98b65636292d3b74f53f6045aaacfac99784b07
5
5
  SHA512:
6
- metadata.gz: 0ba48446ffa487e0195415d59955da64ef112349583033f508d78e9c4aa9c236a64e9a50394cd1afdb7abe17ef1941babfb943fbf9ee9a959168118250651092
7
- data.tar.gz: a821dba02207e2eb881404555e7294d677309bb4a63aad4987fdf85351e62b7a37f770b2c32fe10da95e8b0e52c267d4a2381b475087dc2fcbda0a0aa3543385
6
+ metadata.gz: 1ca4fdc59c870dab258bd10de6c8bcdc10ba7120b6bfa5f620cb7f67249cffd47b8936116326991c09df85cc870479a4d8c4e74d37df9935ed8bf02e7f899cb2
7
+ data.tar.gz: 47723ada9b16c31654080114a01de9899e7457e4e5022f71510525515322632e78fd9620dacf56adb489012cf2fd98eeae5de1fbc9fe5b42d4023cbc033ef513
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.0.5 / 2015-07-16
2
+
3
+ * Enhancements
4
+
5
+ * Can now do single-line addresses with glob: true
6
+
1
7
  0.0.4 / 2015-06-02
2
8
 
3
9
  * Enhancements
@@ -28,4 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "bundler", "~> 1.7"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "pry"
32
+
31
33
  end
@@ -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 '1.5.0'
22
+ min_version = Gem::Version.new VERSION
17
23
  current_version >= min_version
18
24
  end
19
25
 
@@ -1,3 +1,3 @@
1
1
  class GeocodeRecords
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -19,7 +19,7 @@ class GeocodeRecords
19
19
  end
20
20
 
21
21
  def perform
22
- raise "smartystreets >= 1.5.0 is required" unless SmartyStreets.compatible?
22
+ SmartyStreets.check_compatible!
23
23
 
24
24
  if records.count > 0
25
25
  # $stderr.puts "GeocodeRecords: #{records.count} to go!"
data/package.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "name": "rolodeck",
3
3
  "private": true,
4
4
  "dependencies": {
5
- "smartystreets": "^1.5.0"
5
+ "smartystreets": "^1.6.2"
6
6
  }
7
7
  }
@@ -21,14 +21,8 @@ describe GeocodeRecords::SmartyStreets do
21
21
  it { is_expected.to be false }
22
22
  end
23
23
 
24
- context 'v1.3.2' do
25
- let(:version) { '1.3.2' }
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
@@ -1,2 +1,4 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'geocode_records'
3
+
4
+ require 'pry'
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
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-06-02 00:00:00.000000000 Z
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