mainstreet 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +6 -4
- data/lib/mainstreet/address_verifier.rb +4 -6
- data/lib/mainstreet/version.rb +1 -1
- data/lib/mainstreet.rb +10 -0
- metadata +8 -120
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08e1a7061a00946e499902c0eab2b4a9ab51971a69ab722626b89047aa4c1eca'
|
4
|
+
data.tar.gz: e7696455f9372bdb90b889fb8193a499f992a6ecc3b1a6c51fc2c1cf732ca0ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a5c7b6147226624d4492df51bde93d1ae3c35f3da48a3f2e5730f8e649011e1108e13bdf2469e32feae23e722140721907a029d9343c3d8d52f9aef653cc3f
|
7
|
+
data.tar.gz: 52038f683d0fa478446c4a04d1a74aa545bac6f75b54d9bc98a5827855374ca88383e9deb32ae3479269e742765bb06b75dca6249f7dad786ce601cb69f480ed
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,19 +4,21 @@ Address verification for Ruby and Rails
|
|
4
4
|
|
5
5
|
:earth_americas: Supports international addresses
|
6
6
|
|
7
|
-
[![Build Status](https://
|
7
|
+
[![Build Status](https://github.com/ankane/mainstreet/workflows/build/badge.svg?branch=master)](https://github.com/ankane/mainstreet/actions)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
Add this line to your application’s Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem
|
14
|
+
gem "mainstreet"
|
15
15
|
```
|
16
16
|
|
17
|
-
##
|
17
|
+
## How It Works
|
18
18
|
|
19
|
-
|
19
|
+
MainStreet uses [Geocoder](https://github.com/alexreisner/geocoder) for address verification, which has a number of [3rd party services](https://github.com/alexreisner/geocoder/blob/master/README_API_GUIDE.md#global-street-address-lookups) you can use. If you adhere to GDPR, be sure to add the service to your subprocessor list.
|
20
|
+
|
21
|
+
With some services, bad street numbers, units, and postal codes may pass verification. For full verification, get an account with [SmartyStreets](https://smartystreets.com). The free plan supports 250 lookups per month for US addresses, and plans for international addresses start at $7. To use it, set:
|
20
22
|
|
21
23
|
```ruby
|
22
24
|
ENV["SMARTY_STREETS_AUTH_ID"] = "auth-id"
|
@@ -43,8 +43,10 @@ module MainStreet
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def result
|
46
|
-
@result
|
47
|
-
|
46
|
+
return @result if defined?(@result)
|
47
|
+
|
48
|
+
@result = begin
|
49
|
+
options = {lookup: MainStreet.lookup}
|
48
50
|
options[:country] = @country if @country && !usa?
|
49
51
|
# don't use smarty streets zipcode only API
|
50
52
|
# keep mirrored with geocoder gem, including \Z
|
@@ -69,10 +71,6 @@ module MainStreet
|
|
69
71
|
["United States", "USA", "US", "840"].include?(@country.to_s)
|
70
72
|
end
|
71
73
|
|
72
|
-
def lookup
|
73
|
-
ENV["SMARTY_STREETS_AUTH_ID"] ? :smarty_streets : nil
|
74
|
-
end
|
75
|
-
|
76
74
|
def message(key, default)
|
77
75
|
if defined?(I18n)
|
78
76
|
I18n.t(key, scope: [:mainstreet, :errors, :messages], locale: @locale, default: default)
|
data/lib/mainstreet/version.rb
CHANGED
data/lib/mainstreet.rb
CHANGED
@@ -5,6 +5,16 @@ require "geocoder"
|
|
5
5
|
require "mainstreet/address_verifier"
|
6
6
|
require "mainstreet/version"
|
7
7
|
|
8
|
+
module MainStreet
|
9
|
+
class << self
|
10
|
+
attr_writer :lookup
|
11
|
+
|
12
|
+
def lookup
|
13
|
+
@lookup ||= ENV["SMARTY_STREETS_AUTH_ID"] ? :smarty_streets : nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
8
18
|
if ENV["SMARTY_STREETS_AUTH_ID"]
|
9
19
|
Geocoder.config[:smarty_streets] ||= {
|
10
20
|
api_key: [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mainstreet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: geocoder
|
@@ -24,120 +24,8 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.5.1
|
27
|
-
|
28
|
-
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: activerecord
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: i18n
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: sqlite3
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: vcr
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: webmock
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
description:
|
140
|
-
email: andrew@chartkick.com
|
27
|
+
description:
|
28
|
+
email: andrew@ankane.org
|
141
29
|
executables: []
|
142
30
|
extensions: []
|
143
31
|
extra_rdoc_files: []
|
@@ -153,7 +41,7 @@ homepage: https://github.com/ankane/mainstreet
|
|
153
41
|
licenses:
|
154
42
|
- MIT
|
155
43
|
metadata: {}
|
156
|
-
post_install_message:
|
44
|
+
post_install_message:
|
157
45
|
rdoc_options: []
|
158
46
|
require_paths:
|
159
47
|
- lib
|
@@ -168,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
56
|
- !ruby/object:Gem::Version
|
169
57
|
version: '0'
|
170
58
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
-
signing_key:
|
59
|
+
rubygems_version: 3.3.3
|
60
|
+
signing_key:
|
173
61
|
specification_version: 4
|
174
62
|
summary: Address verification for Ruby and Rails
|
175
63
|
test_files: []
|