smartystreets_ruby_sdk 7.1.0 → 7.2.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
  SHA256:
3
- metadata.gz: bc3db7f4c7f68cb320bdee89b5b56b31dc769980dfbb1f8c8ae2eba8e564c324
4
- data.tar.gz: 4caffa1852baa2da752d26382b0c9b1f8e92de07a66d3b55f3f611c46fd5298e
3
+ metadata.gz: 56b7843bee25e0bea8668ed813993642aa247daa98eccd615e6d20d6fab1207b
4
+ data.tar.gz: ae6176580f1b7afffe2b94f7e6eb6c31fd539d6c9099177c61dc2fb95cfea3da
5
5
  SHA512:
6
- metadata.gz: ff7d3b8ddca08f7a06dcfc49962c713a62645dea98fb7a7b0c103ebf438b84cdb2889805cb537050583ef322160801cc0074ad2e6c4172003aaff27d844d1225
7
- data.tar.gz: 3ee69a43f44e9dbb47498c4b59e1105986f6f9a3759b6c1e8cf746f38dddea095613d08b658028914ac70ab604ac84bd16eb485ba33342995c50c63eb9614b98
6
+ metadata.gz: 3de4fe9934225c46a7ad970e8062f2e5af69237a7976f15879ffeec9048b60f8a9a3ec31dfcb4cf36799673ce5a5269b135edc7204b8e159d6912f59eb60c80f
7
+ data.tar.gz: b6f808ffd6f4a79c0936c3683d94403425fd9232b0f05e00a9843ad2cb61dbe77fdd5411f79d6ad8e0c9c8a69a5c0edba278fb416ed77176dc411be05fda05c7
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 us_street_component_analysis_example.rb
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 result[0].inspect
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 values.respond_to? :each
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
@@ -56,7 +56,7 @@ module SmartyStreets
56
56
  converted_lookup['candidates'] = 5
57
57
  end
58
58
 
59
- converted_lookup['match'] = match_strategy if match_strategy != MatchType::STRICT
59
+ converted_lookup['match'] = match_strategy
60
60
 
61
61
  converted_lookup['input_id'] = lookup.input_id
62
62
  converted_lookup['street'] = lookup.street
@@ -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, :is_an_ews_match
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
@@ -1,3 +1,3 @@
1
1
  module SmartyStreets
2
- VERSION = '7.1.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
+ VERSION = '7.2.1' # DO NOT EDIT (this is updated by a build job when a new release is published)
3
3
  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.1.0
4
+ version: 7.2.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: 2026-02-07 00:00:00.000000000 Z
11
+ date: 2026-03-06 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