validate-address-smartystreets 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69d8d9f663282bc21a0a16b51c33e48a9c9cbff2
4
- data.tar.gz: 826da51218588fa0d3fe4076e9e03c74f67a8528
3
+ metadata.gz: a52ef2cd4703a43fd621771582b1a069cc6e80db
4
+ data.tar.gz: a4cc063dcc1deb07caadce6a2ac8116d2f57f2a8
5
5
  SHA512:
6
- metadata.gz: 645a26cc0acbe2921d77563d64bbf69549a558ce9ea3921373b2bd4ea2689a1430542b5798ae7de46c49b836288a1541fe0f0dfdb667bd57dc8566784f4eafba
7
- data.tar.gz: 3b262f7865d459d2afa364dcee07746832a003a077fb4af7cfef1b2336fbc469503df82059ef638bd77db9c4da5c08108134182e7d55ae0a7528b1c0b5d6246b
6
+ metadata.gz: 88f4cc2bbf1604259ff7bbc3334bfb7b13ffa0a962df4d8aefb44bc67d2a465c4f508f8f7b36a2d13da890db316cf73489a9a630c9aaf3b702a01eee7468b8ed
7
+ data.tar.gz: e707ff5e51855bbfee5cb098cfd2e869efeb4200e8b43a936805ce165937099576ef135c6029a8a3a4e63ebb818b8f91a3c5b1b5dc91bc0d3d48ea283749e12e
@@ -85,19 +85,19 @@ module Validate
85
85
  end
86
86
  matches = SmartyStreets.standardize do |s|
87
87
  x = nil
88
- s.street = x if x = address[:street] || address['street']
89
- s.city = x if x = address[:city] || address['city']
90
- s.state = x if x = address[:state] || address['state']
91
- s.zip_code = x if x = address[:zip] || address['zip']
88
+ s.street = x if x = address[:street] || address['street']
89
+ s.city = x if x = address[:city] || address['city']
90
+ s.state = x if x = address[:state] || address['state']
91
+ s.zip_code = x if x = address[:zip] || address['zip']
92
92
  end
93
93
 
94
94
  format_suggestion = lambda do |s|
95
95
  {
96
- street: s.street,
97
- city: s.city,
98
- state: s.state,
99
- zip: s.zip_code,
100
- country: 'US',
96
+ 'street' => s.street,
97
+ 'city' => s.city,
98
+ 'state' => s.state,
99
+ 'zip' => s.zip_code,
100
+ 'country' => 'US',
101
101
  }
102
102
  end
103
103
 
@@ -105,10 +105,11 @@ module Validate
105
105
  when 0
106
106
  [false, nil, nil]
107
107
  when 1
108
+ suggestion = matches.map(&format_suggestion)
108
109
  unless matches.first.analysis['dpv_match_code'] == 'Y'
109
- [false, nil, matches.map(&format_suggestion)]
110
+ [false, nil, suggestion]
110
111
  else
111
- [true, matches.map(&format_suggestion).first, nil]
112
+ [true, suggestion.first, nil]
112
113
  end
113
114
  else
114
115
  [false, nil, matches.map(&format_suggestion)]
@@ -1,7 +1,7 @@
1
1
  module Validate
2
2
  module Address
3
3
  module SmartyStreets
4
- VERSION = '1.0'
4
+ VERSION = '1.0.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-address-smartystreets
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
  - Kenneth Ballenegger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smarty_streets