smartystreets_ruby_sdk 5.0.0 → 5.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.
@@ -27,6 +27,7 @@ class USAutocompleteExample
27
27
 
28
28
  puts
29
29
  puts '*** Result with some filters ***'
30
+ puts
30
31
 
31
32
  suggestions.each do |suggestion|
32
33
  puts suggestion.text
@@ -23,6 +23,8 @@ require 'smartystreets_ruby_sdk/url_prefix_sender'
23
23
  require 'smartystreets_ruby_sdk/us_extract'
24
24
  require 'smartystreets_ruby_sdk/us_street'
25
25
  require 'smartystreets_ruby_sdk/us_zipcode'
26
+ require 'smartystreets_ruby_sdk/us_autocomplete'
27
+ require 'smartystreets_ruby_sdk/international_street'
26
28
 
27
29
  module SmartyStreets
28
30
  end
@@ -1,7 +1,7 @@
1
1
  module SmartyStreets
2
2
  class RetrySender
3
3
  MAX_BACKOFF_DURATION = 10
4
- STATUS_OK = '200'.freeze
4
+ STATUS_INTERNAL_SERVER_ERROR = '500'.freeze
5
5
 
6
6
  def initialize(max_retries, inner, sleeper, logger)
7
7
  @max_retries = max_retries
@@ -14,7 +14,7 @@ module SmartyStreets
14
14
  response = @inner.send(request)
15
15
 
16
16
  (0..@max_retries-1).each do |i|
17
- break if response.status_code == STATUS_OK
17
+ break if response.status_code < STATUS_INTERNAL_SERVER_ERROR
18
18
 
19
19
  backoff(i)
20
20
 
@@ -25,6 +25,8 @@ module SmartyStreets
25
25
  RequestEntityTooLargeError.new(REQUEST_ENTITY_TOO_LARGE)
26
26
  when '400'
27
27
  BadRequestError.new(BAD_REQUEST)
28
+ when '422'
29
+ UnprocessableEntityError.new(UNPROCESSABLE_ENTITY)
28
30
  when '429'
29
31
  TooManyRequestsError.new(TOO_MANY_REQUESTS)
30
32
  when '500'
@@ -36,6 +36,7 @@ module SmartyStreets
36
36
  add_parameter(request, 'city_filter', build_filter_string(lookup.city_filter))
37
37
  add_parameter(request, 'state_filter', build_filter_string(lookup.state_filter))
38
38
  add_parameter(request, 'prefer', build_filter_string(lookup.prefer))
39
+ add_parameter(request, 'prefer_ratio', lookup.prefer_ratio.to_s)
39
40
  if lookup.geolocate_type != GeolocationType::NONE
40
41
  request.parameters['geolocate'] = 'true'
41
42
  request.parameters['geolocate_precision'] = lookup.geolocate_type
@@ -8,15 +8,17 @@ module SmartyStreets
8
8
  # See "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-request-input-fields"
9
9
  class Lookup < JSONAble
10
10
 
11
- attr_accessor :result, :prefix, :state_filter, :prefer, :max_suggestions, :geolocate_type, :city_filter
11
+ attr_accessor :result, :prefix, :state_filter, :prefer, :prefer_ratio, :max_suggestions, :geolocate_type, :city_filter
12
12
 
13
- def initialize(prefix=nil, suggestions=nil, city_filter=nil, state_filter=nil, prefer=nil, geolocate_type=nil)
13
+ def initialize(prefix=nil, suggestions=nil, city_filter=nil, state_filter=nil,
14
+ prefer=nil, prefer_ratio=nil, geolocate_type=nil)
14
15
  @result = []
15
16
  @prefix = prefix
16
17
  @max_suggestions = suggestions
17
18
  @city_filter = city_filter ? city_filter : []
18
19
  @state_filter = state_filter ? state_filter : []
19
20
  @prefer = prefer ? prefer : []
21
+ @prefer_ratio = prefer_ratio
20
22
  @geolocate_type = geolocate_type
21
23
  end
22
24
 
@@ -1,3 +1,3 @@
1
1
  module SmartyStreets
2
- VERSION = '5.0.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
+ VERSION = '5.1.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartystreets_ruby_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-06-20 00:00:00.000000000 Z
12
+ date: 2017-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler