Skip to content

Commit

Permalink
Added format to lookup for project-usa, updated test to include format
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjohnsonsmarty committed Oct 20, 2023
1 parent c13d680 commit f5bb66b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/smartystreets_ruby_sdk/us_street/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def remap_keys(obj)
converted_lookup['urbanization'] = lookup.urbanization
converted_lookup['match'] = lookup.match
converted_lookup['candidates'] = lookup.candidates

converted_lookup['format'] = lookup.format
converted_obj.push(converted_lookup)
end
converted_obj
Expand Down
5 changes: 3 additions & 2 deletions lib/smartystreets_ruby_sdk/us_street/lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module USStreet
# @match:: Must be set to 'strict', 'range', or 'invalid'. Constants for these are in match_type.rb
class Lookup < JSONAble
attr_accessor :input_id, :street, :street2, :secondary, :city, :state, :zipcode, :lastline, :addressee, :urbanization,
:match, :candidates, :result
:match, :candidates, :format, :result

def initialize(street=nil, street2=nil, secondary=nil, city=nil, state=nil, zipcode=nil, lastline=nil,
addressee=nil, urbanization=nil, match=nil, candidates=0, input_id=nil)
addressee=nil, urbanization=nil, match=nil, candidates=0, input_id=nil, format=nil)
@input_id = input_id
@street = street
@street2 = street2
Expand All @@ -25,6 +25,7 @@ def initialize(street=nil, street2=nil, secondary=nil, city=nil, state=nil, zipc
@urbanization = urbanization
@match = match
@candidates = candidates
@format = format
@result = []
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/smartystreets_ruby_sdk/us_street/match_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ module MatchType
INVALID = 'invalid'.freeze
ENHANCED = 'enhanced'.freeze
end

module OutputFormat
DEFAULT = 'default'.freeze
PROJECT_USA = 'project-usa'.freeze
CASS = 'cass'.freeze
end
end
end
5 changes: 3 additions & 2 deletions test/smartystreets_ruby_sdk/us_street/test_street_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def test_send_populated_lookup
'addressee' => '9',
'urbanization' => '10',
'match' => SmartyStreets::USStreet::MatchType::ENHANCED,
'candidates' => 5
'candidates' => 5,
'format' => SmartyStreets::USStreet::OutputFormat::PROJECT_USA,
}
serializer = FakeSerializer.new(expected_parameters)
client = Client.new(sender, serializer)
Expand All @@ -54,7 +55,7 @@ def test_send_populated_lookup
lookup.addressee = '9'
lookup.urbanization = '10'
lookup.match = SmartyStreets::USStreet::MatchType::ENHANCED

lookup.format = SmartyStreets::USStreet::OutputFormat::PROJECT_USA
client.send_lookup(lookup)

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

0 comments on commit f5bb66b

Please sign in to comment.