us_address_client 1.0.0 → 1.0.1
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 +4 -4
- data/README.md +29 -1
- data/lib/us_address_client/client.rb +5 -5
- data/lib/us_address_client/version.rb +1 -1
- data/test/test_helper.rb +0 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27acc4f00de10dcbcec7f1663cc173a66bc8ee64902d1ea994b41f5608ae4c1d
|
4
|
+
data.tar.gz: 2991960b197b2691b9df07a3782fe34f1d2e954391902f189cc223c73313a7d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 793452b1d5f58647a6310145d8c22a7b72f8baef055a7384532f1c5d116ead042f45fbcf22ce99a8e36eba7fd83c91f2a1bdc02e609ca868b7fff5aec93c604e
|
7
|
+
data.tar.gz: d402b97533741a2cd7f17a433c023939f0bfec85a3e597e8bf3a46a20c358656057fd85b2aeb483631544d5669a8cd1a21f38c559385aee8c8dad83d3d96c6de
|
data/README.md
CHANGED
@@ -97,7 +97,6 @@ us_address_client:
|
|
97
97
|
|
98
98
|
#### Notes:
|
99
99
|
|
100
|
-
- If `url` is not supplied then it will fall back to the local melissa data installation using the `melissa` gem.
|
101
100
|
- Configuration changes _must_ be made prior to any calls being made to this service.
|
102
101
|
|
103
102
|
### Logging
|
@@ -163,3 +162,32 @@ Output:
|
|
163
162
|
2018-12-19 19:34:08.134716 D [28643:70323013957920 transport.rb:25] (16.6ms) USAddressClient -- #http_get -- { :path => "/address?address=2811+Safe+Harbor+Drive&city=Tampa&state=FL&zip=33618" }
|
164
163
|
2018-12-19 19:34:08.134845 I [28643:70323013957920 client.rb:8] (16.8ms) USAddressClient -- #verify -- { :input => { :address => "2811 Safe Harbor Drive", :city => "Tampa", :state => "FL", :zip => "33618" }, :output => { :zip => "33618", :time_zone_code => "05", :time_zone => "Eastern Time", :suite_range => "", :suite_name => "", :suite => "", :suffix => "Dr", :street_name => "Safe Harbor", :state => "FL", :result_codes => [ "AS01" ], :private_mailbox_number => "", :private_mailbox_name => "", :pre_direction => "", :post_direction => "", :plus4 => "4534", :melissa_address_key_base => "", :melissa_address_key => "", :garbage => "", :delivery_point => "33618453411", :city => "Tampa", :address_type_code => "S", :address_type => "Street", :address_range => "2811", :address2 => "", :address => "2811 Safe Harbor Dr" } }
|
165
164
|
~~~
|
165
|
+
|
166
|
+
## Customizing what is a good or bad address
|
167
|
+
|
168
|
+
Melissa Data returns good and bad codes after verifying the address.
|
169
|
+
|
170
|
+
By default the following codes need to be returned before the address is considered valid:
|
171
|
+
- AS01
|
172
|
+
- AS02
|
173
|
+
- AS03
|
174
|
+
|
175
|
+
To override these codes, set the `good_codes` value in secret config as a list of comma separated values:
|
176
|
+
|
177
|
+
~~~yaml
|
178
|
+
us_address_client:
|
179
|
+
url: http://address.service.test.com
|
180
|
+
good_codes: "AS01, AS02, AS03, AS20"
|
181
|
+
~~~
|
182
|
+
|
183
|
+
Even if a good code is returned, by default the following codes will force the result to be considered invalid:
|
184
|
+
- AC02
|
185
|
+
- AC03
|
186
|
+
|
187
|
+
To override these codes, set the `bad_codes` value in secret config as a list of comma separated values:
|
188
|
+
|
189
|
+
~~~yaml
|
190
|
+
us_address_client:
|
191
|
+
url: http://address.service.test.com
|
192
|
+
bad_codes: "AS03, AS09, AS16, AS17, AS24, AE01, AE02, AE03, AE04, AE05, AE07, AE10, AE11, AE12, AE13, AE14"
|
193
|
+
~~~
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "date"
|
2
|
+
require "sync_attr"
|
2
3
|
|
3
4
|
module USAddressClient
|
4
5
|
class Client
|
@@ -6,7 +7,6 @@ module USAddressClient
|
|
6
7
|
# Once created a mutex is not used again since there is no writer accessor.
|
7
8
|
sync_cattr_reader :http do
|
8
9
|
OpinionatedHTTP.new(
|
9
|
-
header: {"Content-Type" => "application/json"},
|
10
10
|
secret_config_prefix: "us_address_client",
|
11
11
|
metric_prefix: "USAddressClient",
|
12
12
|
logger: USAddressClient.logger,
|
@@ -17,8 +17,8 @@ module USAddressClient
|
|
17
17
|
def self.verify(input_address)
|
18
18
|
return AddressMock.new(input_address) if USAddressClient.mocked?
|
19
19
|
|
20
|
-
response = http.get(action: "address", parameters: input_address)
|
21
|
-
hash = Parser.parse_verify_response(response)
|
20
|
+
response = http.get(action: "address", parameters: input_address, headers: {"Content-Type" => "application/json"})
|
21
|
+
hash = Parser.parse_verify_response(response.body!)
|
22
22
|
USAddressClient.logger.trace(payload: hash)
|
23
23
|
Address.new(hash, true)
|
24
24
|
end
|
@@ -32,8 +32,8 @@ module USAddressClient
|
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
|
-
response = http.get(action: "version")
|
36
|
-
Parser.parse_version_response(response)
|
35
|
+
response = http.get(action: "version", headers: {"Content-Type" => "application/json"})
|
36
|
+
Parser.parse_version_response(response.body!)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: us_address_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opinionated_http
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: secret_config
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.3.7
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: US Address Service Client
|