Class: GeoPack

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_pack.rb,
lib/geo_pack/geo_names.rb,
lib/geo_pack/rillow_helper.rb,
lib/geo_pack/urban_mapping.rb

Defined Under Namespace

Modules: RillowHelper Classes: GeoNames, UrbanMapping

Instance Method Summary collapse

Constructor Details

#initialize(config_file_path) ⇒ GeoPack

Returns a new instance of GeoPack.



11
12
13
14
15
16
# File 'lib/geo_pack.rb', line 11

def initialize(config_file_path)
  config = YAML.load_file(config_file_path)
  @urban_mapping = UrbanMapping.new(config["urbanmapping"]["neighborhoods_apikey"], config["urbanmapping"]["secret"])
  @geo_names = GeoNames.new
  @zillower = Zillower.new(config["zillow"]["zwsid"])
end

Instance Method Details

#get_location(address, options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/geo_pack.rb', line 18

def get_location(address, options = {})
  location = {}
  location.merge!(get_address_city_and_state(address, options))
  return location if options[:exclude] == :neighborhood || location.empty?
  location.merge!(get_neighborhood(location[:address][:geom]))
  location
end

#get_property_details(address) ⇒ Object



26
27
28
29
# File 'lib/geo_pack.rb', line 26

def get_property_details(address)
  geokit_result = GeoKit::Geocoders::MultiGeocoder.geocode(address)
  @zillower.lookup_address(:address => geokit_result.street_address, :citystatezip => "#{geokit_result.city}, #{geokit_result.state}, #{geokit_result.zip}")
end