Updates residence to handle CensusAPI's new response

This commit is contained in:
kikito
2016-04-12 18:19:05 +02:00
parent 4f724ef3bf
commit 7987a3410b
2 changed files with 3 additions and 12 deletions

View File

@@ -78,12 +78,7 @@ class Verification::Residence
end
def genre
case @census_api_response.genre
when "Varón"
"male"
when "Mujer"
"female"
end
@census_api_response.genre
end
private
@@ -95,7 +90,7 @@ class Verification::Residence
def residency_valid?
@census_api_response.valid? &&
@census_api_response.postal_code == postal_code &&
@census_api_response.date_of_birth == date_to_string(date_of_birth)
@census_api_response.date_of_birth == date_of_birth
end
def clean_document_number

View File

@@ -13,13 +13,9 @@ module ActiveModel::Dates
attrs.except("#{field}(1i)", "#{field}(2i)", "#{field}(3i)")
end
def date_to_string(date)
date.strftime("%d-%m-%Y")
end
def string_to_date(value)
day, month, year = value.split("-")
Date.new(year.to_i, month.to_i, day.to_i)
end
end
end