Skip to content

Commit

Permalink
Resolved Test Discrepancy Introduced in Latest Pull Request (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
smartyeric authored Nov 20, 2024
1 parent b9dacc0 commit 5678bdd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ module SmartyStreets
module USEnrichment
module GeoReference
class Lookup
attr_reader :smarty_key, :data_set, :data_sub_set, :etag
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash

def initialize(smarty_key, etag=nil)
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
@smarty_key = smarty_key
@data_set = 'geo-reference'
@data_sub_set = nil
@etag = etag
@custom_param_hash = {}
end

def add_custom_parameter(parameter, value)
@custom_param_hash[parameter] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ module USEnrichment
module Property
module Financial
class Lookup
attr_reader :smarty_key, :data_set, :data_sub_set, :etag
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash

def initialize(smarty_key, etag=nil)
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
@smarty_key = smarty_key
@data_set = "property"
@data_sub_set = "financial"
@etag = etag
@custom_param_hash = {}
end

def add_custom_parameter(parameter, value)
@custom_param_hash[parameter] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ module USEnrichment
module Property
module Principal
class Lookup
attr_reader :smarty_key, :data_set, :data_sub_set, :etag
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash

def initialize(smarty_key, etag=nil)
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
@smarty_key = smarty_key
@data_set = "property"
@data_sub_set = "principal"
@etag = etag
@custom_param_hash = {}
end

def add_custom_parameter(parameter, value)
@custom_param_hash[parameter] = value
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ module USEnrichment
module Secondary
module Count
class Lookup
attr_reader :smarty_key, :data_set, :data_sub_set, :etag
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash

def initialize(smarty_key, etag=nil)
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
@smarty_key = smarty_key
@data_set = "secondary"
@data_sub_set = "count"
@etag = etag
@custom_param_hash = {}
end

def add_custom_parameter(parameter, value)
@custom_param_hash[parameter] = value
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions lib/smartystreets_ruby_sdk/us_enrichment/secondary/lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ module SmartyStreets
module USEnrichment
module Secondary
class Lookup
attr_reader :smarty_key, :data_set, :data_sub_set, :etag
attr_reader :smarty_key, :data_set, :data_sub_set, :etag, :custom_param_hash

def initialize(smarty_key, etag=nil)
def initialize(smarty_key, etag=nil, custom_param_hash=nil)
@smarty_key = smarty_key
@data_set = "secondary"
@data_sub_set = nil
@etag = etag
@custom_param_hash = {}
end

def add_custom_parameter(parameter, value)
@custom_param_hash[parameter] = value
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions test/smartystreets_ruby_sdk/us_street/test_street_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def test_send_populated_lookup
'match' => SmartyStreets::USStreet::MatchType::ENHANCED,
'candidates' => 5,
'format' => SmartyStreets::USStreet::OutputFormat::PROJECT_USA,
'county_source' => SmartyStreets::USStreet::CountySource::GEOGRAPHIC,
'parameter' => 'value',
}
serializer = FakeSerializer.new(expected_parameters)
client = Client.new(sender, serializer)
Expand All @@ -56,6 +58,8 @@ def test_send_populated_lookup
lookup.urbanization = '10'
lookup.match = SmartyStreets::USStreet::MatchType::ENHANCED
lookup.format = SmartyStreets::USStreet::OutputFormat::PROJECT_USA
lookup.county_source = SmartyStreets::USStreet::CountySource::GEOGRAPHIC
lookup.add_custom_parameter('parameter', 'value')
client.send_lookup(lookup)

assert_equal(expected_parameters, sender.request.parameters)
Expand Down

0 comments on commit 5678bdd

Please sign in to comment.