smartystreets_ruby_sdk 5.6.0 → 5.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -26
- data/README.md +0 -4
- data/examples/international_example.rb +15 -2
- data/examples/us_autocomplete_example.rb +8 -0
- data/examples/us_extract_example.rb +6 -0
- data/examples/us_street_multiple_address_example.rb +17 -3
- data/examples/us_street_single_address_example.rb +16 -2
- data/examples/us_zipcode_multiple_lookup_example.rb +4 -0
- data/examples/us_zipcode_single_lookup_example.rb +7 -0
- data/lib/smartystreets_ruby_sdk.rb +1 -0
- data/lib/smartystreets_ruby_sdk/client_builder.rb +12 -0
- data/lib/smartystreets_ruby_sdk/international_street/analysis.rb +3 -1
- data/lib/smartystreets_ruby_sdk/international_street/candidate.rb +4 -16
- data/lib/smartystreets_ruby_sdk/international_street/changes.rb +15 -0
- data/lib/smartystreets_ruby_sdk/international_street/client.rb +1 -0
- data/lib/smartystreets_ruby_sdk/international_street/lookup.rb +2 -2
- data/lib/smartystreets_ruby_sdk/international_street/rootlevel.rb +25 -0
- data/lib/smartystreets_ruby_sdk/license_sender.rb +15 -0
- data/lib/smartystreets_ruby_sdk/retry_sender.rb +1 -1
- data/lib/smartystreets_ruby_sdk/us_extract/result.rb +1 -1
- data/lib/smartystreets_ruby_sdk/us_street/analysis.rb +1 -1
- data/lib/smartystreets_ruby_sdk/us_street/candidate.rb +2 -1
- data/lib/smartystreets_ruby_sdk/us_street/client.rb +1 -0
- data/lib/smartystreets_ruby_sdk/us_zipcode/result.rb +2 -1
- data/lib/smartystreets_ruby_sdk/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 535dcd015e5d60cfb19fceef8fcaaf21571bc32a1273e59f8b21b3fcb71e7361
|
4
|
+
data.tar.gz: f994e9282f74263c7fbdc411c7a90cc5a41f04cdfe58fd7d5a41668e8ce90090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503dd289bba672c6068784ca929a14b265a57f80f30e5faa9840a3962b67937c0a200e8ad450783077723d0eff1ff8e7681dafc6a4d98d4fe6ac68171ac17cf8
|
7
|
+
data.tar.gz: ea7e7babd854b053bdda4ddfc43ad88f47c6b12ed26a53f2681b72635a191b46b3e70e46c5cd15d292d146d8ba546251acf129e4dcb81260bb499d1b499c36dc
|
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,5 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
See the changelog repository:
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
## [Unreleased]
|
9
|
-
|
10
|
-
### Changed:
|
11
|
-
|
12
|
-
- Using `warn` instead of `log` to avoid conflict with builtin function.
|
13
|
-
|
14
|
-
## [5.5.4] - 2018-09-18
|
15
|
-
|
16
|
-
### Changed:
|
17
|
-
|
18
|
-
- Standardized `Makefile`.
|
19
|
-
|
20
|
-
|
21
|
-
## [Earlier]
|
22
|
-
|
23
|
-
For details on earlier changes, please see the [releases listing](https://github.com/smartystreets/smartystreets-ruby-sdk/releases).
|
24
|
-
|
25
|
-
------------
|
26
|
-
|
27
|
-
[Unreleased]: https://github.com/smartystreets/smartystreets-ruby-sdk/compare/5.5.4...HEAD
|
28
|
-
[5.5.4]: https://github.com/smartystreets/smartystreets-ruby-sdk/compare/5.5.3...5.5.4
|
29
|
-
[Earlier]: https://github.com/smartystreets/smartystreets-ruby-sdk/releases
|
5
|
+
github.com/smartystreets/changelog/blob/master/sdk/ruby.md
|
data/README.md
CHANGED
@@ -14,14 +14,27 @@ class InternationalExample
|
|
14
14
|
# auth_token = ENV['SMARTY_AUTH_TOKEN']
|
15
15
|
|
16
16
|
credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
|
17
|
-
client = SmartyStreets::ClientBuilder.new(credentials).
|
17
|
+
client = SmartyStreets::ClientBuilder.new(credentials) # .with_licenses(%w(international-fake-license))
|
18
|
+
.build_international_street_api_client
|
18
19
|
|
19
|
-
|
20
|
+
# Documentation for input fields can be found at:
|
21
|
+
# https://smartystreets.com/docs/cloud/international-street-api
|
22
|
+
|
23
|
+
lookup = Lookup.new()
|
24
|
+
lookup.inputId = 'ID-8675309' # Optional ID from your system
|
20
25
|
lookup.geocode = true # Must be expressly set to get latitude and longitude.
|
26
|
+
lookup.organization = 'John Doe'
|
27
|
+
lookup.address1 = "Rua Padre Antonio D'Angelo 121"
|
28
|
+
lookup.address2 = 'Casa Verde'
|
29
|
+
lookup.locality = 'Sao Paulo'
|
30
|
+
lookup.administrative_area = 'SP'
|
31
|
+
lookup.country = 'Brazil'
|
32
|
+
lookup.postal_code = '02516-050'
|
21
33
|
|
22
34
|
candidates = client.send(lookup) # The candidates are also stored in the lookup's 'result' field.
|
23
35
|
|
24
36
|
first_candidate = candidates[0]
|
37
|
+
puts "Input ID: #{first_candidate.input_id}"
|
25
38
|
puts "Address is #{first_candidate.analysis.verification_status}"
|
26
39
|
puts "Address precision: #{first_candidate.analysis.address_precision}\n\n"
|
27
40
|
puts "First Line: #{first_candidate.address1}"
|
@@ -15,7 +15,12 @@ class USAutocompleteExample
|
|
15
15
|
|
16
16
|
credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
|
17
17
|
client = SmartyStreets::ClientBuilder.new(credentials).build_us_autocomplete_api_client
|
18
|
+
|
19
|
+
# Documentation for input fields can be found at:
|
20
|
+
# https://smartystreets.com/docs/cloud/us-autocomplete-api
|
21
|
+
|
18
22
|
lookup = Lookup.new('4770 Lincoln Ave O')
|
23
|
+
lookup.max_suggestions = 10
|
19
24
|
|
20
25
|
client.send(lookup)
|
21
26
|
|
@@ -25,8 +30,11 @@ class USAutocompleteExample
|
|
25
30
|
puts suggestion.text
|
26
31
|
end
|
27
32
|
|
33
|
+
lookup.add_city_filter('Ogden')
|
28
34
|
lookup.add_state_filter('IL')
|
35
|
+
lookup.add_prefer('Ogden, IL')
|
29
36
|
lookup.max_suggestions = 5
|
37
|
+
lookup.prefer_ratio = 0.333333
|
30
38
|
|
31
39
|
suggestions = client.send(lookup) # The client will also return the suggestions directly
|
32
40
|
|
@@ -21,7 +21,13 @@ class USExtractExample
|
|
21
21
|
"\r\nLos Vegas, Nevada." \
|
22
22
|
"\r\nMeet me at 1 Rosedale Baltimore Maryland, not at 123 Phony Street, Boise Idaho."
|
23
23
|
|
24
|
+
# Documentation for input fields can be found at:
|
25
|
+
# https://smartystreets.com/docs/cloud/us-extract-api
|
26
|
+
|
24
27
|
lookup = Lookup.new(text)
|
28
|
+
lookup.aggressive = true
|
29
|
+
lookup.addresses_have_line_breaks = false
|
30
|
+
lookup.addresses_per_line = 2
|
25
31
|
|
26
32
|
result = client.send(lookup)
|
27
33
|
|
@@ -16,13 +16,26 @@ class USStreetMultipleAddressExample
|
|
16
16
|
|
17
17
|
credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
|
18
18
|
|
19
|
-
client = SmartyStreets::ClientBuilder.new(credentials).
|
19
|
+
client = SmartyStreets::ClientBuilder.new(credentials) # .with_licenses(%w(us-rooftop-geocoding-cloud))
|
20
|
+
.build_us_street_api_client
|
20
21
|
batch = SmartyStreets::Batch.new
|
21
22
|
|
23
|
+
# Documentation for input fields can be found at:
|
24
|
+
# https://smartystreets.com/docs/cloud/us-street-api
|
25
|
+
|
22
26
|
batch.add(Lookup.new)
|
27
|
+
batch[0].input_id = '8675309' # Optional ID from your system
|
28
|
+
batch[0].addressee = 'John Doe'
|
23
29
|
batch[0].street = '1600 amphitheatre parkway'
|
24
|
-
batch[0].
|
25
|
-
batch[0].
|
30
|
+
batch[0].street2 = 'second star to the right'
|
31
|
+
batch[0].secondary = 'APT 2'
|
32
|
+
batch[0].urbanization = '' # Only applies to Puerto Rico addresses
|
33
|
+
batch[0].lastline = 'Mountain view, California'
|
34
|
+
batch[0].zipcode = '21229'
|
35
|
+
batch[0].candidates = 3
|
36
|
+
batch[0].match = 'invalid'.freeze # "invalid" is the most permissive match,
|
37
|
+
# this will always return at least one result even if the address is invalid.
|
38
|
+
# Refer to the documentation for additional Match Strategy options.
|
26
39
|
|
27
40
|
batch.add(Lookup.new('1 Rosedale, Baltimore, Maryland')) # Freeform addresses work too.
|
28
41
|
batch[1].candidates = 10 # Allows up to ten possible matches to be returned (default is 1).
|
@@ -55,6 +68,7 @@ class USStreetMultipleAddressExample
|
|
55
68
|
metadata = candidate.metadata
|
56
69
|
|
57
70
|
puts "\nCandidate #{candidate.candidate_index} : "
|
71
|
+
puts "Input ID: #{candidate.input_id}"
|
58
72
|
puts "Delivery line 1: #{candidate.delivery_line_1}"
|
59
73
|
puts "Last line: #{candidate.last_line}"
|
60
74
|
puts "ZIP Code: #{components.zipcode}-#{components.plus4_code}"
|
@@ -14,13 +14,26 @@ class USStreetSingleAddressExample
|
|
14
14
|
credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
|
15
15
|
|
16
16
|
client = SmartyStreets::ClientBuilder.new(credentials).
|
17
|
-
|
18
|
-
|
17
|
+
# with_proxy('localhost', 8080, 'proxyUser', 'proxyPassword'). # Uncomment this line to try it with a proxy
|
18
|
+
build_us_street_api_client
|
19
|
+
|
20
|
+
# Documentation for input fields can be found at:
|
21
|
+
# https://smartystreets.com/docs/cloud/us-street-api
|
19
22
|
|
20
23
|
lookup = SmartyStreets::USStreet::Lookup.new
|
24
|
+
lookup.input_id = '24601' # Optional ID from your system
|
25
|
+
lookup.addressee = 'John Doe'
|
21
26
|
lookup.street = '1600 Amphitheatre Pkwy'
|
27
|
+
lookup.street2 = 'closet under the stairs'
|
28
|
+
lookup.secondary = 'APT 2'
|
29
|
+
lookup.urbanization = '' # Only applies to Puerto Rico addresses
|
22
30
|
lookup.city = 'Mountain View'
|
23
31
|
lookup.state = 'CA'
|
32
|
+
lookup.zipcode = '21229'
|
33
|
+
lookup.candidates = 3
|
34
|
+
lookup.match = 'invalid'.freeze # "invalid" is the most permissive match,
|
35
|
+
# this will always return at least one result even if the address is invalid.
|
36
|
+
# Refer to the documentation for additional Match Strategy options.
|
24
37
|
|
25
38
|
begin
|
26
39
|
client.send_lookup(lookup)
|
@@ -39,6 +52,7 @@ class USStreetSingleAddressExample
|
|
39
52
|
first_candidate = result[0]
|
40
53
|
|
41
54
|
puts "Address is valid. (There is at least one candidate)\n"
|
55
|
+
puts "Input ID: #{first_candidate.input_id}"
|
42
56
|
puts "ZIP Code: #{first_candidate.components.zipcode}"
|
43
57
|
puts "County: #{first_candidate.metadata.county_name}"
|
44
58
|
puts "Latitude: #{first_candidate.metadata.latitude}"
|
@@ -19,7 +19,11 @@ class USZipcodeMultipleLookupExample
|
|
19
19
|
client = SmartyStreets::ClientBuilder.new(credentials).build_us_zipcode_api_client
|
20
20
|
batch = SmartyStreets::Batch.new
|
21
21
|
|
22
|
+
# Documentation for input fields can be found at:
|
23
|
+
# https://smartystreets.com/docs/cloud/us-zipcode-api
|
24
|
+
|
22
25
|
batch.add(Lookup.new)
|
26
|
+
batch[0].input_id = '01189998819991197253' # Optional ID from your system
|
23
27
|
batch[0].zipcode = '12345' # A Lookup may have a ZIP Code, city and state, or city, state, and ZIP Code
|
24
28
|
|
25
29
|
batch.add(Lookup.new)
|
@@ -15,9 +15,14 @@ class UsZipcodeSingleLookupExample
|
|
15
15
|
|
16
16
|
client = SmartyStreets::ClientBuilder.new(credentials).build_us_zipcode_api_client
|
17
17
|
|
18
|
+
# Documentation for input fields can be found at:
|
19
|
+
# https://smartystreets.com/docs/cloud/us-zipcode-api
|
20
|
+
|
18
21
|
lookup = SmartyStreets::USZipcode::Lookup.new
|
22
|
+
lookup.input_id = 'dfc33cb6-829e-4fea-aa1b-b6d6580f0817' # Optional ID from your system
|
19
23
|
lookup.city = 'Mountain View'
|
20
24
|
lookup.state = 'California'
|
25
|
+
lookup.zipcode = '94043'
|
21
26
|
|
22
27
|
begin
|
23
28
|
client.send_lookup(lookup)
|
@@ -30,6 +35,8 @@ class UsZipcodeSingleLookupExample
|
|
30
35
|
zipcodes = result.zipcodes
|
31
36
|
cities = result.cities
|
32
37
|
|
38
|
+
puts "Input ID: #{result.input_id}"
|
39
|
+
|
33
40
|
cities.each do |city|
|
34
41
|
puts "\nCity: #{city.city}"
|
35
42
|
puts "State: #{city.state}"
|
@@ -14,6 +14,7 @@ require 'smartystreets_ruby_sdk/native_serializer'
|
|
14
14
|
require 'smartystreets_ruby_sdk/request'
|
15
15
|
require 'smartystreets_ruby_sdk/response'
|
16
16
|
require 'smartystreets_ruby_sdk/retry_sender'
|
17
|
+
require 'smartystreets_ruby_sdk/license_sender'
|
17
18
|
require 'smartystreets_ruby_sdk/shared_credentials'
|
18
19
|
require 'smartystreets_ruby_sdk/signing_sender'
|
19
20
|
require 'smartystreets_ruby_sdk/static_credentials'
|
@@ -4,6 +4,7 @@ require_relative 'status_code_sender'
|
|
4
4
|
require_relative 'signing_sender'
|
5
5
|
require_relative 'retry_sender'
|
6
6
|
require_relative 'url_prefix_sender'
|
7
|
+
require_relative 'license_sender'
|
7
8
|
require_relative 'sleeper'
|
8
9
|
require_relative 'logger'
|
9
10
|
require_relative 'proxy'
|
@@ -34,6 +35,7 @@ module SmartyStreets
|
|
34
35
|
@url_prefix = nil
|
35
36
|
@proxy = nil
|
36
37
|
@headers = nil
|
38
|
+
@licenses = %w()
|
37
39
|
@debug = nil
|
38
40
|
end
|
39
41
|
|
@@ -96,6 +98,14 @@ module SmartyStreets
|
|
96
98
|
self
|
97
99
|
end
|
98
100
|
|
101
|
+
# Allows the caller to specify the subscription license (aka "track") they wish to use.
|
102
|
+
#
|
103
|
+
# Returns self to accommodate method chaining.
|
104
|
+
def with_licenses(licenses)
|
105
|
+
@licenses.concat licenses
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
99
109
|
# Enables debug mode, which will print information about the HTTP request and response to $stdout.
|
100
110
|
#
|
101
111
|
# Returns self to accommodate method chaining.
|
@@ -146,6 +156,8 @@ module SmartyStreets
|
|
146
156
|
|
147
157
|
sender = RetrySender.new(@max_retries, sender, SmartyStreets::Sleeper.new,SmartyStreets::Logger.new) if @max_retries > 0
|
148
158
|
|
159
|
+
sender = LicenseSender.new(sender, @licenses)
|
160
|
+
|
149
161
|
URLPrefixSender.new(@url_prefix, sender)
|
150
162
|
end
|
151
163
|
|
@@ -1,14 +1,16 @@
|
|
1
|
+
require_relative 'changes'
|
1
2
|
module SmartyStreets
|
2
3
|
module InternationalStreet
|
3
4
|
# See "https://smartystreets.com/docs/cloud/international-street-api#analysis"
|
4
5
|
class Analysis
|
5
6
|
|
6
|
-
attr_reader :max_address_precision, :verification_status, :address_precision
|
7
|
+
attr_reader :max_address_precision, :verification_status, :address_precision, :changes
|
7
8
|
|
8
9
|
def initialize(obj)
|
9
10
|
@verification_status = obj.fetch('verification_status', nil)
|
10
11
|
@address_precision = obj.fetch('address_precision', nil)
|
11
12
|
@max_address_precision = obj.fetch('max_address_precision', nil)
|
13
|
+
@changes = Changes.new(obj.fetch('changes', {}))
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative 'components'
|
2
2
|
require_relative 'metadata'
|
3
3
|
require_relative 'analysis'
|
4
|
+
require_relative 'rootlevel'
|
4
5
|
|
5
6
|
module SmartyStreets
|
6
7
|
module InternationalStreet
|
@@ -8,27 +9,14 @@ module SmartyStreets
|
|
8
9
|
# candidates if the address was ambiguous.
|
9
10
|
#
|
10
11
|
# See "https://smartystreets.com/docs/cloud/international-street-api#root"
|
11
|
-
class Candidate
|
12
|
-
attr_reader :metadata, :
|
13
|
-
:address9, :address8, :address7, :organization, :address6, :address5, :address4, :components, :analysis
|
12
|
+
class Candidate < RootLevel
|
13
|
+
attr_reader :metadata, :components, :analysis
|
14
14
|
|
15
15
|
def initialize(obj)
|
16
|
-
@organization = obj.fetch('organization', nil)
|
17
|
-
@address1 = obj.fetch('address1', nil)
|
18
|
-
@address2 = obj.fetch('address2', nil)
|
19
|
-
@address3 = obj.fetch('address3', nil)
|
20
|
-
@address4 = obj.fetch('address4', nil)
|
21
|
-
@address5 = obj.fetch('address5', nil)
|
22
|
-
@address6 = obj.fetch('address6', nil)
|
23
|
-
@address7 = obj.fetch('address7', nil)
|
24
|
-
@address8 = obj.fetch('address8', nil)
|
25
|
-
@address9 = obj.fetch('address9', nil)
|
26
|
-
@address10 = obj.fetch('address10', nil)
|
27
|
-
@address11 = obj.fetch('address11', nil)
|
28
|
-
@address12 = obj.fetch('address12', nil)
|
29
16
|
@components = Components.new(obj.fetch('components', {}))
|
30
17
|
@metadata = Metadata.new(obj.fetch('metadata', {}))
|
31
18
|
@analysis = Analysis.new(obj.fetch('analysis', {}))
|
19
|
+
super(obj)
|
32
20
|
end
|
33
21
|
end
|
34
22
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'rootlevel'
|
2
|
+
require_relative 'components'
|
3
|
+
|
4
|
+
module SmartyStreets
|
5
|
+
module InternationalStreet
|
6
|
+
class Changes < RootLevel
|
7
|
+
attr_reader :components
|
8
|
+
|
9
|
+
def initialize(obj)
|
10
|
+
@components = Components.new(obj.fetch('components', {}))
|
11
|
+
super(obj)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -26,6 +26,7 @@ module SmartyStreets
|
|
26
26
|
def build_request(lookup)
|
27
27
|
request = SmartyStreets::Request.new
|
28
28
|
|
29
|
+
add_parameter(request, 'input_id', lookup.input_id)
|
29
30
|
add_parameter(request, 'country', lookup.country)
|
30
31
|
add_parameter(request, 'geocode', lookup.geocode.to_s)
|
31
32
|
add_parameter(request, 'language', lookup.language)
|
@@ -14,13 +14,13 @@ module SmartyStreets
|
|
14
14
|
# When set to language_mode.LATIN, the results will always be provided using a Latin character set.
|
15
15
|
class Lookup
|
16
16
|
|
17
|
-
attr_accessor :freeform, :locality, :postal_code, :address3, :address2, :inputId, :address1,
|
17
|
+
attr_accessor :input_id, :freeform, :locality, :postal_code, :address3, :address2, :inputId, :address1,
|
18
18
|
:geocode, :administrative_area, :country, :organization, :language, :address4, :result
|
19
19
|
|
20
20
|
def initialize(freeform=nil, country=nil)
|
21
21
|
@result = []
|
22
22
|
|
23
|
-
@
|
23
|
+
@input_id = nil
|
24
24
|
@country = country
|
25
25
|
@geocode = nil
|
26
26
|
@language = nil
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SmartyStreets
|
2
|
+
module InternationalStreet
|
3
|
+
class RootLevel
|
4
|
+
attr_reader :input_id, :organization, :address1, :address2, :address3, :address4, :address5, :address6, :address7,
|
5
|
+
:address8, :address9, :address10, :address11, :address12
|
6
|
+
|
7
|
+
def initialize(obj)
|
8
|
+
@input_id = obj.fetch('input_id', nil)
|
9
|
+
@organization = obj.fetch('organization', nil)
|
10
|
+
@address1 = obj.fetch('address1', nil)
|
11
|
+
@address2 = obj.fetch('address2', nil)
|
12
|
+
@address3 = obj.fetch('address3', nil)
|
13
|
+
@address4 = obj.fetch('address4', nil)
|
14
|
+
@address5 = obj.fetch('address5', nil)
|
15
|
+
@address6 = obj.fetch('address6', nil)
|
16
|
+
@address7 = obj.fetch('address7', nil)
|
17
|
+
@address8 = obj.fetch('address8', nil)
|
18
|
+
@address9 = obj.fetch('address9', nil)
|
19
|
+
@address10 = obj.fetch('address10', nil)
|
20
|
+
@address11 = obj.fetch('address11', nil)
|
21
|
+
@address12 = obj.fetch('address12', nil)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SmartyStreets
|
2
|
+
class LicenseSender
|
3
|
+
def initialize(inner, licenses)
|
4
|
+
@inner = inner
|
5
|
+
@licenses = licenses
|
6
|
+
end
|
7
|
+
|
8
|
+
def send(request)
|
9
|
+
if @licenses.length > 0
|
10
|
+
request.parameters['license'] = @licenses.join(',')
|
11
|
+
end
|
12
|
+
@inner.send(request)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -27,7 +27,7 @@ module SmartyStreets
|
|
27
27
|
def backoff(attempt)
|
28
28
|
backoff_duration = [attempt, MAX_BACKOFF_DURATION].min
|
29
29
|
|
30
|
-
@logger.
|
30
|
+
@logger.log("There was an error processing the request. Retrying in #{backoff_duration} seconds...")
|
31
31
|
@sleeper.sleep(backoff_duration)
|
32
32
|
end
|
33
33
|
end
|
@@ -11,7 +11,7 @@ module SmartyStreets
|
|
11
11
|
@cmra = obj['dpv_cmra']
|
12
12
|
@vacant = obj['dpv_vacant']
|
13
13
|
@active = obj['active']
|
14
|
-
@is_ews_match =
|
14
|
+
@is_ews_match = obj['ews_match']
|
15
15
|
@footnotes = obj['footnotes']
|
16
16
|
@lacs_link_code = obj['lacslink_code']
|
17
17
|
@lacs_link_indicator = obj['lacslink_indicator']
|
@@ -6,10 +6,11 @@ module SmartyStreets
|
|
6
6
|
module USStreet
|
7
7
|
# See "https://smartystreets.com/docs/cloud/us-street-api#metadata"
|
8
8
|
class Candidate
|
9
|
-
attr_reader :input_index, :candidate_index, :addressee, :delivery_line_1, :delivery_line_2, :delivery_point_barcode,
|
9
|
+
attr_reader :input_id, :input_index, :candidate_index, :addressee, :delivery_line_1, :delivery_line_2, :delivery_point_barcode,
|
10
10
|
:last_line, :metadata, :components, :analysis
|
11
11
|
|
12
12
|
def initialize(obj)
|
13
|
+
@input_id = obj['input_id']
|
13
14
|
@input_index = obj['input_index']
|
14
15
|
@candidate_index = obj['candidate_index']
|
15
16
|
@addressee = obj['addressee']
|
@@ -48,6 +48,7 @@ module SmartyStreets
|
|
48
48
|
obj.each do |lookup|
|
49
49
|
converted_lookup = {}
|
50
50
|
|
51
|
+
converted_lookup['input_id'] = lookup.input_id
|
51
52
|
converted_lookup['street'] = lookup.street
|
52
53
|
converted_lookup['street2'] = lookup.street2
|
53
54
|
converted_lookup['secondary'] = lookup.secondary
|
@@ -5,11 +5,12 @@ module SmartyStreets
|
|
5
5
|
module USZipcode
|
6
6
|
# See "https://smartystreets.com/docs/cloud/us-zipcode-api#root"
|
7
7
|
class Result
|
8
|
-
attr_reader :reason, :input_index, :cities, :zipcodes, :status
|
8
|
+
attr_reader :reason, :input_id, :input_index, :cities, :zipcodes, :status
|
9
9
|
|
10
10
|
def initialize(obj)
|
11
11
|
@status = obj['status']
|
12
12
|
@reason = obj['reason']
|
13
|
+
@input_id = obj['input_id']
|
13
14
|
@input_index = obj['input_index']
|
14
15
|
@cities = obj.fetch('city_states', [])
|
15
16
|
@zipcodes = obj.fetch('zipcodes', [])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartystreets_ruby_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SmartyStreets SDK Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,12 +106,15 @@ files:
|
|
106
106
|
- lib/smartystreets_ruby_sdk/international_street.rb
|
107
107
|
- lib/smartystreets_ruby_sdk/international_street/analysis.rb
|
108
108
|
- lib/smartystreets_ruby_sdk/international_street/candidate.rb
|
109
|
+
- lib/smartystreets_ruby_sdk/international_street/changes.rb
|
109
110
|
- lib/smartystreets_ruby_sdk/international_street/client.rb
|
110
111
|
- lib/smartystreets_ruby_sdk/international_street/components.rb
|
111
112
|
- lib/smartystreets_ruby_sdk/international_street/language_mode.rb
|
112
113
|
- lib/smartystreets_ruby_sdk/international_street/lookup.rb
|
113
114
|
- lib/smartystreets_ruby_sdk/international_street/metadata.rb
|
115
|
+
- lib/smartystreets_ruby_sdk/international_street/rootlevel.rb
|
114
116
|
- lib/smartystreets_ruby_sdk/json_able.rb
|
117
|
+
- lib/smartystreets_ruby_sdk/license_sender.rb
|
115
118
|
- lib/smartystreets_ruby_sdk/logger.rb
|
116
119
|
- lib/smartystreets_ruby_sdk/native_sender.rb
|
117
120
|
- lib/smartystreets_ruby_sdk/native_serializer.rb
|
@@ -173,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
176
|
- !ruby/object:Gem::Version
|
174
177
|
version: '0'
|
175
178
|
requirements: []
|
176
|
-
rubygems_version: 3.
|
179
|
+
rubygems_version: 3.1.2
|
177
180
|
signing_key:
|
178
181
|
specification_version: 4
|
179
182
|
summary: An official library for the SmartyStreets APIs
|