From e9624414184edd3cc907346a5916bb91f427a6d6 Mon Sep 17 00:00:00 2001 From: Garrett Gregor Date: Sat, 1 Jun 2024 13:30:29 -0600 Subject: [PATCH 1/2] docs: update with notes about validity for zips --- doc/default/address.md | 3 +++ lib/faker/default/address.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/default/address.md b/doc/default/address.md index 4ab3e02286..a4113391c8 100644 --- a/doc/default/address.md +++ b/doc/default/address.md @@ -17,10 +17,13 @@ Faker::Address.mail_box #=> "PO Box 123" Faker::Address.community #=> "University Crossing" +#note: #zip_code will return a random string in zipcode format; may or may not be a valid US zip Faker::Address.zip_code #=> "58517" or "23285-4905" +#note: #zip will return a random string in zipcode format; may or may not be a valid US zip Faker::Address.zip #=> "58517" or "66259-8212" +#note: #postcode will return a random string in postcode format; may or may not be a valid US zip Faker::Address.postcode #=> "76032-4907" or "58517" Faker::Address.time_zone #=> "Asia/Yakutsk" diff --git a/lib/faker/default/address.rb b/lib/faker/default/address.rb index fcbdb5b8e3..b82fb49a7a 100644 --- a/lib/faker/default/address.rb +++ b/lib/faker/default/address.rb @@ -119,8 +119,8 @@ def zip_code(state_abbreviation: '') return numerify(letterified_string, leading_zero: true) end - # provide a zip code that is valid for the state provided - # see http://www.fincen.gov/forms/files/us_state_territory_zip_codes.pdf + # provide a zip code that may be valid for the state provided + # note: zip code may appear in the correct format for the state provided but may not be an actual state zip. bothify(fetch("address.postcode_by_state.#{state_abbreviation}")) end From 98144d620935cae4227450fcf3aeb56b2a97030f Mon Sep 17 00:00:00 2001 From: Garrett Gregor Date: Mon, 10 Jun 2024 08:16:34 -0600 Subject: [PATCH 2/2] update with locale --- doc/default/address.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/default/address.md b/doc/default/address.md index a4113391c8..828818a0fc 100644 --- a/doc/default/address.md +++ b/doc/default/address.md @@ -17,13 +17,13 @@ Faker::Address.mail_box #=> "PO Box 123" Faker::Address.community #=> "University Crossing" -#note: #zip_code will return a random string in zipcode format; may or may not be a valid US zip +#note: #zip_code will return a random string in zipcode format; may or may not be a valid zip for locale Faker::Address.zip_code #=> "58517" or "23285-4905" -#note: #zip will return a random string in zipcode format; may or may not be a valid US zip +#note: #zip will return a random string in zipcode format; may or may not be a valid zip for locale Faker::Address.zip #=> "58517" or "66259-8212" -#note: #postcode will return a random string in postcode format; may or may not be a valid US zip +#note: #postcode will return a random string in postcode format; may or may not be a valid zip for locale Faker::Address.postcode #=> "76032-4907" or "58517" Faker::Address.time_zone #=> "Asia/Yakutsk"