Class: GdsApi::Mapit::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/gds_api/mapit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Location

Returns a new instance of Location.



18
19
20
# File 'lib/gds_api/mapit.rb', line 18

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



16
17
18
# File 'lib/gds_api/mapit.rb', line 16

def response
  @response
end

Instance Method Details

#areasObject



30
31
32
# File 'lib/gds_api/mapit.rb', line 30

def areas
  @response['areas'].map {|i, area| OpenStruct.new(area) }
end

#latObject



22
23
24
# File 'lib/gds_api/mapit.rb', line 22

def lat
  @response['wgs84_lat']
end

#lonObject



26
27
28
# File 'lib/gds_api/mapit.rb', line 26

def lon
  @response['wgs84_lon']
end

#postcodeObject



34
35
36
# File 'lib/gds_api/mapit.rb', line 34

def postcode
  @response['postcode']
end