smartystreets_ruby_sdk 7.0.0 → 7.2.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 +4 -0
- data/CLAUDE.md +5 -2
- data/Makefile +1 -1
- data/examples/us_enrichment_example.rb +61 -4
- data/examples/us_street_iana_timezone_example.rb +54 -0
- data/lib/smartystreets_ruby_sdk/client_builder.rb +20 -1
- data/lib/smartystreets_ruby_sdk/custom_header_sender.rb +4 -2
- data/lib/smartystreets_ruby_sdk/native_sender.rb +7 -3
- data/lib/smartystreets_ruby_sdk/request.rb +2 -1
- data/lib/smartystreets_ruby_sdk/us_street/metadata.rb +5 -1
- data/lib/smartystreets_ruby_sdk/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2fe64aee0f04fb24de988f8d76f5f922befc65b50b9ce4aff450add95e1ae9c
|
|
4
|
+
data.tar.gz: ce1bb5f95af3e1b4493525f5d6039a59f1110e134587a1a5e494b55961395300
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 186de2a1abbc0f62efc80be190f195df5341df523f88e92a7ad37edb95b28fdfae93395e16302ca79376b9dd534ab7928475f981c963923ca60edf277509b17c
|
|
7
|
+
data.tar.gz: f5a5c41a29c2b77f5c8e5b0405d70b872e74447a0ebe9e39e49b0f44dfb89d3525a449ca6953792d22de7bd7ff0b4d19c89e5ec3fb3f6ba97369511e2d6515d1
|
data/.claude/settings.json
CHANGED
data/CLAUDE.md
CHANGED
|
@@ -38,10 +38,13 @@ client = SmartyStreets::ClientBuilder.new(credentials)
|
|
|
38
38
|
.build_us_street_api_client
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
**Chain of Responsibility**: HTTP requests flow through a middleware chain of "Sender" objects. Each sender wraps an inner sender:
|
|
41
|
+
**Chain of Responsibility**: HTTP requests flow through a middleware chain of "Sender" objects. Each sender wraps an inner sender (outermost to innermost):
|
|
42
42
|
```
|
|
43
|
-
URLPrefixSender → LicenseSender → RetrySender → SigningSender → StatusCodeSender → NativeSender
|
|
43
|
+
URLPrefixSender → CustomQuerySender → LicenseSender → RetrySender → SigningSender → CustomHeaderSender → StatusCodeSender → NativeSender
|
|
44
44
|
```
|
|
45
|
+
`CustomHeaderSender` is only included when custom headers are configured; `RetrySender` only when max_retries > 0.
|
|
46
|
+
|
|
47
|
+
**Authentication**: Three credential types — `StaticCredentials` (auth-id/auth-token), `SharedCredentials` (website key/hostname), and `BasicAuthCredentials` (basic auth header). Credentials are passed to `ClientBuilder` and injected into the sender chain via `SigningSender`.
|
|
45
48
|
|
|
46
49
|
### Key Components
|
|
47
50
|
|
data/Makefile
CHANGED
|
@@ -46,7 +46,7 @@ us_reverse_geo_api:
|
|
|
46
46
|
cd examples && ruby us_reverse_geo_example.rb
|
|
47
47
|
|
|
48
48
|
us_street_api:
|
|
49
|
-
cd examples && ruby us_street_single_address_example.rb && ruby us_street_multiple_address_example.rb && ruby us_street_component_analysis_example.rb && ruby
|
|
49
|
+
cd examples && ruby us_street_single_address_example.rb && ruby us_street_multiple_address_example.rb && ruby us_street_component_analysis_example.rb && ruby us_street_iana_timezone_example.rb
|
|
50
50
|
|
|
51
51
|
us_zipcode_api:
|
|
52
52
|
cd examples && ruby us_zipcode_single_lookup_example.rb && ruby us_zipcode_multiple_lookup_example.rb
|
|
@@ -44,8 +44,6 @@ class USEnrichmentAddressExample
|
|
|
44
44
|
freeform_lookup = SmartyStreets::USEnrichment::Lookup.new
|
|
45
45
|
freeform_lookup.freeform = "56 Union Ave Somerville NJ 08876"
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
47
|
begin
|
|
50
48
|
# Send a lookup with a smarty key using the line below
|
|
51
49
|
# result = client.send_property_principal_lookup("325023201")
|
|
@@ -70,8 +68,67 @@ class USEnrichmentAddressExample
|
|
|
70
68
|
return
|
|
71
69
|
end
|
|
72
70
|
|
|
73
|
-
puts "Lookup Successful! Here is the result:
|
|
74
|
-
puts
|
|
71
|
+
puts "Lookup Successful! Here is the result:"
|
|
72
|
+
puts
|
|
73
|
+
|
|
74
|
+
response = result[0]
|
|
75
|
+
attrs = response.attributes
|
|
76
|
+
|
|
77
|
+
puts "Smarty Key: #{response.smarty_key}"
|
|
78
|
+
puts "Data Set: #{response.data_set_name}/#{response.data_subset_name}"
|
|
79
|
+
puts "ETag: #{response.etag}"
|
|
80
|
+
puts
|
|
81
|
+
|
|
82
|
+
puts "Property Address:"
|
|
83
|
+
puts "\tFull Address: #{attrs.property_address_full}"
|
|
84
|
+
puts "\tCity: #{attrs.property_address_city}"
|
|
85
|
+
puts "\tState: #{attrs.property_address_state}"
|
|
86
|
+
puts "\tZIP: #{attrs.property_address_zipcode}"
|
|
87
|
+
puts
|
|
88
|
+
|
|
89
|
+
puts "Owner:"
|
|
90
|
+
puts "\tName: #{attrs.owner_full_name}"
|
|
91
|
+
puts "\tOccupancy: #{attrs.owner_occupancy_status}"
|
|
92
|
+
puts
|
|
93
|
+
|
|
94
|
+
puts "Property Details:"
|
|
95
|
+
puts "\tLand Use: #{attrs.land_use_standard}"
|
|
96
|
+
puts "\tYear Built: #{attrs.year_built}"
|
|
97
|
+
puts "\tBuilding Sqft: #{attrs.building_sqft}"
|
|
98
|
+
puts "\tLot Sqft: #{attrs.lot_sqft}"
|
|
99
|
+
puts "\tAcres: #{attrs.acres}"
|
|
100
|
+
puts "\tBathrooms: #{attrs.bathrooms_total}"
|
|
101
|
+
puts "\tBedrooms: #{attrs.bedrooms}"
|
|
102
|
+
puts "\tStories: #{attrs.stories_number}"
|
|
103
|
+
puts "\tFireplace: #{attrs.fireplace}"
|
|
104
|
+
puts "\tGarage: #{attrs.garage}"
|
|
105
|
+
puts
|
|
106
|
+
|
|
107
|
+
puts "Assessment:"
|
|
108
|
+
puts "\tAssessed Value: #{attrs.assessed_value}"
|
|
109
|
+
puts "\tTotal Market Value: #{attrs.total_market_value}"
|
|
110
|
+
puts "\tTax Year: #{attrs.tax_assess_year}"
|
|
111
|
+
puts "\tTax Billed: #{attrs.tax_billed_amount}"
|
|
112
|
+
puts
|
|
113
|
+
|
|
114
|
+
puts "Location:"
|
|
115
|
+
puts "\tCounty: #{attrs.situs_county}"
|
|
116
|
+
puts "\tLatitude: #{attrs.latitude}"
|
|
117
|
+
puts "\tLongitude: #{attrs.longitude}"
|
|
118
|
+
puts "\tElevation (ft): #{attrs.elevation_feet}"
|
|
119
|
+
puts
|
|
120
|
+
|
|
121
|
+
unless attrs.financial_history.nil? || attrs.financial_history.empty?
|
|
122
|
+
puts "Financial History (#{attrs.financial_history.length} entries):"
|
|
123
|
+
attrs.financial_history.each_with_index do |entry, i|
|
|
124
|
+
puts "\tEntry #{i + 1}:"
|
|
125
|
+
puts "\t\tDocument Type: #{entry.document_type_description}"
|
|
126
|
+
puts "\t\tLender: #{entry.lender_name}"
|
|
127
|
+
puts "\t\tMortgage Amount: #{entry.mortgage_amount}"
|
|
128
|
+
puts "\t\tMortgage Type: #{entry.mortgage_type}"
|
|
129
|
+
puts "\t\tRecording Date: #{entry.mortgage_recording_date}"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
75
132
|
end
|
|
76
133
|
end
|
|
77
134
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require '../lib/smartystreets_ruby_sdk/static_credentials'
|
|
2
|
+
require '../lib/smartystreets_ruby_sdk/shared_credentials'
|
|
3
|
+
require '../lib/smartystreets_ruby_sdk/basic_auth_credentials'
|
|
4
|
+
require '../lib/smartystreets_ruby_sdk/client_builder'
|
|
5
|
+
require '../lib/smartystreets_ruby_sdk/us_street/lookup'
|
|
6
|
+
require '../lib/smartystreets_ruby_sdk/us_street/match_type'
|
|
7
|
+
|
|
8
|
+
class USStreetIANATimezoneExample
|
|
9
|
+
def run
|
|
10
|
+
# For client-side requests (browser/mobile), use this code:
|
|
11
|
+
# key = ENV['SMARTY_AUTH_WEB']
|
|
12
|
+
# referer = ENV['SMARTY_AUTH_REFERER']
|
|
13
|
+
# credentials = SmartyStreets::SharedCredentials.new(key, referer)
|
|
14
|
+
|
|
15
|
+
# For server-to-server requests, use this code:
|
|
16
|
+
id = ENV['SMARTY_AUTH_ID']
|
|
17
|
+
token = ENV['SMARTY_AUTH_TOKEN']
|
|
18
|
+
credentials = SmartyStreets::BasicAuthCredentials.new(id, token)
|
|
19
|
+
|
|
20
|
+
client = SmartyStreets::ClientBuilder.new(credentials)
|
|
21
|
+
.with_feature_iana_time_zone()
|
|
22
|
+
.build_us_street_api_client
|
|
23
|
+
|
|
24
|
+
lookup = SmartyStreets::USStreet::Lookup.new
|
|
25
|
+
lookup.street = "1 Rosedale"
|
|
26
|
+
lookup.secondary = "APT 2"
|
|
27
|
+
lookup.city = "Baltimore"
|
|
28
|
+
lookup.state = "MD"
|
|
29
|
+
lookup.zipcode = "21229"
|
|
30
|
+
lookup.match = SmartyStreets::USStreet::MatchType::ENHANCED
|
|
31
|
+
|
|
32
|
+
begin
|
|
33
|
+
client.send_lookup(lookup)
|
|
34
|
+
rescue SmartyStreets::SmartyError => err
|
|
35
|
+
puts err
|
|
36
|
+
return
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
result = lookup.result
|
|
40
|
+
|
|
41
|
+
if result.empty?
|
|
42
|
+
return
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
first_candidate = result[0]
|
|
46
|
+
|
|
47
|
+
puts "IANA Time Zone: #{first_candidate.metadata.iana_time_zone}"
|
|
48
|
+
puts "IANA UTC Offset: #{first_candidate.metadata.iana_utc_offset}"
|
|
49
|
+
puts "IANA Obeys DST: #{first_candidate.metadata.iana_obeys_dst}"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
example = USStreetIANATimezoneExample.new
|
|
54
|
+
example.run
|
|
@@ -44,6 +44,7 @@ module SmartyStreets
|
|
|
44
44
|
@url_prefix = nil
|
|
45
45
|
@proxy = nil
|
|
46
46
|
@header = nil
|
|
47
|
+
@append_headers = {}
|
|
47
48
|
@licenses = %w()
|
|
48
49
|
@debug = nil
|
|
49
50
|
@queries = {}
|
|
@@ -105,6 +106,18 @@ module SmartyStreets
|
|
|
105
106
|
# Returns self to accommodate method chaining.
|
|
106
107
|
def with_custom_headers(header)
|
|
107
108
|
@header = header
|
|
109
|
+
@append_headers = {}
|
|
110
|
+
self
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Appends the provided value to the existing header value using the specified separator,
|
|
114
|
+
# rather than adding a separate header value. This is useful for single-value headers like User-Agent.
|
|
115
|
+
#
|
|
116
|
+
# Returns self to accommodate method chaining.
|
|
117
|
+
def with_appended_header(key, value, separator)
|
|
118
|
+
@header = {} if @header.nil?
|
|
119
|
+
@append_headers[key] = separator
|
|
120
|
+
@header[key] = (@header[key] || []).concat([value])
|
|
108
121
|
self
|
|
109
122
|
end
|
|
110
123
|
|
|
@@ -141,6 +154,12 @@ module SmartyStreets
|
|
|
141
154
|
self
|
|
142
155
|
end
|
|
143
156
|
|
|
157
|
+
# with_feature_iana_time_zone turns on the IANA timezone feature for the request.
|
|
158
|
+
def with_feature_iana_time_zone()
|
|
159
|
+
self.with_custom_comma_separated_query("features", "iana-timezone")
|
|
160
|
+
self
|
|
161
|
+
end
|
|
162
|
+
|
|
144
163
|
# Enables debug mode, which will print information about the HTTP request and response to $stdout.
|
|
145
164
|
#
|
|
146
165
|
# Returns self to accommodate method chaining.
|
|
@@ -205,7 +224,7 @@ module SmartyStreets
|
|
|
205
224
|
|
|
206
225
|
sender = StatusCodeSender.new(sender)
|
|
207
226
|
|
|
208
|
-
sender = CustomHeaderSender.new(sender, @header) unless @header.nil?
|
|
227
|
+
sender = CustomHeaderSender.new(sender, @header, @append_headers) unless @header.nil?
|
|
209
228
|
|
|
210
229
|
sender = SigningSender.new(@signer, sender) unless @signer.nil?
|
|
211
230
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
module SmartyStreets
|
|
2
2
|
class CustomHeaderSender
|
|
3
|
-
def initialize(inner, header)
|
|
3
|
+
def initialize(inner, header, append_headers = {})
|
|
4
4
|
@inner = inner
|
|
5
5
|
@header = header
|
|
6
|
+
@append_headers = append_headers || {}
|
|
6
7
|
end
|
|
7
8
|
|
|
8
9
|
def send(request)
|
|
9
|
-
request.header = @header
|
|
10
|
+
request.header = @header.transform_values(&:dup)
|
|
11
|
+
request.append_headers = @append_headers.dup
|
|
10
12
|
@inner.send(request)
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -48,7 +48,7 @@ module SmartyStreets
|
|
|
48
48
|
request['User-Agent'] = "smartystreets (sdk:ruby@#{SmartyStreets::VERSION})"
|
|
49
49
|
request['Referer'] = smarty_request.referer unless smarty_request.referer.nil?
|
|
50
50
|
request.basic_auth(smarty_request.basic_auth[0], smarty_request.basic_auth[1]) unless smarty_request.basic_auth.nil?
|
|
51
|
-
set_custom_headers(smarty_request.header, request)
|
|
51
|
+
set_custom_headers(smarty_request.header, request, smarty_request.append_headers)
|
|
52
52
|
request
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -79,9 +79,13 @@ module SmartyStreets
|
|
|
79
79
|
URI.encode_www_form(smarty_request.parameters)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
def self.set_custom_headers(smarty_header, request)
|
|
82
|
+
def self.set_custom_headers(smarty_header, request, append_headers = {})
|
|
83
83
|
smarty_header.each do |key, values|
|
|
84
|
-
if
|
|
84
|
+
if append_headers.key?(key)
|
|
85
|
+
separator = append_headers[key]
|
|
86
|
+
joined = values.respond_to?(:join) ? values.join(separator) : values.to_s
|
|
87
|
+
request[key] = [request[key], joined].compact.join(separator)
|
|
88
|
+
elsif values.respond_to?(:each)
|
|
85
89
|
values.each do |value|
|
|
86
90
|
request.add_field(key, value)
|
|
87
91
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module SmartyStreets
|
|
2
2
|
class Request
|
|
3
|
-
attr_accessor :parameters, :payload, :url_components, :url_prefix, :referer, :header, :content_type, :basic_auth
|
|
3
|
+
attr_accessor :parameters, :payload, :url_components, :url_prefix, :referer, :header, :append_headers, :content_type, :basic_auth
|
|
4
4
|
|
|
5
5
|
def initialize
|
|
6
6
|
@parameters = {}
|
|
@@ -9,6 +9,7 @@ module SmartyStreets
|
|
|
9
9
|
@url_components = nil
|
|
10
10
|
@referer = nil
|
|
11
11
|
@header = {}
|
|
12
|
+
@append_headers = {}
|
|
12
13
|
@content_type = 'application/json'
|
|
13
14
|
@basic_auth = nil
|
|
14
15
|
end
|
|
@@ -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
|
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: 7.
|
|
4
|
+
version: 7.2.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: 2026-
|
|
11
|
+
date: 2026-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -101,6 +101,7 @@ files:
|
|
|
101
101
|
- examples/us_extract_example.rb
|
|
102
102
|
- examples/us_reverse_geo_example.rb
|
|
103
103
|
- examples/us_street_component_analysis_example.rb
|
|
104
|
+
- examples/us_street_iana_timezone_example.rb
|
|
104
105
|
- examples/us_street_multiple_address_example.rb
|
|
105
106
|
- examples/us_street_single_address_example.rb
|
|
106
107
|
- examples/us_zipcode_multiple_lookup_example.rb
|