smartystreets_ruby_sdk 5.7.0 → 5.7.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: 1863a52e98b279161d6c028994eb9a9badfad7001b274337bc2fb7f29c12ea9d
4
- data.tar.gz: 15f3567c1b708bf07dd00008eabb39d654f01acd51aa70e0edd09b674d30abd6
3
+ metadata.gz: f3f797e2c9674c76b4aa28327d6025f8dafbc03c821e4b40c33ad4b860b2b384
4
+ data.tar.gz: dcf25fb1ff0beda7ecb68dbb68fdf08ac4fdf47e1df83b71962e8bb7a514ec68
5
5
  SHA512:
6
- metadata.gz: d2e8b8ac4436bcc4d88160ffb519737f72fd3fb8795a93dec23223e7f47c364ef121c56366639e4ee0d05d3b58719412d867698138bd2b2ccaca8686dee5af85
7
- data.tar.gz: 1327e2f48a6f746636bf2016371fa3177fcbb0be5d484152fc8335a7996623375ba212d9789de7d204cfd48b09f9064cf393e1a2cc30df31661864c25a638357
6
+ metadata.gz: 5145440547a474124f14556947e1b7ada72145f6359e1b3f7e23a667418dcaf9f9c13770e1de0bc10d22a374065dc247b760151c8419d5b3587447cd1686fb55
7
+ data.tar.gz: 104c0f77fa4d74cf8e3cbad86ab5fe41a13a41f773009e0cccfad394f35d94035d717bb5f15a7db44b17c1d075cc5c763d4a4c4462bc54fe114e54ef31cb7b90
@@ -16,12 +16,24 @@ class InternationalExample
16
16
  credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
17
17
  client = SmartyStreets::ClientBuilder.new(credentials).build_international_street_api_client
18
18
 
19
- lookup = Lookup.new("Rua Padre Antonio D'Angelo 121 Casa Verde, Sao Paulo", 'Brazil')
19
+ # Documentation for input fields can be found at:
20
+ # https://smartystreets.com/docs/cloud/international-street-api
21
+
22
+ lookup = Lookup.new()
23
+ lookup.inputId = 'ID-8675309' # Optional ID from your system
20
24
  lookup.geocode = true # Must be expressly set to get latitude and longitude.
25
+ lookup.organization = 'John Doe'
26
+ lookup.address1 = "Rua Padre Antonio D'Angelo 121"
27
+ lookup.address2 = 'Casa Verde'
28
+ lookup.locality = 'Sao Paulo'
29
+ lookup.administrative_area = 'SP'
30
+ lookup.country = 'Brazil'
31
+ lookup.postal_code = '02516-050'
21
32
 
22
33
  candidates = client.send(lookup) # The candidates are also stored in the lookup's 'result' field.
23
34
 
24
35
  first_candidate = candidates[0]
36
+ puts "Input ID: #{first_candidate.input_id}"
25
37
  puts "Address is #{first_candidate.analysis.verification_status}"
26
38
  puts "Address precision: #{first_candidate.analysis.address_precision}\n\n"
27
39
  puts "First Line: #{first_candidate.address1}"
@@ -15,7 +15,12 @@ class USAutocompleteExample
15
15
 
16
16
  credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
17
17
  client = SmartyStreets::ClientBuilder.new(credentials).build_us_autocomplete_api_client
18
+
19
+ # Documentation for input fields can be found at:
20
+ # https://smartystreets.com/docs/cloud/us-autocomplete-api
21
+
18
22
  lookup = Lookup.new('4770 Lincoln Ave O')
23
+ lookup.max_suggestions = 10
19
24
 
20
25
  client.send(lookup)
21
26
 
@@ -25,8 +30,11 @@ class USAutocompleteExample
25
30
  puts suggestion.text
26
31
  end
27
32
 
33
+ lookup.add_city_filter('Ogden')
28
34
  lookup.add_state_filter('IL')
35
+ lookup.add_prefer('Ogden, IL')
29
36
  lookup.max_suggestions = 5
37
+ lookup.prefer_ratio = 0.333333
30
38
 
31
39
  suggestions = client.send(lookup) # The client will also return the suggestions directly
32
40
 
@@ -21,7 +21,13 @@ class USExtractExample
21
21
  "\r\nLos Vegas, Nevada." \
22
22
  "\r\nMeet me at 1 Rosedale Baltimore Maryland, not at 123 Phony Street, Boise Idaho."
23
23
 
24
+ # Documentation for input fields can be found at:
25
+ # https://smartystreets.com/docs/cloud/us-extract-api
26
+
24
27
  lookup = Lookup.new(text)
28
+ lookup.aggressive = true
29
+ lookup.addresses_have_line_breaks = false
30
+ lookup.addresses_per_line = 2
25
31
 
26
32
  result = client.send(lookup)
27
33
 
@@ -19,11 +19,22 @@ class USStreetMultipleAddressExample
19
19
  client = SmartyStreets::ClientBuilder.new(credentials).build_us_street_api_client
20
20
  batch = SmartyStreets::Batch.new
21
21
 
22
+ # Documentation for input fields can be found at:
23
+ # https://smartystreets.com/docs/cloud/us-street-api
24
+
22
25
  batch.add(Lookup.new)
26
+ batch[0].input_id = '8675309' # Optional ID from your system
27
+ batch[0].addressee = 'John Doe'
23
28
  batch[0].street = '1600 amphitheatre parkway'
24
- batch[0].city = 'Mountain view'
25
- batch[0].state = 'california'
26
- batch[0].match = SmartyStreets::USStreet::MatchType::INVALID
29
+ batch[0].street2 = 'second star to the right'
30
+ batch[0].secondary = 'APT 2'
31
+ batch[0].urbanization = '' # Only applies to Puerto Rico addresses
32
+ batch[0].lastline = 'Mountain view, California'
33
+ batch[0].zipcode = '21229'
34
+ batch[0].candidates = 3
35
+ batch[0].match = 'invalid'.freeze # "invalid" is the most permissive match,
36
+ # this will always return at least one result even if the address is invalid.
37
+ # Refer to the documentation for additional Match Strategy options.
27
38
 
28
39
  batch.add(Lookup.new('1 Rosedale, Baltimore, Maryland')) # Freeform addresses work too.
29
40
  batch[1].candidates = 10 # Allows up to ten possible matches to be returned (default is 1).
@@ -56,6 +67,7 @@ class USStreetMultipleAddressExample
56
67
  metadata = candidate.metadata
57
68
 
58
69
  puts "\nCandidate #{candidate.candidate_index} : "
70
+ puts "Input ID: #{candidate.input_id}"
59
71
  puts "Delivery line 1: #{candidate.delivery_line_1}"
60
72
  puts "Last line: #{candidate.last_line}"
61
73
  puts "ZIP Code: #{components.zipcode}-#{components.plus4_code}"
@@ -14,14 +14,26 @@ class USStreetSingleAddressExample
14
14
  credentials = SmartyStreets::StaticCredentials.new(auth_id, auth_token)
15
15
 
16
16
  client = SmartyStreets::ClientBuilder.new(credentials).
17
- # with_proxy('localhost', 8080, 'proxyUser', 'proxyPassword'). # Uncomment this line to try it with a proxy
18
- build_us_street_api_client
17
+ # with_proxy('localhost', 8080, 'proxyUser', 'proxyPassword'). # Uncomment this line to try it with a proxy
18
+ build_us_street_api_client
19
+
20
+ # Documentation for input fields can be found at:
21
+ # https://smartystreets.com/docs/cloud/us-street-api
19
22
 
20
23
  lookup = SmartyStreets::USStreet::Lookup.new
24
+ lookup.input_id = '24601' # Optional ID from your system
25
+ lookup.addressee = 'John Doe'
21
26
  lookup.street = '1600 Amphitheatre Pkwy'
27
+ lookup.street2 = 'closet under the stairs'
28
+ lookup.secondary = 'APT 2'
29
+ lookup.urbanization = '' # Only applies to Puerto Rico addresses
22
30
  lookup.city = 'Mountain View'
23
31
  lookup.state = 'CA'
24
- lookup.match = SmartyStreets::USStreet::MatchType::INVALID
32
+ lookup.zipcode = '21229'
33
+ lookup.candidates = 3
34
+ lookup.match = 'invalid'.freeze # "invalid" is the most permissive match,
35
+ # this will always return at least one result even if the address is invalid.
36
+ # Refer to the documentation for additional Match Strategy options.
25
37
 
26
38
  begin
27
39
  client.send_lookup(lookup)
@@ -40,6 +52,7 @@ class USStreetSingleAddressExample
40
52
  first_candidate = result[0]
41
53
 
42
54
  puts "Address is valid. (There is at least one candidate)\n"
55
+ puts "Input ID: #{first_candidate.input_id}"
43
56
  puts "ZIP Code: #{first_candidate.components.zipcode}"
44
57
  puts "County: #{first_candidate.metadata.county_name}"
45
58
  puts "Latitude: #{first_candidate.metadata.latitude}"
@@ -19,7 +19,11 @@ class USZipcodeMultipleLookupExample
19
19
  client = SmartyStreets::ClientBuilder.new(credentials).build_us_zipcode_api_client
20
20
  batch = SmartyStreets::Batch.new
21
21
 
22
+ # Documentation for input fields can be found at:
23
+ # https://smartystreets.com/docs/cloud/us-zipcode-api
24
+
22
25
  batch.add(Lookup.new)
26
+ batch[0].input_id = '01189998819991197253' # Optional ID from your system
23
27
  batch[0].zipcode = '12345' # A Lookup may have a ZIP Code, city and state, or city, state, and ZIP Code
24
28
 
25
29
  batch.add(Lookup.new)
@@ -15,9 +15,14 @@ class UsZipcodeSingleLookupExample
15
15
 
16
16
  client = SmartyStreets::ClientBuilder.new(credentials).build_us_zipcode_api_client
17
17
 
18
+ # Documentation for input fields can be found at:
19
+ # https://smartystreets.com/docs/cloud/us-zipcode-api
20
+
18
21
  lookup = SmartyStreets::USZipcode::Lookup.new
22
+ lookup.input_id = 'dfc33cb6-829e-4fea-aa1b-b6d6580f0817' # Optional ID from your system
19
23
  lookup.city = 'Mountain View'
20
24
  lookup.state = 'California'
25
+ lookup.zipcode = '94043'
21
26
 
22
27
  begin
23
28
  client.send_lookup(lookup)
@@ -30,6 +35,8 @@ class UsZipcodeSingleLookupExample
30
35
  zipcodes = result.zipcodes
31
36
  cities = result.cities
32
37
 
38
+ puts "Input ID: #{result.input_id}"
39
+
33
40
  cities.each do |city|
34
41
  puts "\nCity: #{city.city}"
35
42
  puts "State: #{city.state}"
@@ -26,6 +26,7 @@ module SmartyStreets
26
26
  def build_request(lookup)
27
27
  request = SmartyStreets::Request.new
28
28
 
29
+ add_parameter(request, 'input_id', lookup.input_id)
29
30
  add_parameter(request, 'country', lookup.country)
30
31
  add_parameter(request, 'geocode', lookup.geocode.to_s)
31
32
  add_parameter(request, 'language', lookup.language)
@@ -14,13 +14,13 @@ module SmartyStreets
14
14
  # When set to language_mode.LATIN, the results will always be provided using a Latin character set.
15
15
  class Lookup
16
16
 
17
- attr_accessor :freeform, :locality, :postal_code, :address3, :address2, :inputId, :address1,
17
+ attr_accessor :input_id, :freeform, :locality, :postal_code, :address3, :address2, :inputId, :address1,
18
18
  :geocode, :administrative_area, :country, :organization, :language, :address4, :result
19
19
 
20
20
  def initialize(freeform=nil, country=nil)
21
21
  @result = []
22
22
 
23
- @inputId = nil
23
+ @input_id = nil
24
24
  @country = country
25
25
  @geocode = nil
26
26
  @language = nil
@@ -1,10 +1,11 @@
1
1
  module SmartyStreets
2
2
  module InternationalStreet
3
3
  class RootLevel
4
- attr_reader :organization, :address1, :address2, :address3, :address4, :address5, :address6, :address7, :address8,
5
- :address9, :address10, :address11, :address12
4
+ attr_reader :input_id, :organization, :address1, :address2, :address3, :address4, :address5, :address6, :address7,
5
+ :address8, :address9, :address10, :address11, :address12
6
6
 
7
7
  def initialize(obj)
8
+ @input_id = obj.fetch('input_id', nil)
8
9
  @organization = obj.fetch('organization', nil)
9
10
  @address1 = obj.fetch('address1', nil)
10
11
  @address2 = obj.fetch('address2', nil)
@@ -13,7 +13,7 @@ module SmartyStreets
13
13
  @addresses = []
14
14
 
15
15
  addresses.each {|address|
16
- @addresses.push(Address.new(address))
16
+ @addresses.push(SmartyStreets::USExtract::Address.new(address))
17
17
  }
18
18
  end
19
19
  end
@@ -6,10 +6,11 @@ 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_index, :candidate_index, :addressee, :delivery_line_1, :delivery_line_2, :delivery_point_barcode,
9
+ attr_reader :input_id, :input_index, :candidate_index, :addressee, :delivery_line_1, :delivery_line_2, :delivery_point_barcode,
10
10
  :last_line, :metadata, :components, :analysis
11
11
 
12
12
  def initialize(obj)
13
+ @input_id = obj['input_id']
13
14
  @input_index = obj['input_index']
14
15
  @candidate_index = obj['candidate_index']
15
16
  @addressee = obj['addressee']
@@ -48,6 +48,7 @@ module SmartyStreets
48
48
  obj.each do |lookup|
49
49
  converted_lookup = {}
50
50
 
51
+ converted_lookup['input_id'] = lookup.input_id
51
52
  converted_lookup['street'] = lookup.street
52
53
  converted_lookup['street2'] = lookup.street2
53
54
  converted_lookup['secondary'] = lookup.secondary
@@ -5,11 +5,12 @@ module SmartyStreets
5
5
  module USZipcode
6
6
  # See "https://smartystreets.com/docs/cloud/us-zipcode-api#root"
7
7
  class Result
8
- attr_reader :reason, :input_index, :cities, :zipcodes, :status
8
+ attr_reader :reason, :input_id, :input_index, :cities, :zipcodes, :status
9
9
 
10
10
  def initialize(obj)
11
11
  @status = obj['status']
12
12
  @reason = obj['reason']
13
+ @input_id = obj['input_id']
13
14
  @input_index = obj['input_index']
14
15
  @cities = obj.fetch('city_states', [])
15
16
  @zipcodes = obj.fetch('zipcodes', [])
@@ -1,3 +1,3 @@
1
1
  module SmartyStreets
2
- VERSION = '5.7.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
+ VERSION = '5.7.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.7.0
4
+ version: 5.7.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: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.1
178
+ rubygems_version: 3.0.3
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: An official library for the SmartyStreets APIs