Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions data/zipcodes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"00605","Aguadilla","PR","18.465162","-67.141486","-4","0"
"00606","Maricao","PR","18.182151","-66.9588","-4","0"
"00607","Aguas Buenas","PR","18.256995","-66.104657","-4","0"

"00609","Aibonito","PR","18.142002","-66.273278","-4","0"
"00610","Anasco","PR","18.288319","-67.13604","-4","0"
"00611","Angeles","PR","18.279531","-66.80217","-4","0"
Expand All @@ -30,7 +29,6 @@
"00625","Caguas","PR","18.232109","-66.039087","-4","0"
"00626","Caguas","PR","18.235003","-66.037318","-4","0"
"00627","Camuy","PR","18.435246","-66.85644","-4","0"

"00631","Castaner","PR","18.186739","-66.85174","-4","0"
"00633","Cayey","PR","18.194527","-66.183467","-4","0"
"00634","Cayey","PR","18.111528","-66.177083","-4","0"
Expand All @@ -41,7 +39,6 @@
"00639","Cidra","PR","18.176094","-66.158728","-4","0"
"00640","Coamo","PR","18.077197","-66.359104","-4","0"
"00641","Utuado","PR","18.268896","-66.70519","-4","0"

"00643","Corozal","PR","18.341254","-66.315194","-4","0"
"00644","Coto Laurel","PR","18.049577","-66.55218","-4","0"
"00645","Culebra","PR","18.308508","-65.304732","-4","0"
Expand All @@ -66,8 +63,6 @@
"00669","Lares","PR","18.288418","-66.87503","-4","0"
"00670","Las Marias","PR","18.241343","-66.97604","-4","0"
"00671","Las Piedras","PR","18.1789","-65.869939","-4","0"


"00674","Manati","PR","18.426137","-66.48697","-4","0"
"00676","Moca","PR","18.37956","-67.08424","-4","0"
"00677","Rincon","PR","18.336121","-67.23675","-4","0"
Expand All @@ -84,13 +79,10 @@
"00693","Vega Baja","PR","18.440667","-66.3921","-4","0"
"00694","Vega Baja","PR","18.443109","-66.398302","-4","0"
"00698","Yauco","PR","18.06547","-66.85587","-4","0"

"00703","Aguas Buenas","PR","18.246205","-66.12827","-4","0"
"00704","Aguirre","PR","17.970112","-66.22291","-4","0"
"00705","Aibonito","PR","18.12942","-66.26541","-4","0"
"00707","Maunabo","PR","18.014505","-65.91018","-4","0"


"00714","Arroyo","PR","17.987288","-66.05552","-4","0"
"00715","Mercedita","PR","18.003492","-66.55868","-4","0"
"00716","Ponce","PR","17.999066","-66.59965","-4","0"
Expand All @@ -100,7 +92,6 @@
"00720","Orocovis","PR","18.217827","-66.42265","-4","0"
"00721","Palmer","PR","18.364161","-65.778288","-4","0"
"00723","Patillas","PR","18.023196","-66.0131","-4","0"

"00725","Caguas","PR","18.233927","-66.04502","-4","0"
"00726","Caguas","PR","18.212965","-66.058033","-4","0"
"00728","Ponce","PR","18.013353","-66.65218","-4","0"
Expand All @@ -118,18 +109,14 @@
"00740","Puerto Real","PR","18.331711","-65.62761","-4","0"
"00741","Punta Santiago","PR","18.160755","-65.75765","-4","0"
"00742","Roosevelt Roads","PR","18.264872","-65.594769","-4","0"

"00744","Rio Blanco","PR","18.206329","-65.743058","-4","0"
"00745","Rio Grande","PR","18.366213","-65.82277","-4","0"
"00747","Lluveras","PR","18.069474","-66.952589","-4","0"
"00748","Fajardo","PR","18.326732","-65.652484","-4","0"
"00751","Salinas","PR","17.993803","-66.26534","-4","0"
"00752","San Antonio","PR","18.493745","-67.097726","-4","0"

"00754","San Lorenzo","PR","18.15633","-65.96831","-4","0"

"00757","Santa Isabel","PR","17.98631","-66.39457","-4","0"

"00761","Utuado","PR","18.265445","-66.702364","-4","0"
"00762","Vega Alta","PR","18.420218","-66.324284","-4","0"
"00763","Monserrate","PR","18.452175","-66.399836","-4","0"
Expand Down Expand Up @@ -2500,6 +2487,7 @@
"06457","Middletown","CT","41.553672","-72.6632","-5","1"
"06459","Middletown","CT","41.556463","-72.658179","-5","1"
"06460","Milford","CT","41.21953","-73.0554","-5","1"
"06461","Milford","CT","41.21953","-73.0554","-5","1"
"06467","Milldale","CT","41.565697","-72.903746","-5","1"
"06468","Monroe","CT","41.336046","-73.22241","-5","1"
"06469","Moodus","CT","41.506499","-72.44479","-5","1"
Expand Down Expand Up @@ -3457,7 +3445,7 @@
"10001","New York","NY","40.750742","-73.99653","-5","1"
"10002","New York","NY","40.71704","-73.987","-5","1"
"10003","New York","NY","40.732509","-73.98935","-5","1"
"10004","New York","NJ","40.699226","-74.04118","-5","1"
"10004","New York","NY","40.699226","-74.04118","-5","1"
"10005","New York","NY","40.706019","-74.00858","-5","1"
"10006","New York","NY","40.707904","-74.01342","-5","1"
"10007","New York","NY","40.714754","-74.00721","-5","1"
Expand Down Expand Up @@ -3503,8 +3491,10 @@
"10048","New York","NY","40.712086","-74.01227","-5","1"
"10055","New York","NY","40.780751","-73.977182","-5","1"
"10060","New York","NY","40.780751","-73.977182","-5","1"
"10065","New York","NY","40.760000","-73.960000","-5","1"
"10069","New York","NY","40.775477","-73.9905","-5","1"
"10072","New York","NY","40.780751","-73.977182","-5","1"
"10075","New York","NY","40.773559","-73.956069","-5","1"
"10079","New York","NY","40.780751","-73.977182","-5","1"
"10080","New York","NY","40.780751","-73.977182","-5","1"
"10081","New York","NY","40.780751","-73.977182","-5","1"
Expand Down Expand Up @@ -3585,6 +3575,7 @@
"10196","New York","NY","40.780751","-73.977182","-5","1"
"10197","New York","NY","40.780751","-73.977182","-5","1"
"10199","New York","NY","40.750308","-74.00058","-5","1"
"10200","New York","NY","40.770000","-73.95000","-5","1"
"10203","New York","NY","40.780751","-73.977182","-5","1"
"10211","New York","NY","40.780751","-73.977182","-5","1"
"10212","New York","NY","40.780751","-73.977182","-5","1"
Expand Down Expand Up @@ -15279,6 +15270,7 @@
"34611","Spring Hill","FL","28.564167","-82.416515","-5","1"
"34613","Brooksville","FL","28.555346","-82.53601","-5","1"
"34614","Brooksville","FL","28.632101","-82.52181","-5","1"
"34638","Land O Lakes","FL","28.27","-82.52","-5","1"
"34636","Istachatta","FL","28.65503","-82.267706","-5","1"
"34639","Land O Lakes","FL","28.233671","-82.45463","-5","1"
"34652","New Port Richey","FL","28.237582","-82.72818","-5","1"
Expand Down Expand Up @@ -20185,6 +20177,7 @@
"46058","Mulberry","IN","40.349135","-86.66424","-5","0"
"46060","Noblesville","IN","40.050109","-85.99815","-5","0"
"46061","Noblesville","IN","40.072462","-86.052285","-5","0"
"46062","Noblesville","IN","40.072462","-86.052285","-5","0"
"46063","Orestes","IN","40.27046","-85.72871","-5","0"
"46064","Pendleton","IN","39.997694","-85.75075","-5","0"
"46065","Rossville","IN","40.427919","-86.61059","-5","0"
Expand Down Expand Up @@ -27112,6 +27105,7 @@
"60639","Chicago","IL","41.921431","-87.75415","-6","1"
"60640","Chicago","IL","41.973181","-87.6665","-6","1"
"60641","Chicago","IL","41.946431","-87.74576","-6","1"
"60642","Chicago","IL","41.9","-87.65","-6","1"
"60643","Chicago","IL","41.696433","-87.65993","-6","1"
"60644","Chicago","IL","41.881331","-87.75671","-6","1"
"60645","Chicago","IL","42.008956","-87.69634","-6","1"
Expand Down Expand Up @@ -33332,6 +33326,7 @@
"75029","Lewisville","TX","33.20743","-97.116282","-6","1"
"75030","Rowlett","TX","32.91747","-96.534737","-6","1"
"75032","Rockwall","TX","32.867103","-96.44129","-6","1"
"75033","Frisco","TX","33.143792","-96.83938","-6","1"
"75034","Frisco","TX","33.143792","-96.83938","-6","1"
"75035","Frisco","TX","33.130086","-96.78177","-6","1"
"75037","Irving","TX","32.767268","-96.777626","-6","1"
Expand Down Expand Up @@ -33455,7 +33450,7 @@
"75202","Dallas","TX","32.77988","-96.80502","-6","1"
"75203","Dallas","TX","32.745831","-96.80672","-6","1"
"75204","Dallas","TX","32.800333","-96.78952","-6","1"
"75205","Dallas","TX","32.836094","-96.79524","-6","1"
"75205","Dallas","TX","32.843116","-96.789009","-6","1"
"75206","Dallas","TX","32.826128","-96.7712","-6","1"
"75207","Dallas","TX","32.78643","-96.81992","-6","1"
"75208","Dallas","TX","32.751464","-96.83864","-6","1"
Expand Down Expand Up @@ -34708,6 +34703,7 @@
"77493","Katy","TX","29.810279","-95.82011","-6","1"
"77494","Katy","TX","29.760833","-95.81104","-6","1"
"77496","Sugar Land","TX","29.525461","-95.756462","-6","1"
"77498","Sugar Land","TX","29.525461","-95.756462","-6","1"
"77497","Stafford","TX","29.525461","-95.756462","-6","1"
"77501","Pasadena","TX","29.83399","-95.434241","-6","1"
"77502","Pasadena","TX","29.680079","-95.19966","-6","1"
Expand Down Expand Up @@ -36028,6 +36024,7 @@
"80110","Englewood","CO","39.646847","-104.99076","-7","1"
"80111","Englewood","CO","39.610431","-104.88139","-7","1"
"80112","Englewood","CO","39.579454","-104.88288","-7","1"
"80113","Englewood","CO","39.64","-104.96","-7","1"
"80115","Aurora","CO","39.636562","-104.82093","-7","1"
"80116","Franktown","CO","39.355957","-104.7241","-7","1"
"80117","Kiowa","CO","39.382543","-104.42847","-7","1"
Expand Down Expand Up @@ -37619,13 +37616,15 @@
"85079","Phoenix","AZ","33.276539","-112.18717","-7","0"
"85080","Phoenix","AZ","33.276539","-112.18717","-7","0"
"85082","Phoenix","AZ","33.276539","-112.18717","-7","0"
"85083","Phoenix","AZ","33.73","-112.14","-7","0"
"85085","Phoenix","AZ","33.77776","-112.07945","-7","0"
"85086","Anthem","AZ","33.831866","-112.06339","-7","0"
"85087","New River","AZ","33.921493","-112.09992","-7","0"
"85089","New River","AZ","33.909138","-112.140771","-7","0"
"85097","Phoenix","AZ","33.276539","-112.18717","-7","0"
"85098","Phoenix","AZ","33.276539","-112.18717","-7","0"
"85099","Phoenix","AZ","33.276539","-112.18717","-7","0"
"85122","Casa Grande","AZ","32.91","-111.74","-7","0"
"85123","Mesa","AZ","33.427135","-111.758483","-7","0"
"85200","Mesa","AZ","33.423596","-111.594435","-7","0"
"85201","Mesa","AZ","33.432177","-111.84701","-7","0"
Expand Down Expand Up @@ -37713,6 +37712,7 @@
"85290","Tortilla Flat","AZ","33.276539","-112.18717","-7","0"
"85291","Valley Farms","AZ","33.013502","-111.42979","-7","0"
"85292","Winkelman","AZ","32.945838","-110.72198","-7","0"
"85295","Gilbert","AZ","33.3","-111.74","-7","0"
"85296","Gilbert","AZ","33.319722","-111.76078","-7","0"
"85297","Gilbert","AZ","33.272322","-111.714171","-7","0"
"85299","Gilbert","AZ","33.276539","-112.18717","-7","0"
Expand Down Expand Up @@ -37796,6 +37796,7 @@
"85385","Peoria","AZ","33.276539","-112.18717","-7","0"
"85387","Surprise","AZ","33.276539","-112.18717","-7","0"
"85390","Wickenburg","AZ","33.961122","-112.76952","-7","0"
"85392","Avondale","AZ","33.47","-112.29","-7","0"
"85395","Peoria","AZ","33.580089","-112.246311","-7","0"
"85439","San Luis","AZ","32.491745","-114.784135","-7","0"
"85501","Globe","AZ","33.53457","-110.75681","-7","0"
Expand Down Expand Up @@ -38714,6 +38715,8 @@
"89170","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89173","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89177","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89179","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89179","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89180","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89185","Las Vegas","NV","35.927901","-114.972061","-8","1"
"89191","Nellis AFB","NV","36.370315","-115.23128","-8","1"
Expand Down Expand Up @@ -39444,6 +39447,8 @@
"92007","Cardiff By The Sea","CA","33.026742","-117.27816","-8","1"
"92008","Carlsbad","CA","33.158137","-117.32646","-8","1"
"92009","Carlsbad","CA","33.097841","-117.26744","-8","1"
"92010","Carlsbad","CA","33.016928","-116.846046","-8","1"
"92011","Carlsbad","CA","33.016928","-116.846046","-8","1"
"92013","Carlsbad","CA","33.016928","-116.846046","-8","1"
"92014","Del Mar","CA","32.961812","-117.25967","-8","1"
"92018","Carlsbad","CA","33.016928","-116.846046","-8","1"
Expand Down Expand Up @@ -39715,6 +39720,7 @@
"92392","Victorville","CA","34.489466","-117.35321","-8","1"
"92393","Victorville","CA","34.839964","-115.967051","-8","1"
"92394","Victorville","CA","34.55965","-117.35773","-8","1"
"92395","Victorville","CA","34.55965","-117.35773","-8","1"
"92396","Winchester","CA","33.714421","-117.069361","-8","1"
"92397","Wrightwood","CA","34.35876","-117.62752","-8","1"
"92398","Yermo","CA","34.909491","-116.84058","-8","1"
Expand Down Expand Up @@ -39809,6 +39815,7 @@
"92614","Irvine","CA","33.680408","-117.82592","-8","1"
"92615","Huntington Beach","CA","33.640302","-117.769442","-8","1"
"92616","Irvine","CA","33.640302","-117.769442","-8","1"
"92617","Irvine","CA","33.63","-117.83","-8","1"
"92618","Irvine","CA","33.659639","-117.73948","-8","1"
"92619","Irvine","CA","33.66985","-117.765939","-8","1"
"92620","Irvine","CA","33.714889","-117.7633","-8","1"
Expand Down Expand Up @@ -40473,6 +40480,7 @@
"94155","San Francisco","CA","37.784827","-122.727802","-8","1"
"94156","San Francisco","CA","37.784827","-122.727802","-8","1"
"94157","San Francisco","CA","37.784827","-122.727802","-8","1"
"94158","San Francisco","CA","37.76","-122.39","-8","1"
"94159","San Francisco","CA","37.784827","-122.727802","-8","1"
"94160","San Francisco","CA","37.784827","-122.727802","-8","1"
"94161","San Francisco","CA","37.784827","-122.727802","-8","1"
Expand Down
21 changes: 5 additions & 16 deletions lib/area.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,20 @@
require 'area/string'

module Area

zip_path = File.open(File.join(File.dirname(__FILE__), '..', 'data', 'zipcodes.csv'))
area_path = File.open(File.join(File.dirname(__FILE__), '..', 'data', 'areacodes.csv'))

# there is probably a better way to do this...
if RUBY_VERSION.to_f >= 1.9
@area_codes = CSV.read(area_path)
@zip_codes = CSV.read(zip_path)
else
@area_codes = FasterCSV.parse(area_path)
@zip_codes = FasterCSV.parse(zip_path)
end
ZIP_PATH = File.join(File.dirname(__FILE__), '..', 'data', 'zipcodes.csv')
AREA_PATH = File.join(File.dirname(__FILE__), '..', 'data', 'areacodes.csv')

def self.area_codes
@area_codes
@area_codes ||= RUBY_VERSION.to_f >= 1.9 ? CSV.read(AREA_PATH) : FasterCSV.parse(AREA_PATH)
end

def self.zip_codes
@zip_codes
@zip_codes ||= RUBY_VERSION.to_f >= 1.9 ? CSV.read(ZIP_PATH) : FasterCSV.parse(ZIP_PATH)
end

def self.regions
regions = []
@area_codes.map{|row| regions << row.last.upcase }
area_codes.map{|row| regions << row.last.upcase }
return regions
end

Expand Down Expand Up @@ -77,5 +67,4 @@ def self.zip_or_territory?(state)
end
end


end
2 changes: 1 addition & 1 deletion lib/area/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Area
VERSION = "0.10.0"
VERSION = "0.10.8"
end