Skip to content

Commit

Permalink
Merge pull request #3236 from ministryofjustice/dependabot/bundler/ru…
Browse files Browse the repository at this point in the history
…bocop-performance-1.13.0

Bump rubocop-performance from 1.12.0 to 1.13.0
  • Loading branch information
mpw5 authored Jan 10, 2022
2 parents a09dc66 + a479a46 commit af41375
Show file tree
Hide file tree
Showing 14 changed files with 250 additions and 250 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-performance (1.12.0)
rubocop-performance (1.13.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.13.1)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/check_answers_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def check_long_question_for_cash_transactions(name:, question:, legal_aid_applic
end

def number_to_currency_or_na(number)
number.to_d == 999_999_999_999.0.to_d ? 'N/a' : gds_number_to_currency(number)
number.to_d == BigDecimal('999_999_999_999.0') ? 'N/a' : gds_number_to_currency(number)
end

def safe_yes_or_no(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def call
next unless generate_attribute_block?(config)

response_value = extract_response_value(config)
@xml.__send__('common:Attribute') do
@xml.__send__('common:Attribute', attribute_name)
@xml.__send__('common:ResponseType', config[:response_type])
@xml.__send__('common:ResponseValue', response_value)
@xml.__send__('common:UserDefinedInd', config[:user_defined])
@xml.__send__(:'common:Attribute') do
@xml.__send__(:'common:Attribute', attribute_name)
@xml.__send__(:'common:ResponseType', config[:response_type])
@xml.__send__(:'common:ResponseValue', response_value)
@xml.__send__(:'common:UserDefinedInd', config[:user_defined])
end
end
end
Expand Down
48 changes: 24 additions & 24 deletions app/services/ccms/requestors/applicant_add_requestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,48 @@ def request_xml
end

def soap_body(xml)
xml.__send__('clientbim:ClientAddRQ') do
xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) }
xml.__send__('clientbim:Client') { client(xml) }
xml.__send__(:'clientbim:ClientAddRQ') do
xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) }
xml.__send__(:'clientbim:Client') { client(xml) }
end
end

def client(xml)
xml.__send__('clientbio:Name') { name(xml) }
xml.__send__('clientbio:PersonalInformation') { personal_information(xml) }
xml.__send__('clientbio:Contacts') { contacts(xml) }
xml.__send__('clientbio:NoFixedAbode', false)
xml.__send__('clientbio:Address') { applicant_address(xml) }
xml.__send__('clientbio:EthnicMonitoring', 0)
xml.__send__(:'clientbio:Name') { name(xml) }
xml.__send__(:'clientbio:PersonalInformation') { personal_information(xml) }
xml.__send__(:'clientbio:Contacts') { contacts(xml) }
xml.__send__(:'clientbio:NoFixedAbode', false)
xml.__send__(:'clientbio:Address') { applicant_address(xml) }
xml.__send__(:'clientbio:EthnicMonitoring', 0)
end

def name(xml)
xml.__send__('common:Surname', applicant.last_name)
xml.__send__('common:FirstName', applicant.first_name)
xml.__send__(:'common:Surname', applicant.last_name)
xml.__send__(:'common:FirstName', applicant.first_name)
end

# this is all mandatory: we don't hold any of this data except date of birth
def personal_information(xml)
xml.__send__('clientbio:DateOfBirth', applicant.date_of_birth.to_s(:ccms_date))
xml.__send__('clientbio:Gender', 'UNSPECIFIED')
xml.__send__('clientbio:MaritalStatus', 'U')
xml.__send__('clientbio:VulnerableClient', false)
xml.__send__('clientbio:HighProfileClient', false)
xml.__send__('clientbio:VexatiousLitigant', false)
xml.__send__('clientbio:CountryOfOrigin', 'GBR')
xml.__send__('clientbio:MentalCapacityInd', false)
xml.__send__(:'clientbio:DateOfBirth', applicant.date_of_birth.to_s(:ccms_date))
xml.__send__(:'clientbio:Gender', 'UNSPECIFIED')
xml.__send__(:'clientbio:MaritalStatus', 'U')
xml.__send__(:'clientbio:VulnerableClient', false)
xml.__send__(:'clientbio:HighProfileClient', false)
xml.__send__(:'clientbio:VexatiousLitigant', false)
xml.__send__(:'clientbio:CountryOfOrigin', 'GBR')
xml.__send__(:'clientbio:MentalCapacityInd', false)
end

# this is the only mandatory item of contact data. i'm not sure what it's for...
def contacts(xml)
xml.__send__('clientbio:Password', 'Testing')
xml.__send__(:'clientbio:Password', 'Testing')
end

def applicant_address(xml)
xml.__send__('common:AddressLine1', address.first_lines)
xml.__send__('common:City', address.city)
xml.__send__('common:Country', 'GBR')
xml.__send__('common:PostalCode', address.pretty_postcode)
xml.__send__(:'common:AddressLine1', address.first_lines)
xml.__send__(:'common:City', address.city)
xml.__send__(:'common:Country', 'GBR')
xml.__send__(:'common:PostalCode', address.pretty_postcode)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def request_xml
end

def soap_body(xml)
xml.__send__('clientbim:ClientAddUpdtStatusRQ') do
xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) }
xml.__send__('clientbim:TransactionID', applicant_add_transaction_id)
xml.__send__(:'clientbim:ClientAddUpdtStatusRQ') do
xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) }
xml.__send__(:'clientbim:TransactionID', applicant_add_transaction_id)
end
end
end
Expand Down
22 changes: 11 additions & 11 deletions app/services/ccms/requestors/applicant_search_requestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ def request_xml
end

def soap_body(xml)
xml.__send__('clientbim:ClientInqRQ') do
xml.__send__('hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) }
xml.__send__('clientbim:RecordCount') { record_count(xml) }
xml.__send__('clientbim:SearchCriteria') { search_criteria(xml) }
xml.__send__(:'clientbim:ClientInqRQ') do
xml.__send__(:'hdr:HeaderRQ') { ns3_header_rq(xml, @provider_username) }
xml.__send__(:'clientbim:RecordCount') { record_count(xml) }
xml.__send__(:'clientbim:SearchCriteria') { search_criteria(xml) }
end
end

def record_count(xml)
xml.__send__('common:MaxRecordsToFetch', 200)
xml.__send__('common:RetriveDataOnMaxCount', false)
xml.__send__(:'common:MaxRecordsToFetch', 200)
xml.__send__(:'common:RetriveDataOnMaxCount', false)
end

def search_criteria(xml)
xml.__send__('clientbim:ClientInfo') do
xml.__send__('clientbio:FirstName', @applicant.first_name)
xml.__send__('clientbio:Surname', @applicant.last_name)
xml.__send__('clientbio:DateOfBirth', @applicant.date_of_birth.to_s(:ccms_date))
xml.__send__('clientbio:NINumber', @applicant.national_insurance_number)
xml.__send__(:'clientbim:ClientInfo') do
xml.__send__(:'clientbio:FirstName', @applicant.first_name)
xml.__send__(:'clientbio:Surname', @applicant.last_name)
xml.__send__(:'clientbio:DateOfBirth', @applicant.date_of_birth.to_s(:ccms_date))
xml.__send__(:'clientbio:NINumber', @applicant.national_insurance_number)
end
end
end
Expand Down
22 changes: 11 additions & 11 deletions app/services/ccms/requestors/base_requestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,29 @@ def soap_client

def soap_envelope(namespaces)
Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
xml.__send__('soap:Envelope', namespaces) do
xml.__send__('soap:Header') { soap_header(xml) }
xml.__send__('soap:Body') { soap_body(xml) }
xml.__send__(:'soap:Envelope', namespaces) do
xml.__send__(:'soap:Header') { soap_header(xml) }
xml.__send__(:'soap:Body') { soap_body(xml) }
end
end
end

def soap_header(xml)
xml.__send__('secext:Security') do
xml.__send__('secext:UsernameToken') do
xml.__send__('secext:Username', config.client_username)
xml.__send__('secext:Password', 'Type' => config.client_password_type) do
xml.__send__(:'secext:Security') do
xml.__send__(:'secext:UsernameToken') do
xml.__send__(:'secext:Username', config.client_username)
xml.__send__(:'secext:Password', 'Type' => config.client_password_type) do
xml.text(config.client_password)
end
end
end
end

def ns3_header_rq(xml, provider_username)
xml.__send__('hdr:TransactionRequestID', transaction_request_id)
xml.__send__('hdr:Language', 'ENG')
xml.__send__('hdr:UserLoginID', provider_username)
xml.__send__('hdr:UserRole', config.user_role)
xml.__send__(:'hdr:TransactionRequestID', transaction_request_id)
xml.__send__(:'hdr:Language', 'ENG')
xml.__send__(:'hdr:UserLoginID', provider_username)
xml.__send__(:'hdr:UserRole', config.user_role)
end

def wsdl_location
Expand Down
Loading

0 comments on commit af41375

Please sign in to comment.