Here's a better alternative than the first one. Added a new abstraction level from which are performed both types of census calls, while the logic of those is managed in their own library.
8 lines
230 B
Ruby
8 lines
230 B
Ruby
class CensusCaller
|
|
|
|
def call(document_type, document_number)
|
|
response = CensusApi.new.call(document_type, document_number)
|
|
response = LocalCensus.new.call(document_type, document_number) unless response.valid?
|
|
end
|
|
end
|