smartystreets_ruby_sdk 5.15.0 → 5.15.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/examples/international_example.rb +1 -1
- data/lib/smartystreets_ruby_sdk/client_builder.rb +8 -8
- data/lib/smartystreets_ruby_sdk/international_street/client.rb +14 -0
- data/lib/smartystreets_ruby_sdk/retry_sender.rb +1 -1
- data/lib/smartystreets_ruby_sdk/us_street/client.rb +1 -1
- data/lib/smartystreets_ruby_sdk/us_street/lookup.rb +3 -2
- data/lib/smartystreets_ruby_sdk/us_street/match_type.rb +6 -0
- data/lib/smartystreets_ruby_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05d6a0df50a6639ed4941e02cdae2164fdcf14eba8ff16fef88cf9433b36d686
|
4
|
+
data.tar.gz: 10ab92e972f454ff59ff4d0ebebefc6e761132749adbeb75a40ef4feda3283cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5d7b633a7c6a2ecc552df8449527610725795e50adcd196520d574b2ed523ccc708d7277e7a590609b313cbdc8b8c5c4aec16724ae9eb5650716a594801b990
|
7
|
+
data.tar.gz: c70b4d70013046254d0dbd93dd8b098318fbb11ca3c0f6fa6af3f2ac5ba7ca1f30a1493dd9b242f0174a148eb10f633e6eb6289cc646263f974ae8f092aac2d5
|
@@ -38,7 +38,7 @@ class InternationalExample
|
|
38
38
|
lookup.country = 'Brazil'
|
39
39
|
lookup.postal_code = '02516-050'
|
40
40
|
|
41
|
-
candidates = client.
|
41
|
+
candidates = client.send_lookup(lookup) # The candidates are also stored in the lookup's 'result' field.
|
42
42
|
|
43
43
|
first_candidate = candidates[0]
|
44
44
|
puts "Input ID: #{first_candidate.input_id}"
|
@@ -22,14 +22,14 @@ module SmartyStreets
|
|
22
22
|
# You can use ClientBuilder's methods to customize settings like maximum retries or timeout duration.
|
23
23
|
# These methods are chainable, so you can usually get set up with one line of code.
|
24
24
|
class ClientBuilder
|
25
|
-
INTERNATIONAL_STREET_API_URL = 'https://international-street.api.
|
26
|
-
INTERNATIONAL_AUTOCOMPLETE_API_URL = "https://international-autocomplete.api.
|
27
|
-
US_AUTOCOMPLETE_API_URL = 'https://us-autocomplete.api.
|
28
|
-
US_AUTOCOMPLETE_PRO_API_URL = 'https://us-autocomplete-pro.api.
|
29
|
-
US_EXTRACT_API_URL = 'https://us-extract.api.
|
30
|
-
US_STREET_API_URL = 'https://us-street.api.
|
31
|
-
US_ZIP_CODE_API_URL = 'https://us-zipcode.api.
|
32
|
-
US_REVERSE_GEO_API_URL = 'https://us-reverse-geo.api.
|
25
|
+
INTERNATIONAL_STREET_API_URL = 'https://international-street.api.smarty.com/verify'.freeze
|
26
|
+
INTERNATIONAL_AUTOCOMPLETE_API_URL = "https://international-autocomplete.api.smarty.com/lookup".freeze
|
27
|
+
US_AUTOCOMPLETE_API_URL = 'https://us-autocomplete.api.smarty.com/suggest'.freeze
|
28
|
+
US_AUTOCOMPLETE_PRO_API_URL = 'https://us-autocomplete-pro.api.smarty.com/lookup'.freeze
|
29
|
+
US_EXTRACT_API_URL = 'https://us-extract.api.smarty.com/'.freeze
|
30
|
+
US_STREET_API_URL = 'https://us-street.api.smarty.com/street-address'.freeze
|
31
|
+
US_ZIP_CODE_API_URL = 'https://us-zipcode.api.smarty.com/lookup'.freeze
|
32
|
+
US_REVERSE_GEO_API_URL = 'https://us-reverse-geo.api.smarty.com/lookup'.freeze
|
33
33
|
|
34
34
|
def initialize(signer)
|
35
35
|
@signer = signer
|
@@ -11,6 +11,7 @@ module SmartyStreets
|
|
11
11
|
end
|
12
12
|
|
13
13
|
# Sends a Lookup object to the International Street API and stores the result in the Lookup's result field.
|
14
|
+
# Deprecated, please use send_lookup instead.
|
14
15
|
def send(lookup)
|
15
16
|
lookup.ensure_enough_info
|
16
17
|
request = build_request(lookup)
|
@@ -23,6 +24,19 @@ module SmartyStreets
|
|
23
24
|
lookup.result = candidates
|
24
25
|
end
|
25
26
|
|
27
|
+
# Sends a Lookup object to the International Street API and stores the result in the Lookup's result field.
|
28
|
+
def send_lookup(lookup)
|
29
|
+
lookup.ensure_enough_info
|
30
|
+
request = build_request(lookup)
|
31
|
+
|
32
|
+
response = @sender.send(request)
|
33
|
+
|
34
|
+
raise response.error if response.error
|
35
|
+
|
36
|
+
candidates = convert_candidates(@serializer.deserialize(response.payload))
|
37
|
+
lookup.result = candidates
|
38
|
+
end
|
39
|
+
|
26
40
|
def build_request(lookup)
|
27
41
|
request = SmartyStreets::Request.new
|
28
42
|
|
@@ -61,7 +61,7 @@ module SmartyStreets
|
|
61
61
|
converted_lookup['urbanization'] = lookup.urbanization
|
62
62
|
converted_lookup['match'] = lookup.match
|
63
63
|
converted_lookup['candidates'] = lookup.candidates
|
64
|
-
|
64
|
+
converted_lookup['format'] = lookup.format
|
65
65
|
converted_obj.push(converted_lookup)
|
66
66
|
end
|
67
67
|
converted_obj
|
@@ -9,10 +9,10 @@ module SmartyStreets
|
|
9
9
|
# @match:: Must be set to 'strict', 'range', or 'invalid'. Constants for these are in match_type.rb
|
10
10
|
class Lookup < JSONAble
|
11
11
|
attr_accessor :input_id, :street, :street2, :secondary, :city, :state, :zipcode, :lastline, :addressee, :urbanization,
|
12
|
-
:match, :candidates, :result
|
12
|
+
:match, :candidates, :format, :result
|
13
13
|
|
14
14
|
def initialize(street=nil, street2=nil, secondary=nil, city=nil, state=nil, zipcode=nil, lastline=nil,
|
15
|
-
addressee=nil, urbanization=nil, match=nil, candidates=0, input_id=nil)
|
15
|
+
addressee=nil, urbanization=nil, match=nil, candidates=0, input_id=nil, format=nil)
|
16
16
|
@input_id = input_id
|
17
17
|
@street = street
|
18
18
|
@street2 = street2
|
@@ -25,6 +25,7 @@ module SmartyStreets
|
|
25
25
|
@urbanization = urbanization
|
26
26
|
@match = match
|
27
27
|
@candidates = candidates
|
28
|
+
@format = format
|
28
29
|
@result = []
|
29
30
|
end
|
30
31
|
end
|
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.15.
|
4
|
+
version: 5.15.1
|
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: 2023-
|
11
|
+
date: 2023-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|