lib/creditsafe/request/find_company.rb in creditsafe-0.6.3 vs lib/creditsafe/request/find_company.rb in creditsafe-0.7.0
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
require "creditsafe/match_type"
require "creditsafe/namespace"
-require "creditsafe/constants"
+require "creditsafe/country"
module Creditsafe
module Request
class FindCompany
def initialize(search_criteria)
@@ -75,11 +75,10 @@
}
end
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/MethodLength
- # rubocop:disable Metrics/PerceivedComplexity
# rubocop:disable Metrics/AbcSize
def check_search_criteria(search_criteria)
if search_criteria[:country_code].nil?
raise ArgumentError, "country_code is a required search criteria"
end
@@ -95,16 +94,15 @@
if search_criteria[:postal_code] && search_criteria[:country_code] != "DE"
raise ArgumentError, "Postal code is only supported for German searches"
end
- if search_criteria[:vat_number] && !Constants::Country::VAT_NUMBER_SUPPORTED.
+ if search_criteria[:vat_number] && !Creditsafe::Country::VAT_NUMBER_SUPPORTED.
include?(search_criteria[:country_code])
raise ArgumentError, "VAT number is not supported in this country"
end
end
# rubocop:enable Metrics/AbcSize
- # rubocop:enable Metrics/PerceivedComplexity
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/CyclomaticComplexity
def only_one_required_criteria?(search_criteria)
by_registration_number = !search_criteria[:registration_number].nil?