smartystreets_ruby_sdk 10.0.0 → 10.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6dfe1e04d687c3c2b33c116f12115c921092875761773196e70b05686642147d
4
- data.tar.gz: c48c629d5c11195f679fe264b0fe4557e0fc78355e8f51b3ff62ebc463f27da8
3
+ metadata.gz: 451e124efa79d87aed1df0f4a4a595b698463835d8ffc4461168d439da9e2b56
4
+ data.tar.gz: dbd7c8c731275bd1bc62e8fb0cc0e930e18ad0ce886b26e8bd570f84f0a4f4a7
5
5
  SHA512:
6
- metadata.gz: 1fdef4159968f9cdfd3a6e67afefc68ffdddbf527bc4331f424410274b27812c1cfce78c18ca81e8a3ccc817d4b0db267513a116c55e182d43e71e8ffee694c8
7
- data.tar.gz: 5fc398cc1452df089d87f0f13869b6ead3ebe387a9698d47881a064b498b8a10b992381e5ec26d95626e0dfdceb56ec47833f15e91601a60f6bbb9de513c4a6c
6
+ metadata.gz: 8e4c92f2f87638cfb7ae504599040b5745eec1d6553333409648077e5962d112f5d66a771435a78f3701d12e555d034e6821ad7d690fc97aa45214923f4b42e1
7
+ data.tar.gz: e3c2516ec819aab127324cd4ae3f211e2ec1fe363a80aa2ff490993ce3b0859cccc85c2b99244080f95b90b5ef67d32d93c104e7afd171922b50a7490eb79fdc
data/CLAUDE.md CHANGED
@@ -44,7 +44,7 @@ URLPrefixSender → CustomQuerySender → LicenseSender → RetrySender → Sign
44
44
  ```
45
45
  `CustomHeaderSender` is only included when custom headers are configured; `RetrySender` only when max_retries > 0.
46
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`.
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`. Embedded/website keys are GET-only, so they are not valid for batch (POST) requests or the US Extract API (POST-only): https://www.smarty.com/docs/cloud/authentication
48
48
 
49
49
  ### Key Components
50
50
 
@@ -4,9 +4,11 @@ require '../lib/smartystreets_ruby_sdk/basic_auth_credentials'
4
4
  require '../lib/smartystreets_ruby_sdk/client_builder'
5
5
  require '../lib/smartystreets_ruby_sdk/international_autocomplete/lookup'
6
6
  require '../lib/smartystreets_ruby_sdk/international_autocomplete/client'
7
+ require '../lib/smartystreets_ruby_sdk/international_autocomplete/language_mode'
7
8
 
8
9
  class InternationalAutocompleteExample
9
10
  Lookup = SmartyStreets::InternationalAutocomplete::Lookup
11
+ LanguageMode = SmartyStreets::InternationalAutocomplete::LanguageMode
10
12
 
11
13
  def run
12
14
  # key = 'Your SmartyStreets Auth Key here'
@@ -30,6 +32,7 @@ class InternationalAutocompleteExample
30
32
  lookup.locality = "Paris"
31
33
  lookup.max_group_results = 5
32
34
  lookup.geolocation = true
35
+ lookup.language = LanguageMode::NATIVE
33
36
 
34
37
  # lookup.add_custom_parameter('parameter', 'value')
35
38
 
@@ -1,5 +1,4 @@
1
1
  require '../lib/smartystreets_ruby_sdk/static_credentials'
2
- require '../lib/smartystreets_ruby_sdk/shared_credentials'
3
2
  require '../lib/smartystreets_ruby_sdk/basic_auth_credentials'
4
3
  require '../lib/smartystreets_ruby_sdk/client_builder'
5
4
  require '../lib/smartystreets_ruby_sdk/us_extract/lookup'
@@ -10,12 +9,10 @@ class USExtractExample
10
9
  Lookup = SmartyStreets::USExtract::Lookup
11
10
 
12
11
  def run
13
- # key = 'Your SmartyStreets Auth Key here'
14
- # referer = 'Your host name here'
15
- # We recommend storing your secret keys in environment variables instead---it's safer!
16
- # key = ENV['SMARTY_AUTH_WEB']
17
- # referer = ENV['SMARTY_AUTH_REFERER']
18
- # credentials = SmartyStreets::SharedCredentials.new(key, referer)
12
+ # We recommend storing your secret keys in environment variables.
13
+ #
14
+ # The US Extract API is POST-only and embedded keys are restricted to GET, so this
15
+ # API requires secret keys: https://www.smarty.com/docs/cloud/authentication
19
16
 
20
17
  id = ENV['SMARTY_AUTH_ID']
21
18
  token = ENV['SMARTY_AUTH_TOKEN']
@@ -1,5 +1,4 @@
1
1
  require '../lib/smartystreets_ruby_sdk/static_credentials'
2
- require '../lib/smartystreets_ruby_sdk/shared_credentials'
3
2
  require '../lib/smartystreets_ruby_sdk/basic_auth_credentials'
4
3
  require '../lib/smartystreets_ruby_sdk/client_builder'
5
4
  require '../lib/smartystreets_ruby_sdk/batch'
@@ -11,7 +10,11 @@ class USStreetLookupsWithMatchStrategyExample
11
10
  MatchType = SmartyStreets::USStreet::MatchType
12
11
 
13
12
  def run
14
- # We recommend storing your secret keys in environment variables instead---it's safer!
13
+ # We recommend storing your secret keys in environment variables.
14
+ #
15
+ # Batch requests are sent via HTTP POST. Embedded keys are restricted to GET, so
16
+ # batches require secret keys: https://www.smarty.com/docs/cloud/authentication
17
+
15
18
  id = ENV['SMARTY_AUTH_ID']
16
19
  token = ENV['SMARTY_AUTH_TOKEN']
17
20
  credentials = SmartyStreets::BasicAuthCredentials.new(id, token)
@@ -1,5 +1,4 @@
1
1
  require '../lib/smartystreets_ruby_sdk/static_credentials'
2
- require '../lib/smartystreets_ruby_sdk/shared_credentials'
3
2
  require '../lib/smartystreets_ruby_sdk/basic_auth_credentials'
4
3
  require '../lib/smartystreets_ruby_sdk/client_builder'
5
4
  require '../lib/smartystreets_ruby_sdk/batch'
@@ -10,12 +9,10 @@ class USStreetMultipleAddressExample
10
9
  Lookup = SmartyStreets::USStreet::Lookup
11
10
 
12
11
  def run
13
- # key = 'Your SmartyStreets Auth Key here'
14
- # referer = 'Your host name here'
15
- # We recommend storing your secret keys in environment variables instead---it's safer!
16
- # key = ENV['SMARTY_AUTH_WEB']
17
- # referer = ENV['SMARTY_AUTH_REFERER']
18
- # credentials = SmartyStreets::SharedCredentials.new(key, referer)
12
+ # We recommend storing your secret keys in environment variables.
13
+ #
14
+ # Batch requests are sent via HTTP POST. Embedded keys are restricted to GET, so
15
+ # batches require secret keys: https://www.smarty.com/docs/cloud/authentication
19
16
 
20
17
  id = ENV['SMARTY_AUTH_ID']
21
18
  token = ENV['SMARTY_AUTH_TOKEN']
@@ -1,5 +1,4 @@
1
1
  require '../lib/smartystreets_ruby_sdk/static_credentials'
2
- require '../lib/smartystreets_ruby_sdk/shared_credentials'
3
2
  require '../lib/smartystreets_ruby_sdk/basic_auth_credentials'
4
3
  require '../lib/smartystreets_ruby_sdk/client_builder'
5
4
  require '../lib/smartystreets_ruby_sdk/batch'
@@ -9,12 +8,10 @@ class USZipcodeMultipleLookupExample
9
8
  Lookup = SmartyStreets::USZipcode::Lookup
10
9
 
11
10
  def run
12
- # key = 'Your SmartyStreets Auth Key here'
13
- # referer = 'Your host name here'
14
- # We recommend storing your secret keys in environment variables instead---it's safer!
15
- # key = ENV['SMARTY_AUTH_WEB']
16
- # referer = ENV['SMARTY_AUTH_REFERER']
17
- # credentials = SmartyStreets::SharedCredentials.new(key, referer)
11
+ # We recommend storing your secret keys in environment variables.
12
+ #
13
+ # Batch requests are sent via HTTP POST. Embedded keys are restricted to GET, so
14
+ # batches require secret keys: https://www.smarty.com/docs/cloud/authentication
18
15
 
19
16
  id = ENV['SMARTY_AUTH_ID']
20
17
  token = ENV['SMARTY_AUTH_TOKEN']
@@ -1,6 +1,7 @@
1
1
  require_relative '../request'
2
2
  require_relative '../exceptions'
3
3
  require_relative 'suggestion'
4
+ require_relative 'language_mode'
4
5
 
5
6
  module SmartyStreets
6
7
  module InternationalAutocomplete
@@ -43,6 +44,7 @@ module SmartyStreets
43
44
  add_parameter(request, 'geolocation', 'on') if lookup.geolocation
44
45
  add_parameter(request, 'include_only_locality', lookup.locality)
45
46
  add_parameter(request, 'include_only_postal_code', lookup.postal_code)
47
+ add_parameter(request, 'language', normalized_language(lookup.language))
46
48
 
47
49
  for key in lookup.custom_param_hash.keys do
48
50
  add_parameter(request, key, lookup.custom_param_hash[key])
@@ -65,6 +67,12 @@ module SmartyStreets
65
67
  def add_parameter(request, key, value)
66
68
  request.parameters[key] = value unless value.nil? or value.empty?
67
69
  end
70
+
71
+ def normalized_language(language)
72
+ return nil if language.nil?
73
+
74
+ LanguageMode.from_value(language).value
75
+ end
68
76
  end
69
77
  end
70
78
  end
@@ -0,0 +1,26 @@
1
+ require_relative '../exceptions'
2
+
3
+ module SmartyStreets
4
+ module InternationalAutocomplete
5
+ # A closed set of valid Language values, the closest Ruby equivalent to an enum: a fixed set of frozen
6
+ # instances rather than an arbitrary string.
7
+ class LanguageMode < Data.define(:value)
8
+ NATIVE = new('native')
9
+ LATIN = new('latin')
10
+
11
+ ALL = [NATIVE, LATIN].freeze
12
+
13
+ # Resolves a LanguageMode instance or a raw value (eg. from user input or config) into a LanguageMode,
14
+ # matching 'native'/'latin' regardless of case.
15
+ def self.from_value(value)
16
+ return value if value.is_a?(LanguageMode)
17
+
18
+ match = ALL.find { |mode| mode.value.casecmp?(value.to_s) }
19
+ raise SmartyStreets::UnprocessableEntityError,
20
+ "invalid Language value; must be unset, 'native', or 'latin' (case-insensitive)" if match.nil?
21
+
22
+ match
23
+ end
24
+ end
25
+ end
26
+ end
@@ -4,9 +4,13 @@ module SmartyStreets
4
4
  module InternationalAutocomplete
5
5
  # In addition to holding all of the input data for this lookup, this class also will contain the result
6
6
  # of the lookup after it comes back from the API.
7
+ #
8
+ # @language:: When not set, the output language will match the default for the country.
9
+ # When set to language_mode.NATIVE, the results will always be in the language of the output country.
10
+ # When set to language_mode.LATIN, the results will always be provided using a Latin character set.
7
11
  class Lookup < JSONAble
8
12
 
9
- attr_accessor :result, :search, :address_id, :country, :max_results, :max_group_results, :geolocation, :locality, :postal_code, :custom_param_hash
13
+ attr_accessor :result, :search, :address_id, :country, :max_results, :max_group_results, :geolocation, :locality, :postal_code, :language, :custom_param_hash
10
14
 
11
15
  def initialize(search = nil, address_id = nil, country = nil, max_results = nil, max_group_results = 100, geolocation = false, locality = nil, postal_code = nil, custom_param_hash = nil)
12
16
  @result = []
@@ -18,6 +22,7 @@ module SmartyStreets
18
22
  @geolocation = geolocation
19
23
  @locality = locality
20
24
  @postal_code = postal_code
25
+ @language = nil
21
26
  @custom_param_hash = {}
22
27
  end
23
28
 
@@ -1,6 +1,7 @@
1
1
  require_relative './international_autocomplete/lookup'
2
2
  require_relative './international_autocomplete/suggestion'
3
3
  require_relative './international_autocomplete/client'
4
+ require_relative './international_autocomplete/language_mode'
4
5
 
5
6
  module SmartyStreets
6
7
  module InternationalAutocomplete
@@ -1,3 +1,3 @@
1
1
  module SmartyStreets
2
- VERSION = '10.0.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
+ VERSION = '10.1.0' # 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: 10.0.0
4
+ version: 10.1.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-08-19 00:00:00.000000000 Z
11
+ date: 2026-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - lib/smartystreets_ruby_sdk/exceptions.rb
124
124
  - lib/smartystreets_ruby_sdk/international_autocomplete.rb
125
125
  - lib/smartystreets_ruby_sdk/international_autocomplete/client.rb
126
+ - lib/smartystreets_ruby_sdk/international_autocomplete/language_mode.rb
126
127
  - lib/smartystreets_ruby_sdk/international_autocomplete/lookup.rb
127
128
  - lib/smartystreets_ruby_sdk/international_autocomplete/suggestion.rb
128
129
  - lib/smartystreets_ruby_sdk/international_postal_code.rb