Class: Melissa::AddrObj
- Inherits:
-
Object
- Object
- Melissa::AddrObj
- Defined in:
- lib/melissa/addr_obj.rb
Direct Known Subclasses
Defined Under Namespace
Classes: AddressStruct
Constant Summary collapse
- @@melissa_attributes =
%w( Company LastName Address Address2 Suite City CityAbbreviation State Zip Plus4 CarrierRoute DeliveryPointCode DeliveryPointCheckDigit CountyFips CountyName AddressTypeCode AddressTypeString Urbanization CongressionalDistrict LACS LACSLinkIndicator RBDI PrivateMailbox TimeZoneCode TimeZone Msa Pmsa DefaultFlagIndicator SuiteStatus EWSFlag CMRA DsfNoStats DsfVacant CountryCode ZipType FalseTable DPVFootnotes LACSLinkReturnCode SuiteLinkReturnCode ELotNumber ELotOrder )- @@good_codes =
['AS01', 'AS02']
- @@bad_codes =
['AC02', 'AC03']
Instance Method Summary collapse
Instance Method Details
#address_struct ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/melissa/addr_obj.rb', line 63 def address_struct @address_struct = begin if valid? if address_type_string == 'Street' || address_type_string == 'Highrise' match = self.address.match /^(\S+)\s?(N|NE|E|SE|S|SW|W|NW|) (\S.*?)\s?(N|NE|E|SE|S|SW|W|NW|)$/ end elsif self.address match = self.address.match /^(\d\S*)\s?(N|NE|E|SE|S|SW|W|NW|) (\S.*?)\s?(N|NE|E|SE|S|SW|W|NW|)$/ end if match # Parse out the optional suffix street_match = match[3].match /(\S.*?)( [A-Za-z]{2,4}|)$/ if street_match name, suffix = street_match[1], street_match[2].strip else name, suffix = match[3], '' end AddressStruct.new(match[1], match[2], name, suffix, match[4]) elsif self.address AddressStruct.new('', '', self.address, '', '') else AddressStruct.new end end end |
#delivery_point ⇒ Object
55 56 57 |
# File 'lib/melissa/addr_obj.rb', line 55 def delivery_point "#{zip}#{plus4}#{delivery_point_code}" end |
#time_zone_offset ⇒ Object
59 60 61 |
# File 'lib/melissa/addr_obj.rb', line 59 def time_zone_offset GeoPoint.time_zone_offset(self.time_zone_code, self.state) end |