Class: Melissa::GeoPoint
- Inherits:
-
Object
- Object
- Melissa::GeoPoint
- Defined in:
- lib/melissa/geo_point.rb
Direct Known Subclasses
Constant Summary collapse
- @@melissa_attributes =
%w( Latitude Longitude CensusTract CensusBlock CountyFips CountyName PlaceCode PlaceName TimeZoneCode TimeZone CBSACode CBSATitle CBSALevel CBSADivisionCode CBSADivisionTitle CBSADivisionLevel )
- @@codes =
{ 'GS01' => 'Record was coded to the ZIP + 4 centroid (U.S.) or or the full 6-digit Postal Code level (Canada).', 'GS02' => 'Record was coded to the ZIP + 2 centroid.', 'GS03' => 'Record was coded to the 5-digit ZIP Code centroid (U.S.) or or the first 3-digit Postal Code level (Canada).', 'GS05' => 'Record was coded to rooftop level.(Available On-Premise only)', 'GS06' => 'Record was coded to interpolated rooftop level.(Available On-Premise only)*', 'GE01' => 'ZIP Code Error. An invalid ZIP Code was entered.', 'GE02' => 'ZIP Code not found. The submitted ZIP Code was not found in the database.', 'GE03' => 'Demo Mode. GeoCoder Object is in Demo Mode and a ZIP Code outside the demo range was detected.', 'GE04' => 'The GeoCoder Object data files are expired. Please update with the latest data files.', 'GE05' => 'Geocoding for the country of input record is disabled for your license. Please contact your sales representative to enable.', }
- @@good_codes =
['GS01', 'GS02', 'GS03', 'GS05', 'GS06']
- @@fatal_codes =
@@bad_codes = [‘GE01’, ‘GE02’]
['GE03', 'GE04', 'GE05']
- @@callbacks =
ThreadSafe::Array.new
Class Method Summary collapse
-
.add_callback(&callback) ⇒ Object
Allow callbacks to intercept response and perform whatever misc stuff (hint: victim_statements).
Instance Method Summary collapse
-
#latitude ⇒ Object
Added this method to have an ability to stub latitude if needed.
-
#longitude ⇒ Object
Added this method to have an ability to stub longitude if needed.
- #time_zone_offset(state = nil) ⇒ Object
- #valid? ⇒ Boolean
Class Method Details
.add_callback(&callback) ⇒ Object
Allow callbacks to intercept response and perform whatever misc stuff (hint: victim_statements)
45 46 47 |
# File 'lib/melissa/geo_point.rb', line 45 def self.add_callback(&callback) @@callbacks << callback end |
Instance Method Details
#latitude ⇒ Object
Added this method to have an ability to stub latitude if needed
55 56 57 |
# File 'lib/melissa/geo_point.rb', line 55 def latitude @latitude end |
#longitude ⇒ Object
Added this method to have an ability to stub longitude if needed
60 61 62 |
# File 'lib/melissa/geo_point.rb', line 60 def longitude @longitude end |
#time_zone_offset(state = nil) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/melissa/geo_point.rb', line 64 def time_zone_offset(state=nil) time_zone = TIME_ZONES[self.time_zone_code] return nil unless time_zone time_zone = 'US/Arizona' if state == 'AZ' return Time.now.in_time_zone(time_zone).utc_offset / -60 end |
#valid? ⇒ Boolean
49 50 51 52 |
# File 'lib/melissa/geo_point.rb', line 49 def valid? # Make sure there is at least 1 good code @is_valid end |