Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update build_printable_address to send lines 1 - 5 only to PrintableA… #5

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/postman_paf/rules/address_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.build_printable_address(paf_address:, lines:)
lines.each_with_index do |line, index|
line_number = index + 1
line = line.to_s if line.is_a?(Integer)
printable_address.send("line#{line_number}=", line) unless line_number.eql?(6) || line_number.eql?(7)
printable_address.send("line#{line_number}=", line) if line_number >= 1 && line_number <= 5
end

printable_address.postcode = paf_address[POSTCODE].slice(0..7)
Expand Down
2 changes: 1 addition & 1 deletion lib/postman_paf/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module PostmanPAF
VERSION = '0.4.1'
VERSION = '0.4.2'
end
33 changes: 33 additions & 0 deletions spec/fixtures/addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2988,6 +2988,39 @@
"dps": "1A"
}
},
"All Expected Elements": {
"paf": {
"uprn": "111111",
"udprn": "1111111",
"poBoxNumber": "dummy_poBoxNumber",
"organisationName": "dummy organisationName",
"departmentName": "dummy departmentName",
"subBuildingName": "dummy subBuildingName",
"buildingName": "MAIN BUILDING",
"buildingNumber": "11",
"dependentThoroughfareName": "LONG VIEW ROAD",
"thoroughfareName": "dummy thoroughfareName",
"doubleDependentLocality": "dummy doubleDependentLocality",
"dependentLocality": "MORRISTON",
"postTown": "SWANSEA",
"postcode": "SA99 1AA",
"dps": "1A",
"mailsort": "dummy-mailsort",
"language": "EN",
"country": "UNITED KINGDOM"
},
"printable": {
"line1": "dummy organisationName",
"line2": "dummy departmentName",
"line3": "PO BOX dummy_poBoxNumber",
"line4": "dummy subBuildingName",
"line5": "SWANSEA",
"postcode": "SA99 1AA",
"country": "UNITED KINGDOM",
"language": "EN",
"dps": "1A"
}
},
"Exception i Sub Building Name": {
"paf": {
"poBoxNumber": null,
Expand Down
Loading