smartystreets_ruby_sdk 5.15.0 → 5.15.2

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: b0e838026d2929cc93753f68028a627cfc27b88aac72c3a6f18cd2bb56af329f
4
- data.tar.gz: 994ce9600b681bb8e3c6f8f9fe3ce550ee32458d29d1031117eb8fb759fa12cc
3
+ metadata.gz: b5944e621370acbcf6d73b8afd75b7b0c121c6adb52583537633aa105fed6b91
4
+ data.tar.gz: e898c584b4ccaaeea6097d150bc3d5861473a4c737cb69bc66ac6cab7be5baf9
5
5
  SHA512:
6
- metadata.gz: 30f09657b5bb1c0e8829e1c7b5ea1749a72c47af67ef1090c53b92d8d3f1ab2df94036e686d1f1003f206dc86131d3a65fe40a1d3c5f9b4c463527bb42df5a16
7
- data.tar.gz: e1f5304bdb29e16c16cf25cef97cb2620ae7d49a996955f8e02a474430095afe06cde8e276245477bd37c6ef3c907b2f4fce53501f06303c3c5effee2cf213e5
6
+ metadata.gz: 0bd9226708e789ad813dd0d0ba8420f2fd9e62e5236c2cd0f4c610cb5cd3ba49547cbabb8ba22495d5e6fc8cb9f4a2ea330f1256ca7e3cefa26fbe1acf865e26
7
+ data.tar.gz: 3cbe88495767cd74f8d91779ae7bec833281626a4bae7f113d8d8329d4406d5243ae6e9ad95dcd1e1caa28b580c289a3c271914dd808ec4bbaaa7fb72564f7a0
@@ -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
 
@@ -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,10 @@ 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
+ end
9
14
  end
10
15
  end
@@ -1,3 +1,3 @@
1
1
  module SmartyStreets
2
- VERSION = '5.15.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
+ VERSION = '5.15.2' # 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.15.0
4
+ version: 5.15.2
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-07-06 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