Class: CloudMade::GeoResults

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmade/geocoding.rb

Overview

Parsed results of geocoding request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ GeoResults

Returns a new instance of GeoResults.



100
101
102
103
104
105
106
# File 'lib/cloudmade/geocoding.rb', line 100

def initialize(data)
  self.found = Integer(data['found']) if data.has_key? 'found'
  if (data['features'] != nil) then
    self.results = data['features'].map { |feature_data| CloudMade::GeoResult.new(feature_data) }
  end
  self.bounds = CloudMade::BBox.from_coordinates(data['bounds']) if data.has_key? 'bounds'
end

Instance Attribute Details

#boundsObject

Bounds of result set



98
99
100
# File 'lib/cloudmade/geocoding.rb', line 98

def bounds
  @bounds
end

#foundObject

Founded results



94
95
96
# File 'lib/cloudmade/geocoding.rb', line 94

def found
  @found
end

#resultsObject

List of found GeoResult objects



96
97
98
# File 'lib/cloudmade/geocoding.rb', line 96

def results
  @results
end

Instance Method Details

#to_sObject



108
109
110
# File 'lib/cloudmade/geocoding.rb', line 108

def to_s
  results.join(',') if results != nil
end