Skip to content

Commit

Permalink
ap-5097: Rename CHARACTERS hash as SPECIAL_CHARACTER_REPLACEMENTS
Browse files Browse the repository at this point in the history
Rename hash to make variable name more descriptive
  • Loading branch information
kmahern authored and naseberry committed Jul 23, 2024
1 parent 560b1e8 commit 5942a02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/services/ccms/parsers/applicant_search_response_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def build_client_result_array

def parse_client(client_struct)
client_struct.match = [
@applicant.first_name.gsub(/[’‘]/, CCMS::Requestors::BaseRequestor::CHARACTERS).first.casecmp?(client_struct.first_initial),
@applicant.last_name.gsub(/[’‘]/, CCMS::Requestors::BaseRequestor::CHARACTERS).casecmp?(client_struct.last_name),
@applicant.surname_at_birth.gsub(/[’‘]/, CCMS::Requestors::BaseRequestor::CHARACTERS).casecmp?(client_struct.last_name_at_birth),
@applicant.first_name.gsub(/[’‘]/, CCMS::Requestors::BaseRequestor::SPECIAL_CHARACTER_REPLACEMENTS).first.casecmp?(client_struct.first_initial),
@applicant.last_name.gsub(/[’‘]/, CCMS::Requestors::BaseRequestor::SPECIAL_CHARACTER_REPLACEMENTS).casecmp?(client_struct.last_name),
@applicant.surname_at_birth.gsub(/[’‘]/, CCMS::Requestors::BaseRequestor::SPECIAL_CHARACTER_REPLACEMENTS).casecmp?(client_struct.last_name_at_birth),
@applicant.date_of_birth.strftime("%Y-%m-%d").eql?(client_struct.date_of_birth),
(@applicant.national_insurance_number || "").casecmp?(client_struct.national_insurance_number),
].all?
Expand Down
8 changes: 4 additions & 4 deletions app/services/ccms/requestors/base_requestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class BaseRequestor
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
}.freeze

CHARACTERS = {
"" => "'",
"" => "'",
SPECIAL_CHARACTER_REPLACEMENTS = {
"" => "'", # opening curly quote
"" => "'", # closing curly quote
}.freeze

attr_reader :namespaces
Expand All @@ -41,7 +41,7 @@ def formatted_xml
result = ""
formatter = REXML::Formatters::Pretty.new
formatter.compact = true
formatter.write(REXML::Document.new(request_xml.gsub(/[’‘]/, CHARACTERS)), result)
formatter.write(REXML::Document.new(request_xml.gsub(/[’‘]/, SPECIAL_CHARACTER_REPLACEMENTS)), result)
result
end

Expand Down

0 comments on commit 5942a02

Please sign in to comment.