smartystreets_ruby_sdk 5.20.3 → 5.20.6
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 +4 -4
- data/examples/international_autocomplete_example.rb +2 -0
- data/examples/international_example.rb +2 -0
- data/examples/us_autocomplete_pro_example.rb +2 -0
- data/examples/us_enrichment_example.rb +3 -0
- data/examples/us_extract_example.rb +2 -0
- data/examples/us_reverse_geo_example.rb +2 -0
- data/examples/us_street_multiple_address_example.rb +2 -0
- data/examples/us_street_single_address_example.rb +3 -0
- data/examples/us_zipcode_multiple_lookup_example.rb +2 -0
- data/examples/us_zipcode_single_lookup_example.rb +2 -0
- data/lib/smartystreets_ruby_sdk/errors.rb +2 -0
- data/lib/smartystreets_ruby_sdk/exceptions.rb +3 -0
- data/lib/smartystreets_ruby_sdk/international_autocomplete/client.rb +4 -0
- data/lib/smartystreets_ruby_sdk/international_autocomplete/lookup.rb +7 -2
- data/lib/smartystreets_ruby_sdk/international_street/client.rb +4 -0
- data/lib/smartystreets_ruby_sdk/international_street/lookup.rb +6 -1
- data/lib/smartystreets_ruby_sdk/status_code_sender.rb +2 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete_pro/client.rb +4 -0
- data/lib/smartystreets_ruby_sdk/us_autocomplete_pro/lookup.rb +7 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/client.rb +12 -5
- data/lib/smartystreets_ruby_sdk/us_enrichment/geo_reference/lookup.rb +8 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/geo_reference/response.rb +3 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/lookup.rb +8 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/property/financial/lookup.rb +8 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/property/financial/response.rb +3 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/property/principal/lookup.rb +8 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/property/principal/response.rb +3 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/secondary/count/lookup.rb +8 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/secondary/count/response.rb +3 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/secondary/lookup.rb +8 -2
- data/lib/smartystreets_ruby_sdk/us_enrichment/secondary/response.rb +3 -2
- data/lib/smartystreets_ruby_sdk/us_extract/client.rb +4 -0
- data/lib/smartystreets_ruby_sdk/us_extract/lookup.rb +7 -2
- data/lib/smartystreets_ruby_sdk/us_reverse_geo/client.rb +4 -0
- data/lib/smartystreets_ruby_sdk/us_reverse_geo/lookup.rb +7 -2
- data/lib/smartystreets_ruby_sdk/us_street/client.rb +6 -0
- data/lib/smartystreets_ruby_sdk/us_street/lookup.rb +9 -2
- data/lib/smartystreets_ruby_sdk/us_street/match_type.rb +5 -0
- data/lib/smartystreets_ruby_sdk/us_zipcode/client.rb +4 -0
- data/lib/smartystreets_ruby_sdk/us_zipcode/lookup.rb +7 -2
- data/lib/smartystreets_ruby_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb1b572ed0d7aba94f6e82270f168dac48b8f2814f9a91802a319f582ad4d7d6
|
4
|
+
data.tar.gz: 270bfca4f6bba08d859695b76f19ce6e0b0247d2a4fb23cfdb545f0e5189638f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1bfd01e7f995219aac05c965e00e76db458f7dae632820284aa6e921676f1562d6e7ca30fa2a055561df2d64d4214946527f3cc1cb7dabf06d4298bd831af46
|
7
|
+
data.tar.gz: 3e62baa76c824148527367128b27ab849f022f89572213fa5b8e99f38b1548baca72726b3f91eca9ad084e929843356c9462cc1ff4ac12d5a7cbb9c12ccf058d
|
@@ -38,6 +38,8 @@ class InternationalExample
|
|
38
38
|
lookup.country = 'Brazil'
|
39
39
|
lookup.postal_code = '02516-050'
|
40
40
|
|
41
|
+
# lookup.add_custom_parameter('parameter', 'value')
|
42
|
+
|
41
43
|
candidates = client.send_lookup(lookup) # The candidates are also stored in the lookup's 'result' field.
|
42
44
|
|
43
45
|
first_candidate = candidates[0]
|
@@ -33,6 +33,9 @@ class USEnrichmentAddressExample
|
|
33
33
|
lookup.city = "Somerville"
|
34
34
|
lookup.state = "NJ"
|
35
35
|
lookup.zipcode = "08876"
|
36
|
+
# lookup.etag = "AUBAGDQDAIGQYCYC"
|
37
|
+
|
38
|
+
# lookup.add_custom_parameter('parameter', 'value')
|
36
39
|
|
37
40
|
# Or, create a freeform lookup to search using a single line address
|
38
41
|
freeform_lookup = SmartyStreets::USEnrichment::Lookup.new
|
@@ -44,6 +44,8 @@ class USStreetMultipleAddressExample
|
|
44
44
|
# this will always return at least one result even if the address is invalid.
|
45
45
|
# Refer to the documentation for additional Match Strategy options.
|
46
46
|
|
47
|
+
# batch[0].add_custom_parameter('parameter', 'value')
|
48
|
+
|
47
49
|
batch.add(Lookup.new('1 Rosedale, Baltimore, Maryland')) # Freeform addresses work too.
|
48
50
|
batch[1].candidates = 10 # Allows up to ten possible matches to be returned (default is 1).
|
49
51
|
|
@@ -40,11 +40,14 @@ class USStreetSingleAddressExample
|
|
40
40
|
lookup.state = 'CA'
|
41
41
|
lookup.zipcode = '21229'
|
42
42
|
lookup.candidates = 3
|
43
|
+
lookup.county_source = SmartyStreets::USStreet::CountySource::GEOGRAPHIC
|
43
44
|
lookup.match = SmartyStreets::USStreet::MatchType::INVALID
|
44
45
|
# "invalid" is the most permissive match,
|
45
46
|
# this will always return at least one result even if the address is invalid.
|
46
47
|
# Refer to the documentation for additional Match Strategy options.
|
47
48
|
|
49
|
+
# lookup.add_custom_parameter('parameter', 'value')
|
50
|
+
|
48
51
|
begin
|
49
52
|
client.send_lookup(lookup)
|
50
53
|
rescue SmartyStreets::SmartyError => err
|
@@ -29,6 +29,8 @@ class USZipcodeMultipleLookupExample
|
|
29
29
|
batch[0].input_id = '01189998819991197253' # Optional ID from your system
|
30
30
|
batch[0].zipcode = '12345' # A Lookup may have a ZIP Code, city and state, or city, state, and ZIP Code
|
31
31
|
|
32
|
+
# batch[0].add_custom_parameter('parameter', 'value')
|
33
|
+
|
32
34
|
batch.add(Lookup.new)
|
33
35
|
batch[1].city = 'Phoenix'
|
34
36
|
batch[1].state = 'Arizona'
|
@@ -1,4 +1,6 @@
|
|
1
1
|
module SmartyStreets
|
2
|
+
NOT_MODIFIED = 'Not Modified: This data has not been modified since the last request. Please remove the etag header to fetch this data'.freeze
|
3
|
+
|
2
4
|
BAD_CREDENTIALS = 'Unauthorized: The credentials were provided incorrectly or did not match any existing,
|
3
5
|
active credentials.'.freeze
|
4
6
|
|
@@ -42,6 +42,10 @@ module SmartyStreets
|
|
42
42
|
add_parameter(request, 'include_only_locality', lookup.locality)
|
43
43
|
add_parameter(request, 'include_only_postal_code', lookup.postal_code)
|
44
44
|
|
45
|
+
for key in lookup.custom_param_hash.keys do
|
46
|
+
add_parameter(request, key, lookup.custom_param_hash[key])
|
47
|
+
end
|
48
|
+
|
45
49
|
request
|
46
50
|
end
|
47
51
|
|
@@ -6,9 +6,9 @@ module SmartyStreets
|
|
6
6
|
# of the lookup after it comes back from the API.
|
7
7
|
class Lookup < JSONAble
|
8
8
|
|
9
|
-
attr_accessor :result, :search, :address_id, :country, :max_results, :locality, :postal_code
|
9
|
+
attr_accessor :result, :search, :address_id, :country, :max_results, :locality, :postal_code, :custom_param_hash
|
10
10
|
|
11
|
-
def initialize(search = nil, address_id = nil, country = nil, max_results = nil, locality = nil, postal_code = nil)
|
11
|
+
def initialize(search = nil, address_id = nil, country = nil, max_results = nil, locality = nil, postal_code = nil, custom_param_hash = nil)
|
12
12
|
@result = []
|
13
13
|
@search = search
|
14
14
|
@address_id = address_id
|
@@ -16,6 +16,11 @@ module SmartyStreets
|
|
16
16
|
@max_results = max_results
|
17
17
|
@locality = locality
|
18
18
|
@postal_code = postal_code
|
19
|
+
@custom_param_hash = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_custom_parameter(parameter, value)
|
23
|
+
@custom_param_hash[parameter] = value
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
@@ -54,6 +54,10 @@ module SmartyStreets
|
|
54
54
|
add_parameter(request, 'administrative_area', lookup.administrative_area)
|
55
55
|
add_parameter(request, 'postal_code', lookup.postal_code)
|
56
56
|
|
57
|
+
for key in lookup.custom_param_hash.keys do
|
58
|
+
add_parameter(request, key, lookup.custom_param_hash[key])
|
59
|
+
end
|
60
|
+
|
57
61
|
request
|
58
62
|
end
|
59
63
|
|
@@ -15,7 +15,7 @@ module SmartyStreets
|
|
15
15
|
class Lookup
|
16
16
|
|
17
17
|
attr_accessor :input_id, :freeform, :locality, :postal_code, :address3, :address2, :inputId, :address1,
|
18
|
-
:geocode, :administrative_area, :country, :organization, :language, :address4, :result
|
18
|
+
:geocode, :administrative_area, :country, :organization, :language, :address4, :result, :custom_param_hash
|
19
19
|
|
20
20
|
def initialize(freeform=nil, country=nil)
|
21
21
|
@result = []
|
@@ -33,6 +33,11 @@ module SmartyStreets
|
|
33
33
|
@locality = nil
|
34
34
|
@administrative_area = nil
|
35
35
|
@postal_code = nil
|
36
|
+
@custom_param_hash = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_custom_parameter(parameter, value)
|
40
|
+
@custom_param_hash[parameter] = value
|
36
41
|
end
|
37
42
|
|
38
43
|
def missing_country
|
@@ -10,11 +10,11 @@ module SmartyStreets
|
|
10
10
|
|
11
11
|
attr_accessor :result, :search, :max_results, :city_filter, :state_filter, :zip_filter,
|
12
12
|
:exclude_states, :prefer_cities, :prefer_states, :prefer_zip_codes, :prefer_ratio,
|
13
|
-
:prefer_geolocation, :selected, :source
|
13
|
+
:prefer_geolocation, :selected, :source, :custom_param_hash
|
14
14
|
|
15
15
|
def initialize(search=nil, max_results=nil, city_filter=nil, state_filter=nil, zip_filter=nil,
|
16
16
|
exclude_states=nil, prefer_cities=nil, prefer_states=nil, prefer_zips=nil, prefer_ratio=nil,
|
17
|
-
prefer_geolocation=nil, selected=nil, source=nil)
|
17
|
+
prefer_geolocation=nil, selected=nil, source=nil, custom_param_hash=nil)
|
18
18
|
@result = []
|
19
19
|
@search = search
|
20
20
|
@max_results = max_results
|
@@ -29,6 +29,11 @@ module SmartyStreets
|
|
29
29
|
@prefer_geolocation = prefer_geolocation
|
30
30
|
@selected = selected
|
31
31
|
@source = source
|
32
|
+
@custom_param_hash = {}
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_custom_parameter(parameter, value)
|
36
|
+
@custom_param_hash[parameter] = value
|
32
37
|
end
|
33
38
|
|
34
39
|
def add_city_filter(city)
|
@@ -83,6 +83,10 @@ module SmartyStreets
|
|
83
83
|
smarty_request = Request.new
|
84
84
|
|
85
85
|
return if lookup.nil?
|
86
|
+
|
87
|
+
if (!lookup.etag.nil?)
|
88
|
+
smarty_request.header["ETAG"] = lookup.etag
|
89
|
+
end
|
86
90
|
if (lookup.smarty_key.nil?)
|
87
91
|
if (lookup.data_sub_set.nil?)
|
88
92
|
smarty_request.url_components = '/search/' + lookup.data_set
|
@@ -101,6 +105,9 @@ module SmartyStreets
|
|
101
105
|
smarty_request.url_components = '/' + lookup.smarty_key + '/' + lookup.data_set + '/' + lookup.data_sub_set
|
102
106
|
end
|
103
107
|
end
|
108
|
+
for key in lookup.custom_param_hash.keys do
|
109
|
+
add_parameter(smarty_request, key, lookup.custom_param_hash[key])
|
110
|
+
end
|
104
111
|
|
105
112
|
|
106
113
|
response = @sender.send(smarty_request)
|
@@ -113,19 +120,19 @@ module SmartyStreets
|
|
113
120
|
results.each do |raw_result|
|
114
121
|
result = nil
|
115
122
|
if lookup.data_sub_set == "financial"
|
116
|
-
result = USEnrichment::Property::Financial::Response.new(raw_result)
|
123
|
+
result = USEnrichment::Property::Financial::Response.new(raw_result, response.header['etag'])
|
117
124
|
end
|
118
125
|
if lookup.data_sub_set == "principal"
|
119
|
-
result = USEnrichment::Property::Principal::Response.new(raw_result)
|
126
|
+
result = USEnrichment::Property::Principal::Response.new(raw_result, response.header['etag'])
|
120
127
|
end
|
121
128
|
if lookup.data_set == "geo-reference"
|
122
|
-
result = USEnrichment::GeoReference::Response.new(raw_result)
|
129
|
+
result = USEnrichment::GeoReference::Response.new(raw_result, response.header['etag'])
|
123
130
|
end
|
124
131
|
if lookup.data_set == "secondary"
|
125
132
|
if lookup.data_sub_set == "count"
|
126
|
-
result = USEnrichment::Secondary::Count::Response.new(raw_result)
|
133
|
+
result = USEnrichment::Secondary::Count::Response.new(raw_result, response.header['etag'])
|
127
134
|
elsif lookup.data_sub_set.nil?
|
128
|
-
result = USEnrichment::Secondary::Response.new(raw_result)
|
135
|
+
result = USEnrichment::Secondary::Response.new(raw_result, response.header['etag'])
|
129
136
|
end
|
130
137
|
end
|
131
138
|
output << result
|
@@ -2,12 +2,18 @@ module SmartyStreets
|
|
2
2
|
module USEnrichment
|
3
3
|
module GeoReference
|
4
4
|
class Lookup
|
5
|
-
attr_reader :smarty_key, :data_set, :data_sub_set
|
5
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash
|
6
6
|
|
7
|
-
def initialize(smarty_key)
|
7
|
+
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
|
8
8
|
@smarty_key = smarty_key
|
9
9
|
@data_set = 'geo-reference'
|
10
10
|
@data_sub_set = nil
|
11
|
+
@etag = etag
|
12
|
+
@custom_param_hash = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_custom_parameter(parameter, value)
|
16
|
+
@custom_param_hash[parameter] = value
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
@@ -4,12 +4,13 @@ module SmartyStreets
|
|
4
4
|
module USEnrichment
|
5
5
|
module GeoReference
|
6
6
|
class Response
|
7
|
-
attr_reader :smarty_key, :data_set, :attributes
|
7
|
+
attr_reader :smarty_key, :data_set, :attributes, :etag
|
8
8
|
|
9
|
-
def initialize(obj)
|
9
|
+
def initialize(obj, etag=nil)
|
10
10
|
@smarty_key = obj['smarty_key']
|
11
11
|
@data_set = 'geo-reference'
|
12
12
|
@attributes = Attributes.new(obj['attributes'])
|
13
|
+
@etag = etag
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
@@ -2,9 +2,9 @@ require_relative '../json_able'
|
|
2
2
|
module SmartyStreets
|
3
3
|
module USEnrichment
|
4
4
|
class Lookup < JSONAble
|
5
|
-
attr_accessor :smarty_key, :data_set, :data_sub_set, :freeform, :street, :city, :state, :zipcode
|
5
|
+
attr_accessor :smarty_key, :data_set, :data_sub_set, :freeform, :street, :city, :state, :zipcode, :etag, :custom_param_hash
|
6
6
|
|
7
|
-
def initialize(smarty_key=nil, data_set=nil, data_sub_set=nil, freeform=nil, street=nil, city=nil, state=nil, zipcode=nil)
|
7
|
+
def initialize(smarty_key=nil, data_set=nil, data_sub_set=nil, freeform=nil, street=nil, city=nil, state=nil, zipcode=nil, etag=nil, custom_param_hash=nil)
|
8
8
|
@smarty_key = smarty_key
|
9
9
|
@data_set = data_set
|
10
10
|
@data_sub_set = data_sub_set
|
@@ -13,6 +13,12 @@ module SmartyStreets
|
|
13
13
|
@city = city
|
14
14
|
@state = state
|
15
15
|
@zipcode = zipcode
|
16
|
+
@etag = etag
|
17
|
+
@custom_param_hash = {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_custom_parameter(parameter, value)
|
21
|
+
@custom_param_hash[parameter] = value
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
@@ -3,12 +3,18 @@ module SmartyStreets
|
|
3
3
|
module Property
|
4
4
|
module Financial
|
5
5
|
class Lookup
|
6
|
-
attr_reader :smarty_key, :data_set, :data_sub_set
|
6
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash
|
7
7
|
|
8
|
-
def initialize(smarty_key)
|
8
|
+
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
|
9
9
|
@smarty_key = smarty_key
|
10
10
|
@data_set = "property"
|
11
11
|
@data_sub_set = "financial"
|
12
|
+
@etag = etag
|
13
|
+
@custom_param_hash = {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_custom_parameter(parameter, value)
|
17
|
+
@custom_param_hash[parameter] = value
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
@@ -5,13 +5,14 @@ module SmartyStreets
|
|
5
5
|
module Property
|
6
6
|
module Financial
|
7
7
|
class Response
|
8
|
-
attr_reader :smarty_key, :data_set, :data_sub_set, :attributes
|
8
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :attributes, :etag
|
9
9
|
|
10
|
-
def initialize(obj)
|
10
|
+
def initialize(obj, etag=nil)
|
11
11
|
@smarty_key = obj['smarty_key']
|
12
12
|
@data_set = obj['data_set']
|
13
13
|
@data_sub_set = obj['data_sub_set']
|
14
14
|
@attributes = Attributes.new(obj['attributes'])
|
15
|
+
@etag = etag
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -3,12 +3,18 @@ module SmartyStreets
|
|
3
3
|
module Property
|
4
4
|
module Principal
|
5
5
|
class Lookup
|
6
|
-
attr_reader :smarty_key, :data_set, :data_sub_set
|
6
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash
|
7
7
|
|
8
|
-
def initialize(smarty_key)
|
8
|
+
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
|
9
9
|
@smarty_key = smarty_key
|
10
10
|
@data_set = "property"
|
11
11
|
@data_sub_set = "principal"
|
12
|
+
@etag = etag
|
13
|
+
@custom_param_hash = {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_custom_parameter(parameter, value)
|
17
|
+
@custom_param_hash[parameter] = value
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
@@ -5,13 +5,14 @@ module SmartyStreets
|
|
5
5
|
module Property
|
6
6
|
module Principal
|
7
7
|
class Response
|
8
|
-
attr_reader :smarty_key, :data_set, :data_sub_set, :attributes
|
8
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :attributes, :etag
|
9
9
|
|
10
|
-
def initialize(obj)
|
10
|
+
def initialize(obj, etag=nil)
|
11
11
|
@smarty_key = obj['smarty_key']
|
12
12
|
@data_set = obj['data_set']
|
13
13
|
@data_sub_set = obj['data_sub_set']
|
14
14
|
@attributes = Attributes.new(obj['attributes'])
|
15
|
+
@etag = etag
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -3,12 +3,18 @@ module SmartyStreets
|
|
3
3
|
module Secondary
|
4
4
|
module Count
|
5
5
|
class Lookup
|
6
|
-
attr_reader :smarty_key, :data_set, :data_sub_set
|
6
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash
|
7
7
|
|
8
|
-
def initialize(smarty_key)
|
8
|
+
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
|
9
9
|
@smarty_key = smarty_key
|
10
10
|
@data_set = "secondary"
|
11
11
|
@data_sub_set = "count"
|
12
|
+
@etag = etag
|
13
|
+
@custom_param_hash = {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_custom_parameter(parameter, value)
|
17
|
+
@custom_param_hash[parameter] = value
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
@@ -3,11 +3,12 @@ module SmartyStreets
|
|
3
3
|
module Secondary
|
4
4
|
module Count
|
5
5
|
class Response
|
6
|
-
attr_reader :smarty_key, :count
|
6
|
+
attr_reader :smarty_key, :count, :etag
|
7
7
|
|
8
|
-
def initialize(obj)
|
8
|
+
def initialize(obj, etag=nil)
|
9
9
|
@smarty_key = obj['smarty_key']
|
10
10
|
@count = obj['count']
|
11
|
+
@etag = etag
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
@@ -2,12 +2,18 @@ module SmartyStreets
|
|
2
2
|
module USEnrichment
|
3
3
|
module Secondary
|
4
4
|
class Lookup
|
5
|
-
attr_reader :smarty_key, :data_set, :data_sub_set
|
5
|
+
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash
|
6
6
|
|
7
|
-
def initialize(smarty_key)
|
7
|
+
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
|
8
8
|
@smarty_key = smarty_key
|
9
9
|
@data_set = "secondary"
|
10
10
|
@data_sub_set = nil
|
11
|
+
@etag = etag
|
12
|
+
@custom_param_hash = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_custom_parameter(parameter, value)
|
16
|
+
@custom_param_hash[parameter] = value
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
@@ -6,15 +6,16 @@ module SmartyStreets
|
|
6
6
|
module USEnrichment
|
7
7
|
module Secondary
|
8
8
|
class Response
|
9
|
-
attr_reader :smarty_key, :root_address, :aliases, :secondaries
|
9
|
+
attr_reader :smarty_key, :root_address, :aliases, :secondaries, :etag
|
10
10
|
|
11
|
-
def initialize(obj)
|
11
|
+
def initialize(obj, etag=nil)
|
12
12
|
@smarty_key = obj['smarty_key']
|
13
13
|
@root_address = Secondary::RootAddressEntry.new(obj['root_address'])
|
14
14
|
if !obj['aliases'].nil?
|
15
15
|
@aliases = createAliasesArray(obj['aliases'])
|
16
16
|
end
|
17
17
|
@secondaries = createSecondariesArray(obj['secondaries'])
|
18
|
+
@etag=etag
|
18
19
|
end
|
19
20
|
|
20
21
|
def createAliasesArray(obj)
|
@@ -7,9 +7,9 @@ module SmartyStreets
|
|
7
7
|
#
|
8
8
|
# See "https://smartystreets.com/docs/cloud/us-extract-api#http-request-input-fields"
|
9
9
|
class Lookup < JSONAble
|
10
|
-
attr_accessor :text, :result, :aggressive, :addresses_per_line, :html, :addresses_have_line_breaks, :match
|
10
|
+
attr_accessor :text, :result, :aggressive, :addresses_per_line, :html, :addresses_have_line_breaks, :match, :custom_param_hash
|
11
11
|
|
12
|
-
def initialize(text=nil, html=nil, aggressive=nil, addresses_have_line_breaks=nil, addresses_per_line=nil, match=nil)
|
12
|
+
def initialize(text=nil, html=nil, aggressive=nil, addresses_have_line_breaks=nil, addresses_per_line=nil, match=nil, custom_param_hash=nil)
|
13
13
|
@text = text
|
14
14
|
@html = html
|
15
15
|
@aggressive = aggressive
|
@@ -17,6 +17,11 @@ module SmartyStreets
|
|
17
17
|
@addresses_per_line = addresses_per_line
|
18
18
|
@match = match
|
19
19
|
@result = nil
|
20
|
+
@custom_param_hash = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_custom_parameter(parameter, value)
|
24
|
+
@custom_param_hash[parameter] = value
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
@@ -28,6 +28,10 @@ module SmartyStreets
|
|
28
28
|
add_parameter(request, 'longitude', lookup.longitude)
|
29
29
|
add_parameter(request, 'source', lookup.source)
|
30
30
|
|
31
|
+
for key in lookup.custom_param_hash.keys do
|
32
|
+
add_parameter(request, key, lookup.custom_param_hash[key])
|
33
|
+
end
|
34
|
+
|
31
35
|
request
|
32
36
|
end
|
33
37
|
|
@@ -10,12 +10,17 @@ module SmartyStreets
|
|
10
10
|
|
11
11
|
class Lookup
|
12
12
|
|
13
|
-
attr_accessor :latitude, :longitude, :source, :response
|
13
|
+
attr_accessor :latitude, :longitude, :source, :response, :custom_param_hash
|
14
14
|
|
15
|
-
def initialize(latitude, longitude, source)
|
15
|
+
def initialize(latitude, longitude, source=nil, custom_param_hash=nil)
|
16
16
|
@latitude = sprintf('%.8f', latitude)
|
17
17
|
@longitude = sprintf('%.8f', longitude)
|
18
18
|
@source = source
|
19
|
+
@custom_param_hash = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_custom_parameter(parameter, value)
|
23
|
+
@custom_param_hash[parameter] = value
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
@@ -62,6 +62,12 @@ module SmartyStreets
|
|
62
62
|
converted_lookup['match'] = lookup.match
|
63
63
|
converted_lookup['candidates'] = lookup.candidates
|
64
64
|
converted_lookup['format'] = lookup.format
|
65
|
+
converted_lookup['county_source'] = lookup.county_source
|
66
|
+
|
67
|
+
for key in lookup.custom_param_hash.keys do
|
68
|
+
converted_lookup[key] = lookup.custom_param_hash[key]
|
69
|
+
end
|
70
|
+
|
65
71
|
converted_obj.push(converted_lookup)
|
66
72
|
end
|
67
73
|
converted_obj
|
@@ -9,10 +9,10 @@ module SmartyStreets
|
|
9
9
|
# @match:: Must be set to 'strict', 'enhanced', 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, :format, :result
|
12
|
+
:match, :candidates, :format, :county_source, :custom_param_hash, :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, format=nil)
|
15
|
+
addressee=nil, urbanization=nil, match=nil, candidates=0, input_id=nil, county_source=nil, format=nil)
|
16
16
|
@input_id = input_id
|
17
17
|
@street = street
|
18
18
|
@street2 = street2
|
@@ -26,8 +26,15 @@ module SmartyStreets
|
|
26
26
|
@match = match
|
27
27
|
@candidates = candidates
|
28
28
|
@format = format
|
29
|
+
@county_source = county_source
|
30
|
+
@custom_param_hash = {}
|
29
31
|
@result = []
|
30
32
|
end
|
33
|
+
|
34
|
+
def add_custom_parameter(parameter, value)
|
35
|
+
@custom_param_hash[parameter] = value
|
36
|
+
end
|
37
|
+
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -58,6 +58,10 @@ module SmartyStreets
|
|
58
58
|
add_field(converted_lookup, 'state', lookup.state)
|
59
59
|
add_field(converted_lookup, 'zipcode', lookup.zipcode)
|
60
60
|
|
61
|
+
for key in lookup.custom_param_hash.keys do
|
62
|
+
add_field(converted_lookup, key, lookup.custom_param_hash[key])
|
63
|
+
end
|
64
|
+
|
61
65
|
converted_obj.push(converted_lookup)
|
62
66
|
end
|
63
67
|
|
@@ -7,14 +7,19 @@ module SmartyStreets
|
|
7
7
|
#
|
8
8
|
# See "https://smartystreets.com/docs/cloud/us-zipcode-api#http-request-input-fields"
|
9
9
|
class Lookup < JSONAble
|
10
|
-
attr_accessor :result, :state, :zipcode, :input_id, :city
|
10
|
+
attr_accessor :result, :state, :zipcode, :input_id, :city, :custom_param_hash
|
11
11
|
|
12
|
-
def initialize(city=nil, state=nil, zipcode=nil, input_id=nil)
|
12
|
+
def initialize(city=nil, state=nil, zipcode=nil, input_id=nil, custom_param_hash=nil)
|
13
13
|
@result = nil
|
14
14
|
@input_id = input_id
|
15
15
|
@city = city
|
16
16
|
@state = state
|
17
17
|
@zipcode = zipcode
|
18
|
+
@custom_param_hash = {}
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_custom_parameter(parameter, value)
|
22
|
+
@custom_param_hash[parameter] = value
|
18
23
|
end
|
19
24
|
end
|
20
25
|
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.20.
|
4
|
+
version: 5.20.6
|
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: 2024-
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|