smartystreets_ruby_sdk 6.4.1 → 10.0.0
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/.claude/settings.json +18 -0
- data/.github/workflows/ci.yml +10 -0
- data/.github/workflows/publish.yml +29 -0
- data/.github/workflows/test.yml +21 -0
- data/CLAUDE.md +73 -0
- data/Makefile +11 -5
- data/README.md +2 -0
- data/examples/international_autocomplete_example.rb +10 -7
- data/examples/international_example.rb +7 -6
- data/examples/international_postal_code_example.rb +5 -4
- data/examples/us_autocomplete_example.rb +69 -0
- data/examples/us_autocomplete_pro_example.rb +10 -12
- data/examples/us_enrichment_business_example.rb +72 -0
- data/examples/us_enrichment_business_name_search_example.rb +76 -0
- data/examples/us_enrichment_etag_example.rb +130 -0
- data/examples/us_enrichment_example.rb +130 -44
- data/examples/us_extract_example.rb +7 -6
- data/examples/us_reverse_geo_example.rb +10 -6
- data/examples/us_street_component_analysis_example.rb +2 -1
- data/examples/us_street_iana_timezone_example.rb +54 -0
- data/examples/us_street_match_strategy_example.rb +85 -0
- data/examples/us_street_multiple_address_example.rb +7 -6
- data/examples/us_street_single_address_example.rb +7 -6
- data/examples/us_zipcode_multiple_lookup_example.rb +7 -6
- data/examples/us_zipcode_single_lookup_example.rb +7 -6
- data/lib/smartystreets_ruby_sdk/basic_auth_credentials.rb +14 -0
- data/lib/smartystreets_ruby_sdk/client_builder.rb +36 -5
- data/lib/smartystreets_ruby_sdk/custom_header_sender.rb +16 -2
- data/lib/smartystreets_ruby_sdk/errors.rb +16 -11
- data/lib/smartystreets_ruby_sdk/exceptions.rb +12 -0
- data/lib/smartystreets_ruby_sdk/international_autocomplete/client.rb +2 -0
- data/lib/smartystreets_ruby_sdk/international_autocomplete/lookup.rb +4 -2
- data/lib/smartystreets_ruby_sdk/international_street/client.rb +10 -1
- data/lib/smartystreets_ruby_sdk/international_street/components.rb +8 -3
- data/lib/smartystreets_ruby_sdk/international_street/language_mode.rb +20 -3
- data/lib/smartystreets_ruby_sdk/international_street/lookup.rb +5 -12
- data/lib/smartystreets_ruby_sdk/international_street/rootlevel.rb +1 -5
- data/lib/smartystreets_ruby_sdk/native_sender.rb +3 -4
- data/lib/smartystreets_ruby_sdk/native_serializer.rb +1 -0
- data/lib/smartystreets_ruby_sdk/request.rb +2 -1
- data/lib/smartystreets_ruby_sdk/response.rb +13 -0
- data/lib/smartystreets_ruby_sdk/retry_sender.rb +32 -13
- data/lib/smartystreets_ruby_sdk/status_code_sender.rb +39 -22
- data/lib/smartystreets_ruby_sdk/us_autocomplete/client.rb +82 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete/geolocation_type.rb +8 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete/lookup.rb +73 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete/source_type.rb +8 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete/suggestion.rb +22 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete.rb +10 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete_pro/source_type.rb +8 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete_pro.rb +1 -0
- data/lib/smartystreets_ruby_sdk/us_enrichment/business/detail/attributes.rb +241 -0
- data/lib/smartystreets_ruby_sdk/us_enrichment/business/detail/response.rb +20 -0
- data/lib/smartystreets_ruby_sdk/us_enrichment/business/summary/business_entry.rb +16 -0
- data/lib/smartystreets_ruby_sdk/us_enrichment/business/summary/response.rb +24 -0
- data/lib/smartystreets_ruby_sdk/us_enrichment/client.rb +99 -30
- data/lib/smartystreets_ruby_sdk/us_enrichment/geo_reference/response.rb +2 -3
- data/lib/smartystreets_ruby_sdk/us_enrichment/lookup.rb +42 -9
- data/lib/smartystreets_ruby_sdk/us_enrichment/property/principal/response.rb +3 -4
- data/lib/smartystreets_ruby_sdk/us_enrichment/secondary/count/response.rb +2 -3
- data/lib/smartystreets_ruby_sdk/us_enrichment/secondary/response.rb +2 -3
- data/lib/smartystreets_ruby_sdk/us_enrichment.rb +6 -5
- data/lib/smartystreets_ruby_sdk/us_reverse_geo/source_type.rb +8 -0
- data/lib/smartystreets_ruby_sdk/us_reverse_geo/us_reverse_geo_response.rb +1 -1
- data/lib/smartystreets_ruby_sdk/us_reverse_geo.rb +1 -0
- data/lib/smartystreets_ruby_sdk/us_street/candidate.rb +2 -1
- data/lib/smartystreets_ruby_sdk/us_street/client.rb +10 -3
- data/lib/smartystreets_ruby_sdk/us_street/metadata.rb +5 -1
- data/lib/smartystreets_ruby_sdk/version.rb +1 -1
- data/lib/smartystreets_ruby_sdk.rb +2 -0
- metadata +27 -6
- data/.github/workflows/gem-publish.yml +0 -27
- data/lib/smartystreets_ruby_sdk/us_enrichment/risk/attributes.rb +0 -524
- data/lib/smartystreets_ruby_sdk/us_enrichment/risk/response.rb +0 -19
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
require_relative "property/principal/response"
|
|
2
2
|
require_relative "geo_reference/response"
|
|
3
|
-
require_relative "risk/response"
|
|
4
3
|
require_relative "secondary/response"
|
|
5
4
|
require_relative "secondary/count/response"
|
|
5
|
+
require_relative "business/summary/response"
|
|
6
|
+
require_relative "business/detail/response"
|
|
6
7
|
require_relative "lookup"
|
|
7
8
|
require_relative '../request'
|
|
9
|
+
require_relative '../exceptions'
|
|
10
|
+
require 'uri'
|
|
8
11
|
|
|
9
12
|
module SmartyStreets
|
|
10
13
|
module USEnrichment
|
|
@@ -34,16 +37,6 @@ module SmartyStreets
|
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
def send_risk_lookup(lookup)
|
|
38
|
-
if (lookup.instance_of? String)
|
|
39
|
-
__send(USEnrichment::Lookup.new(lookup,'risk'))
|
|
40
|
-
elsif (lookup.instance_of? USEnrichment::Lookup)
|
|
41
|
-
lookup.data_set = 'risk'
|
|
42
|
-
lookup.data_sub_set = nil
|
|
43
|
-
__send(lookup)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
40
|
def send_secondary_lookup(lookup)
|
|
48
41
|
if (lookup.instance_of? String)
|
|
49
42
|
__send(USEnrichment::Lookup.new(lookup,'secondary'))
|
|
@@ -64,6 +57,51 @@ module SmartyStreets
|
|
|
64
57
|
end
|
|
65
58
|
end
|
|
66
59
|
|
|
60
|
+
def send_business_lookup(lookup)
|
|
61
|
+
if (lookup.instance_of? String)
|
|
62
|
+
__send(USEnrichment::Lookup.new(lookup,'business'))
|
|
63
|
+
elsif (lookup.instance_of? USEnrichment::Lookup)
|
|
64
|
+
lookup.data_set = 'business'
|
|
65
|
+
lookup.data_sub_set = nil
|
|
66
|
+
__send(lookup)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def send_business_detail_lookup(lookup)
|
|
71
|
+
if (lookup.instance_of? String)
|
|
72
|
+
lookup = USEnrichment::BusinessDetailLookup.new(lookup)
|
|
73
|
+
end
|
|
74
|
+
unless lookup.instance_of? USEnrichment::BusinessDetailLookup
|
|
75
|
+
raise SmartyError.new("Business detail lookup requires a non-empty 'business_id'")
|
|
76
|
+
end
|
|
77
|
+
if blank?(lookup.business_id)
|
|
78
|
+
raise SmartyError.new("Business detail lookup requires a non-empty 'business_id'")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
smarty_request = Request.new
|
|
82
|
+
smarty_request.url_components = '/business/' + encode_path_segment(lookup.business_id)
|
|
83
|
+
apply_common_request_fields(smarty_request, lookup)
|
|
84
|
+
|
|
85
|
+
response = @sender.send(smarty_request)
|
|
86
|
+
capture_response_etag(response, lookup)
|
|
87
|
+
return lookup.result if response.status_code.to_s == '304'
|
|
88
|
+
results = @serializer.deserialize(response.payload)
|
|
89
|
+
|
|
90
|
+
results = [] if results.nil?
|
|
91
|
+
raise response.error if response.error
|
|
92
|
+
|
|
93
|
+
if results.length > 1
|
|
94
|
+
raise SmartyError.new("Business detail response contained #{results.length} results; expected at most 1")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if results.empty?
|
|
98
|
+
lookup.result = nil
|
|
99
|
+
else
|
|
100
|
+
lookup.result = USEnrichment::Business::Detail::Response.new(results[0])
|
|
101
|
+
end
|
|
102
|
+
lookup.result
|
|
103
|
+
end
|
|
104
|
+
|
|
67
105
|
def send_generic_lookup(lookup, data_set, data_sub_set = nil)
|
|
68
106
|
if (lookup.instance_of? String)
|
|
69
107
|
__send(USEnrichment::Lookup.new(lookup, data_set, data_sub_set))
|
|
@@ -74,15 +112,15 @@ module SmartyStreets
|
|
|
74
112
|
end
|
|
75
113
|
end
|
|
76
114
|
|
|
77
|
-
|
|
78
|
-
smarty_request = Request.new
|
|
79
|
-
|
|
80
|
-
return if lookup.nil?
|
|
115
|
+
private
|
|
81
116
|
|
|
82
|
-
|
|
83
|
-
|
|
117
|
+
def __send(lookup)
|
|
118
|
+
if lookup.nil? || (blank?(lookup.smarty_key) && blank?(lookup.street) && blank?(lookup.freeform) && blank?(lookup.business_name))
|
|
119
|
+
raise SmartyError.new("Lookup requires one of 'smarty_key', 'street', 'freeform', or 'business_name' to be set")
|
|
84
120
|
end
|
|
85
121
|
|
|
122
|
+
smarty_request = Request.new
|
|
123
|
+
|
|
86
124
|
if (!lookup.features.nil?)
|
|
87
125
|
add_parameter(smarty_request, 'features', lookup.features)
|
|
88
126
|
end
|
|
@@ -98,6 +136,7 @@ module SmartyStreets
|
|
|
98
136
|
add_parameter(smarty_request, 'city', lookup.city)
|
|
99
137
|
add_parameter(smarty_request, 'state', lookup.state)
|
|
100
138
|
add_parameter(smarty_request, 'zipcode', lookup.zipcode)
|
|
139
|
+
add_parameter(smarty_request, 'business_name', lookup.business_name)
|
|
101
140
|
else
|
|
102
141
|
if (lookup.data_sub_set.nil?)
|
|
103
142
|
smarty_request.url_components = '/' + lookup.smarty_key + '/' + lookup.data_set
|
|
@@ -105,43 +144,73 @@ module SmartyStreets
|
|
|
105
144
|
smarty_request.url_components = '/' + lookup.smarty_key + '/' + lookup.data_set + '/' + lookup.data_sub_set
|
|
106
145
|
end
|
|
107
146
|
end
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
end
|
|
147
|
+
|
|
148
|
+
apply_common_request_fields(smarty_request, lookup)
|
|
111
149
|
|
|
112
150
|
response = @sender.send(smarty_request)
|
|
151
|
+
capture_response_etag(response, lookup)
|
|
152
|
+
return [] if response.status_code.to_s == '304'
|
|
113
153
|
results = @serializer.deserialize(response.payload)
|
|
114
|
-
|
|
154
|
+
|
|
115
155
|
results = [] if results.nil?
|
|
116
156
|
raise response.error if response.error
|
|
117
|
-
|
|
157
|
+
|
|
118
158
|
output = []
|
|
119
159
|
results.each do |raw_result|
|
|
120
160
|
result = nil
|
|
121
161
|
if lookup.data_sub_set == "principal"
|
|
122
|
-
result = USEnrichment::Property::Principal::Response.new(raw_result
|
|
162
|
+
result = USEnrichment::Property::Principal::Response.new(raw_result)
|
|
123
163
|
end
|
|
124
164
|
if lookup.data_set == "geo-reference"
|
|
125
|
-
result = USEnrichment::GeoReference::Response.new(raw_result
|
|
126
|
-
end
|
|
127
|
-
if lookup.data_set == "risk"
|
|
128
|
-
result = USEnrichment::Risk::Response.new(raw_result, response.header['etag'])
|
|
165
|
+
result = USEnrichment::GeoReference::Response.new(raw_result)
|
|
129
166
|
end
|
|
130
167
|
if lookup.data_set == "secondary"
|
|
131
168
|
if lookup.data_sub_set == "count"
|
|
132
|
-
result = USEnrichment::Secondary::Count::Response.new(raw_result
|
|
169
|
+
result = USEnrichment::Secondary::Count::Response.new(raw_result)
|
|
133
170
|
elsif lookup.data_sub_set.nil?
|
|
134
|
-
result = USEnrichment::Secondary::Response.new(raw_result
|
|
171
|
+
result = USEnrichment::Secondary::Response.new(raw_result)
|
|
135
172
|
end
|
|
136
173
|
end
|
|
174
|
+
if lookup.data_set == "business" && lookup.data_sub_set.nil?
|
|
175
|
+
result = USEnrichment::Business::Summary::Response.new(raw_result)
|
|
176
|
+
end
|
|
137
177
|
output << result
|
|
138
178
|
end
|
|
139
179
|
output
|
|
140
180
|
end
|
|
141
181
|
|
|
182
|
+
def apply_common_request_fields(request, lookup)
|
|
183
|
+
unless lookup.include_array.empty?
|
|
184
|
+
request.parameters['include'] = lookup.include_array.join(',')
|
|
185
|
+
end
|
|
186
|
+
unless lookup.exclude_array.empty?
|
|
187
|
+
request.parameters['exclude'] = lookup.exclude_array.join(',')
|
|
188
|
+
end
|
|
189
|
+
unless lookup.request_etag.nil?
|
|
190
|
+
request.header['Etag'] = lookup.request_etag
|
|
191
|
+
end
|
|
192
|
+
lookup.custom_param_hash.each do |key, value|
|
|
193
|
+
add_parameter(request, key, value)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def capture_response_etag(response, lookup)
|
|
198
|
+
return if response.nil?
|
|
199
|
+
etag = response.find_header('etag')
|
|
200
|
+
lookup.response_etag = etag unless etag.nil?
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def encode_path_segment(value)
|
|
204
|
+
URI.encode_www_form_component(value).gsub('+', '%20')
|
|
205
|
+
end
|
|
206
|
+
|
|
142
207
|
def add_parameter(request, key, value)
|
|
143
208
|
request.parameters[key] = value unless value.nil? or value.empty?
|
|
144
209
|
end
|
|
210
|
+
|
|
211
|
+
def blank?(value)
|
|
212
|
+
value.nil? || value.to_s.strip.empty?
|
|
213
|
+
end
|
|
145
214
|
end
|
|
146
215
|
end
|
|
147
|
-
end
|
|
216
|
+
end
|
|
@@ -4,15 +4,14 @@ module SmartyStreets
|
|
|
4
4
|
module USEnrichment
|
|
5
5
|
module GeoReference
|
|
6
6
|
class Response
|
|
7
|
-
attr_reader :smarty_key, :data_set_name, :data_set_version, :matched_address, :attributes
|
|
7
|
+
attr_reader :smarty_key, :data_set_name, :data_set_version, :matched_address, :attributes
|
|
8
8
|
|
|
9
|
-
def initialize(obj
|
|
9
|
+
def initialize(obj)
|
|
10
10
|
@smarty_key = obj['smarty_key']
|
|
11
11
|
@data_set_name = obj['data_set_name']
|
|
12
12
|
@data_set_version = obj['data_set_version']
|
|
13
13
|
@matched_address = obj['matched_address']
|
|
14
14
|
@attributes = Attributes.new(obj['attributes'])
|
|
15
|
-
@etag = etag
|
|
16
15
|
end
|
|
17
16
|
end
|
|
18
17
|
end
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
require_relative '../json_able'
|
|
2
|
+
|
|
2
3
|
module SmartyStreets
|
|
3
4
|
module USEnrichment
|
|
4
|
-
class
|
|
5
|
-
attr_accessor :
|
|
6
|
-
|
|
7
|
-
def initialize
|
|
5
|
+
class LookupBase < JSONAble
|
|
6
|
+
attr_accessor :request_etag, :response_etag, :include_array, :exclude_array, :features, :custom_param_hash
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@request_etag = nil
|
|
10
|
+
@response_etag = nil
|
|
11
|
+
@include_array = []
|
|
12
|
+
@exclude_array = []
|
|
13
|
+
@features = nil
|
|
14
|
+
@custom_param_hash = {}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def add_custom_parameter(parameter, value)
|
|
18
|
+
@custom_param_hash[parameter] = value
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def add_include_attribute(attribute)
|
|
22
|
+
@include_array << attribute unless @include_array.include?(attribute)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def add_exclude_attribute(attribute)
|
|
26
|
+
@exclude_array << attribute unless @exclude_array.include?(attribute)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Lookup < LookupBase
|
|
31
|
+
attr_accessor :smarty_key, :data_set, :data_sub_set, :freeform, :street, :city, :state, :zipcode, :business_name
|
|
32
|
+
|
|
33
|
+
def initialize(smarty_key=nil, data_set=nil, data_sub_set=nil, freeform=nil, street=nil, city=nil, state=nil, zipcode=nil, request_etag=nil, features=nil, business_name=nil)
|
|
34
|
+
super()
|
|
8
35
|
@smarty_key = smarty_key
|
|
9
36
|
@data_set = data_set
|
|
10
37
|
@data_sub_set = data_sub_set
|
|
@@ -13,14 +40,20 @@ module SmartyStreets
|
|
|
13
40
|
@city = city
|
|
14
41
|
@state = state
|
|
15
42
|
@zipcode = zipcode
|
|
16
|
-
@
|
|
43
|
+
@request_etag = request_etag
|
|
17
44
|
@features = features
|
|
18
|
-
@
|
|
45
|
+
@business_name = business_name
|
|
19
46
|
end
|
|
47
|
+
end
|
|
20
48
|
|
|
21
|
-
|
|
22
|
-
|
|
49
|
+
class BusinessDetailLookup < LookupBase
|
|
50
|
+
attr_accessor :business_id, :result
|
|
51
|
+
|
|
52
|
+
def initialize(business_id=nil)
|
|
53
|
+
super()
|
|
54
|
+
@business_id = business_id
|
|
55
|
+
@result = nil
|
|
23
56
|
end
|
|
24
57
|
end
|
|
25
58
|
end
|
|
26
|
-
end
|
|
59
|
+
end
|
|
@@ -5,15 +5,14 @@ module SmartyStreets
|
|
|
5
5
|
module Property
|
|
6
6
|
module Principal
|
|
7
7
|
class Response
|
|
8
|
-
attr_reader :smarty_key, :data_set_name, :data_subset_name, :matched_address, :attributes
|
|
9
|
-
|
|
10
|
-
def initialize(obj
|
|
8
|
+
attr_reader :smarty_key, :data_set_name, :data_subset_name, :matched_address, :attributes
|
|
9
|
+
|
|
10
|
+
def initialize(obj)
|
|
11
11
|
@smarty_key = obj['smarty_key']
|
|
12
12
|
@data_set_name = obj['data_set_name']
|
|
13
13
|
@data_subset_name = obj['data_subset_name']
|
|
14
14
|
@matched_address = obj['matched_address']
|
|
15
15
|
@attributes = Attributes.new(obj['attributes'])
|
|
16
|
-
@etag = etag
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
end
|
|
@@ -3,13 +3,12 @@ module SmartyStreets
|
|
|
3
3
|
module Secondary
|
|
4
4
|
module Count
|
|
5
5
|
class Response
|
|
6
|
-
attr_reader :smarty_key, :matched_address, :count
|
|
6
|
+
attr_reader :smarty_key, :matched_address, :count
|
|
7
7
|
|
|
8
|
-
def initialize(obj
|
|
8
|
+
def initialize(obj)
|
|
9
9
|
@smarty_key = obj['smarty_key']
|
|
10
10
|
@matched_address = obj['matched_address']
|
|
11
11
|
@count = obj['count']
|
|
12
|
-
@etag = etag
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
14
|
end
|
|
@@ -6,9 +6,9 @@ module SmartyStreets
|
|
|
6
6
|
module USEnrichment
|
|
7
7
|
module Secondary
|
|
8
8
|
class Response
|
|
9
|
-
attr_reader :smarty_key, :matched_address, :root_address, :aliases, :secondaries
|
|
9
|
+
attr_reader :smarty_key, :matched_address, :root_address, :aliases, :secondaries
|
|
10
10
|
|
|
11
|
-
def initialize(obj
|
|
11
|
+
def initialize(obj)
|
|
12
12
|
@smarty_key = obj['smarty_key']
|
|
13
13
|
@matched_address = obj['matched_address']
|
|
14
14
|
@root_address = Secondary::RootAddressEntry.new(obj['root_address'])
|
|
@@ -16,7 +16,6 @@ module SmartyStreets
|
|
|
16
16
|
@aliases = createAliasesArray(obj['aliases'])
|
|
17
17
|
end
|
|
18
18
|
@secondaries = createSecondariesArray(obj['secondaries'])
|
|
19
|
-
@etag=etag
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
def createAliasesArray(obj)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
require_relative './us_enrichment/property/financial/attributes'
|
|
2
|
-
require_relative './us_enrichment/property/financial/history_entry'
|
|
3
|
-
require_relative './us_enrichment/property/financial/response'
|
|
4
|
-
|
|
5
1
|
require_relative './us_enrichment/property/principal/attributes'
|
|
6
2
|
require_relative './us_enrichment/property/principal/response'
|
|
7
3
|
|
|
4
|
+
require_relative './us_enrichment/business/summary/business_entry'
|
|
5
|
+
require_relative './us_enrichment/business/summary/response'
|
|
6
|
+
require_relative './us_enrichment/business/detail/attributes'
|
|
7
|
+
require_relative './us_enrichment/business/detail/response'
|
|
8
|
+
|
|
8
9
|
require_relative './us_enrichment/client'
|
|
9
10
|
|
|
10
11
|
module SmartyStreets
|
|
11
12
|
module USEnrichment
|
|
12
13
|
end
|
|
13
|
-
end
|
|
14
|
+
end
|
|
@@ -7,7 +7,7 @@ module SmartyStreets
|
|
|
7
7
|
# See "https://smartystreets.com/docs/cloud/us-street-api#metadata"
|
|
8
8
|
class Candidate
|
|
9
9
|
attr_reader :input_id, :input_index, :candidate_index, :addressee, :delivery_line_1, :delivery_line_2,
|
|
10
|
-
:last_line,:delivery_point_barcode, :smarty_key, :metadata, :components, :analysis
|
|
10
|
+
:last_line,:delivery_point_barcode, :smarty_key, :smarty_key_ext, :metadata, :components, :analysis
|
|
11
11
|
|
|
12
12
|
def initialize(obj)
|
|
13
13
|
@input_id = obj['input_id']
|
|
@@ -19,6 +19,7 @@ module SmartyStreets
|
|
|
19
19
|
@last_line = obj['last_line']
|
|
20
20
|
@delivery_point_barcode = obj['delivery_point_barcode']
|
|
21
21
|
@smarty_key = obj['smarty_key']
|
|
22
|
+
@smarty_key_ext = obj['smarty_key_ext']
|
|
22
23
|
@components = Components.new(obj.fetch('components', {}))
|
|
23
24
|
@metadata = Metadata.new(obj.fetch('metadata', {}))
|
|
24
25
|
@analysis = Analysis.new(obj.fetch('analysis', {}))
|
|
@@ -47,7 +47,16 @@ module SmartyStreets
|
|
|
47
47
|
converted_obj = []
|
|
48
48
|
obj.each do |lookup|
|
|
49
49
|
converted_lookup = {}
|
|
50
|
-
|
|
50
|
+
match_strategy = lookup.match
|
|
51
|
+
match_strategy = MatchType::ENHANCED if match_strategy.nil? || match_strategy.empty?
|
|
52
|
+
|
|
53
|
+
if lookup.candidates > 0
|
|
54
|
+
converted_lookup['candidates'] = lookup.candidates
|
|
55
|
+
elsif match_strategy == MatchType::ENHANCED
|
|
56
|
+
converted_lookup['candidates'] = 5
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
converted_lookup['match'] = match_strategy
|
|
51
60
|
|
|
52
61
|
converted_lookup['input_id'] = lookup.input_id
|
|
53
62
|
converted_lookup['street'] = lookup.street
|
|
@@ -59,8 +68,6 @@ module SmartyStreets
|
|
|
59
68
|
converted_lookup['lastline'] = lookup.lastline
|
|
60
69
|
converted_lookup['addressee'] = lookup.addressee
|
|
61
70
|
converted_lookup['urbanization'] = lookup.urbanization
|
|
62
|
-
converted_lookup['match'] = lookup.match
|
|
63
|
-
converted_lookup['candidates'] = lookup.candidates
|
|
64
71
|
converted_lookup['format'] = lookup.format
|
|
65
72
|
converted_lookup['county_source'] = lookup.county_source
|
|
66
73
|
|
|
@@ -4,7 +4,8 @@ module SmartyStreets
|
|
|
4
4
|
class Metadata
|
|
5
5
|
attr_reader :elot_sort, :longitude, :elot_sequence, :county_fips, :building_default_indicator, :rdi,
|
|
6
6
|
:congressional_district, :latitude, :precision, :time_zone, :zip_type, :county_name, :utc_offset,
|
|
7
|
-
:record_type, :carrier_route, :obeys_dst, :
|
|
7
|
+
:record_type, :carrier_route, :obeys_dst, :iana_time_zone, :iana_utc_offset, :iana_obeys_dst,
|
|
8
|
+
:is_an_ews_match
|
|
8
9
|
|
|
9
10
|
def initialize(obj)
|
|
10
11
|
@record_type = obj['record_type']
|
|
@@ -23,6 +24,9 @@ module SmartyStreets
|
|
|
23
24
|
@time_zone = obj['time_zone']
|
|
24
25
|
@utc_offset = obj['utc_offset']
|
|
25
26
|
@obeys_dst = obj['dst']
|
|
27
|
+
@iana_time_zone = obj['iana_time_zone']
|
|
28
|
+
@iana_utc_offset = obj['iana_utc_offset']
|
|
29
|
+
@iana_obeys_dst = obj['iana_dst']
|
|
26
30
|
@is_an_ews_match = obj['ews_match']
|
|
27
31
|
end
|
|
28
32
|
end
|
|
@@ -17,12 +17,14 @@ require 'smartystreets_ruby_sdk/license_sender'
|
|
|
17
17
|
require 'smartystreets_ruby_sdk/shared_credentials'
|
|
18
18
|
require 'smartystreets_ruby_sdk/signing_sender'
|
|
19
19
|
require 'smartystreets_ruby_sdk/static_credentials'
|
|
20
|
+
require 'smartystreets_ruby_sdk/basic_auth_credentials'
|
|
20
21
|
require 'smartystreets_ruby_sdk/status_code_sender'
|
|
21
22
|
require 'smartystreets_ruby_sdk/url_prefix_sender'
|
|
22
23
|
require 'smartystreets_ruby_sdk/us_extract'
|
|
23
24
|
require 'smartystreets_ruby_sdk/us_street'
|
|
24
25
|
require 'smartystreets_ruby_sdk/us_zipcode'
|
|
25
26
|
require 'smartystreets_ruby_sdk/us_autocomplete_pro'
|
|
27
|
+
require 'smartystreets_ruby_sdk/us_autocomplete'
|
|
26
28
|
require 'smartystreets_ruby_sdk/international_street'
|
|
27
29
|
require 'smartystreets_ruby_sdk/international_autocomplete'
|
|
28
30
|
require 'smartystreets_ruby_sdk/international_postal_code'
|
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:
|
|
4
|
+
version: 10.0.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: 2026-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -79,9 +79,13 @@ executables: []
|
|
|
79
79
|
extensions: []
|
|
80
80
|
extra_rdoc_files: []
|
|
81
81
|
files:
|
|
82
|
-
- ".
|
|
82
|
+
- ".claude/settings.json"
|
|
83
|
+
- ".github/workflows/ci.yml"
|
|
84
|
+
- ".github/workflows/publish.yml"
|
|
85
|
+
- ".github/workflows/test.yml"
|
|
83
86
|
- ".gitignore"
|
|
84
87
|
- CHANGELOG.md
|
|
88
|
+
- CLAUDE.md
|
|
85
89
|
- Dockerfile
|
|
86
90
|
- Gemfile
|
|
87
91
|
- LICENSE.md
|
|
@@ -94,16 +98,23 @@ files:
|
|
|
94
98
|
- examples/international_autocomplete_example.rb
|
|
95
99
|
- examples/international_example.rb
|
|
96
100
|
- examples/international_postal_code_example.rb
|
|
101
|
+
- examples/us_autocomplete_example.rb
|
|
97
102
|
- examples/us_autocomplete_pro_example.rb
|
|
103
|
+
- examples/us_enrichment_business_example.rb
|
|
104
|
+
- examples/us_enrichment_business_name_search_example.rb
|
|
105
|
+
- examples/us_enrichment_etag_example.rb
|
|
98
106
|
- examples/us_enrichment_example.rb
|
|
99
107
|
- examples/us_extract_example.rb
|
|
100
108
|
- examples/us_reverse_geo_example.rb
|
|
101
109
|
- examples/us_street_component_analysis_example.rb
|
|
110
|
+
- examples/us_street_iana_timezone_example.rb
|
|
111
|
+
- examples/us_street_match_strategy_example.rb
|
|
102
112
|
- examples/us_street_multiple_address_example.rb
|
|
103
113
|
- examples/us_street_single_address_example.rb
|
|
104
114
|
- examples/us_zipcode_multiple_lookup_example.rb
|
|
105
115
|
- examples/us_zipcode_single_lookup_example.rb
|
|
106
116
|
- lib/smartystreets_ruby_sdk.rb
|
|
117
|
+
- lib/smartystreets_ruby_sdk/basic_auth_credentials.rb
|
|
107
118
|
- lib/smartystreets_ruby_sdk/batch.rb
|
|
108
119
|
- lib/smartystreets_ruby_sdk/client_builder.rb
|
|
109
120
|
- lib/smartystreets_ruby_sdk/custom_header_sender.rb
|
|
@@ -143,12 +154,23 @@ files:
|
|
|
143
154
|
- lib/smartystreets_ruby_sdk/static_credentials.rb
|
|
144
155
|
- lib/smartystreets_ruby_sdk/status_code_sender.rb
|
|
145
156
|
- lib/smartystreets_ruby_sdk/url_prefix_sender.rb
|
|
157
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete.rb
|
|
158
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete/client.rb
|
|
159
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete/geolocation_type.rb
|
|
160
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete/lookup.rb
|
|
161
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete/source_type.rb
|
|
162
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete/suggestion.rb
|
|
146
163
|
- lib/smartystreets_ruby_sdk/us_autocomplete_pro.rb
|
|
147
164
|
- lib/smartystreets_ruby_sdk/us_autocomplete_pro/client.rb
|
|
148
165
|
- lib/smartystreets_ruby_sdk/us_autocomplete_pro/geolocation_type.rb
|
|
149
166
|
- lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb
|
|
167
|
+
- lib/smartystreets_ruby_sdk/us_autocomplete_pro/source_type.rb
|
|
150
168
|
- lib/smartystreets_ruby_sdk/us_autocomplete_pro/suggestion.rb
|
|
151
169
|
- lib/smartystreets_ruby_sdk/us_enrichment.rb
|
|
170
|
+
- lib/smartystreets_ruby_sdk/us_enrichment/business/detail/attributes.rb
|
|
171
|
+
- lib/smartystreets_ruby_sdk/us_enrichment/business/detail/response.rb
|
|
172
|
+
- lib/smartystreets_ruby_sdk/us_enrichment/business/summary/business_entry.rb
|
|
173
|
+
- lib/smartystreets_ruby_sdk/us_enrichment/business/summary/response.rb
|
|
152
174
|
- lib/smartystreets_ruby_sdk/us_enrichment/client.rb
|
|
153
175
|
- lib/smartystreets_ruby_sdk/us_enrichment/geo_reference/attributes.rb
|
|
154
176
|
- lib/smartystreets_ruby_sdk/us_enrichment/geo_reference/census_block_entry.rb
|
|
@@ -161,8 +183,6 @@ files:
|
|
|
161
183
|
- lib/smartystreets_ruby_sdk/us_enrichment/property/principal/attributes.rb
|
|
162
184
|
- lib/smartystreets_ruby_sdk/us_enrichment/property/principal/history_entry.rb
|
|
163
185
|
- lib/smartystreets_ruby_sdk/us_enrichment/property/principal/response.rb
|
|
164
|
-
- lib/smartystreets_ruby_sdk/us_enrichment/risk/attributes.rb
|
|
165
|
-
- lib/smartystreets_ruby_sdk/us_enrichment/risk/response.rb
|
|
166
186
|
- lib/smartystreets_ruby_sdk/us_enrichment/secondary/aliases_entry.rb
|
|
167
187
|
- lib/smartystreets_ruby_sdk/us_enrichment/secondary/count/response.rb
|
|
168
188
|
- lib/smartystreets_ruby_sdk/us_enrichment/secondary/response.rb
|
|
@@ -180,6 +200,7 @@ files:
|
|
|
180
200
|
- lib/smartystreets_ruby_sdk/us_reverse_geo/coordinate.rb
|
|
181
201
|
- lib/smartystreets_ruby_sdk/us_reverse_geo/lookup.rb
|
|
182
202
|
- lib/smartystreets_ruby_sdk/us_reverse_geo/result.rb
|
|
203
|
+
- lib/smartystreets_ruby_sdk/us_reverse_geo/source_type.rb
|
|
183
204
|
- lib/smartystreets_ruby_sdk/us_reverse_geo/us_reverse_geo_response.rb
|
|
184
205
|
- lib/smartystreets_ruby_sdk/us_street.rb
|
|
185
206
|
- lib/smartystreets_ruby_sdk/us_street/analysis.rb
|
|
@@ -219,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
219
240
|
- !ruby/object:Gem::Version
|
|
220
241
|
version: '0'
|
|
221
242
|
requirements: []
|
|
222
|
-
rubygems_version: 3.
|
|
243
|
+
rubygems_version: 3.5.22
|
|
223
244
|
signing_key:
|
|
224
245
|
specification_version: 4
|
|
225
246
|
summary: An official library for the SmartyStreets APIs
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: Ruby Gem Publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- '*'
|
|
7
|
-
jobs:
|
|
8
|
-
publish:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
env:
|
|
11
|
-
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
with:
|
|
16
|
-
fetch-depth: 0
|
|
17
|
-
|
|
18
|
-
- uses: ruby/setup-ruby@v1
|
|
19
|
-
with:
|
|
20
|
-
ruby-version: '3.2'
|
|
21
|
-
bundler-cache: false
|
|
22
|
-
|
|
23
|
-
- name: Publish
|
|
24
|
-
run: |
|
|
25
|
-
VERSION=${GITHUB_REF#refs/*/} API_KEY=${{ secrets.GEM_HOST_API_KEY }} make publish
|
|
26
|
-
env:
|
|
27
|
-
API_KEY: "${{ secrets.GEM_HOST_API_KEY }}"
|