smartystreets_ruby_sdk 5.14.22 → 5.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e72e7fe2acaced930d16971827d0d03f873841fa21d696a7199f6f675bf9bcb4
4
- data.tar.gz: a406b8824048bd60f46ab3d8b90c616c9a3d90a8e56a48fe7fe0d5107b1227c7
3
+ metadata.gz: 05d6a0df50a6639ed4941e02cdae2164fdcf14eba8ff16fef88cf9433b36d686
4
+ data.tar.gz: 10ab92e972f454ff59ff4d0ebebefc6e761132749adbeb75a40ef4feda3283cf
5
5
  SHA512:
6
- metadata.gz: db8b4fba0496780c09d76da886cfaf9f11f9f0ce17617052b462934ce5d534f30dca758bd03f5705b0936bae2995a3655c1afcbc795c0aebbae87abb9f863c45
7
- data.tar.gz: 339aae0de4aae8973bbb7dfd0c075b501ab2d001d9d84f439cdc2f32f7196c06288b57ecd6fa3bea5ce69db177f5996219588818448c7a2d82e45f3fbc973f71
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.send(lookup) # The candidates are also stored in the lookup's 'result' field.
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.smartystreets.com/verify'.freeze
26
- INTERNATIONAL_AUTOCOMPLETE_API_URL = "https://international-autocomplete.api.smartystreets.com/lookup".freeze
27
- US_AUTOCOMPLETE_API_URL = 'https://us-autocomplete.api.smartystreets.com/suggest'.freeze
28
- US_AUTOCOMPLETE_PRO_API_URL = 'https://us-autocomplete-pro.api.smartystreets.com/lookup'.freeze
29
- US_EXTRACT_API_URL = 'https://us-extract.api.smartystreets.com/'.freeze
30
- US_STREET_API_URL = 'https://us-street.api.smartystreets.com/street-address'.freeze
31
- US_ZIP_CODE_API_URL = 'https://us-zipcode.api.smartystreets.com/lookup'.freeze
32
- US_REVERSE_GEO_API_URL = 'https://us-reverse-geo.api.smartystreets.com/lookup'.freeze
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
 
@@ -14,7 +14,7 @@ module SmartyStreets
14
14
  def send(request)
15
15
  response = @inner.send(request)
16
16
 
17
- (0..@max_retries-1).each do |i|
17
+ (1..@max_retries).each do |i|
18
18
 
19
19
  break if STATUS_TO_RETRY.include?(response.status_code.to_i) == false
20
20
 
@@ -6,8 +6,8 @@ module SmartyStreets
6
6
  module USStreet
7
7
  # See "https://smartystreets.com/docs/cloud/us-street-api#metadata"
8
8
  class Candidate
9
- attr_reader :input_id, :input_index, :candidate_index, :addressee, :delivery_line_1, :delivery_line_2, :delivery_point_barcode,
10
- :last_line, :metadata, :components, :analysis
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
11
11
 
12
12
  def initialize(obj)
13
13
  @input_id = obj['input_id']
@@ -18,6 +18,7 @@ module SmartyStreets
18
18
  @delivery_line_2 = obj['delivery_line_2']
19
19
  @last_line = obj['last_line']
20
20
  @delivery_point_barcode = obj['delivery_point_barcode']
21
+ @smarty_key = obj['smarty_key']
21
22
  @components = Components.new(obj.fetch('components', {}))
22
23
  @metadata = Metadata.new(obj.fetch('metadata', {}))
23
24
  @analysis = Analysis.new(obj.fetch('analysis', {}))
@@ -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
@@ -6,5 +6,11 @@ module SmartyStreets
6
6
  INVALID = 'invalid'.freeze
7
7
  ENHANCED = 'enhanced'.freeze
8
8
  end
9
+
10
+ module OutputFormat
11
+ DEFAULT = 'default'.freeze
12
+ PROJECT_USA = 'project-usa'.freeze
13
+ CASS = 'cass'.freeze
14
+ end
9
15
  end
10
16
  end
@@ -1,3 +1,3 @@
1
1
  module SmartyStreets
2
- VERSION = '5.14.22' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
+ VERSION = '5.15.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: 5.14.22
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-06-27 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler