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.



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

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#areasObject



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

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

#latObject



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

def lat
  @response['wgs84_lat']
end

#lonObject



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

def lon
  @response['wgs84_lon']
end

#postcodeObject



37
38
39
# File 'lib/gds_api/mapit.rb', line 37

def postcode
  @response['postcode']
end