mainstreet 0.2.2 → 0.3.0

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
  SHA256:
3
- metadata.gz: ea141646904d7888483a0d60e3f9a5623459c74b300faa25e400f3f8a8a2da7c
4
- data.tar.gz: b51ba2b961151346b44554ecf1e55be1d88a4a195cd4f8ab1c0738a196473c31
3
+ metadata.gz: 5867c858a7f1d65f8c9783aa870c09ce89b43e60acbc2685803db680a8b77fbf
4
+ data.tar.gz: 0cc41c722a7ab4cc6e452c43594963fb00ee088874886cf7df52e4515c25e541
5
5
  SHA512:
6
- metadata.gz: 6822d52febf092b0901ff62d58dd84084efe9de00fe0da4ef9eefaceb40380b0df9d525786479a34a839dc47f99dae39e665368e89800d135ce1270e5f18e103
7
- data.tar.gz: 0c6c0c6aa26aaa42841d7363b07c769e8b73279ce858bb8382fd499554d7139a2bf1ab2c4e80ad9e0cb17cf551c72b9273aa322d8d831d00ead889b0a93d81a3
6
+ metadata.gz: 70f00a1d95c928f04b6be2b284d3dd3ce33af19539a75138284b938c848af18ec1009402ff3a43df7bdcf1beabc9124944d7feb1ae5fe6b8759bc1059fd1c3fe
7
+ data.tar.gz: 219e737e6d7478227190d721979768fd915ebe56971e1681b41d1a111431692362d388ea5c6dd6ca47a7f51484e643d8481edae043967cfc427d5d8c8c7c011a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.3.0 (2022-10-09)
2
+
3
+ - Dropped support for Ruby < 2.7
4
+
5
+ ## 0.2.3 (2022-02-08)
6
+
7
+ - Added `lookup` option
8
+ - Fixed duplicate API calls for invalid addresses
9
+
1
10
  ## 0.2.2 (2020-04-16)
2
11
 
3
12
  - Fixed bug with SmartyStreets and ZIP code only addresses
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2020 Andrew Kane
3
+ Copyright (c) 2015-2022 Andrew Kane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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://travis-ci.org/ankane/mainstreet.svg?branch=master)](https://travis-ci.org/ankane/mainstreet)
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 'mainstreet'
14
+ gem "mainstreet"
15
15
  ```
16
16
 
17
- ## Full Verification
17
+ ## How It Works
18
18
 
19
- By default, 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:
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"
@@ -142,7 +144,7 @@ We recommend encrypting street information and postal code (at the very least) f
142
144
 
143
145
  ```ruby
144
146
  class User < ApplicationRecord
145
- encrypts :street, :postal_code
147
+ has_encrypted :street, :postal_code
146
148
  end
147
149
  ```
148
150
 
@@ -43,8 +43,10 @@ module MainStreet
43
43
  end
44
44
 
45
45
  def result
46
- @result ||= begin
47
- options = {lookup: lookup}
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)
@@ -1,3 +1,3 @@
1
1
  module MainStreet
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
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.2
4
+ version: 0.3.0
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: 2020-04-16 00:00:00.000000000 Z
11
+ date: 2022-10-10 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
- - !ruby/object:Gem::Dependency
28
- name: bundler
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
@@ -161,15 +49,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
49
  requirements:
162
50
  - - ">="
163
51
  - !ruby/object:Gem::Version
164
- version: '2.2'
52
+ version: '2.7'
165
53
  required_rubygems_version: !ruby/object:Gem::Requirement
166
54
  requirements:
167
55
  - - ">="
168
56
  - !ruby/object:Gem::Version
169
57
  version: '0'
170
58
  requirements: []
171
- rubygems_version: 3.1.2
172
- signing_key:
59
+ rubygems_version: 3.3.7
60
+ signing_key:
173
61
  specification_version: 4
174
62
  summary: Address verification for Ruby and Rails
175
63
  test_files: []