Class: Sunweather::Geo

Inherits:
Object
  • Object
show all
Defined in:
lib/sunweather/geo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request = ENV["FREEFORM_ADDRESS_QUERY"]) ⇒ Geo

Returns a new instance of Geo.



7
8
9
# File 'lib/sunweather/geo.rb', line 7

def initialize (request = ENV["FREEFORM_ADDRESS_QUERY"])
	@data = Geocoder.search(request)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/sunweather/geo.rb', line 5

def data
  @data
end

Instance Method Details

#latObject



11
12
13
# File 'lib/sunweather/geo.rb', line 11

def lat
	@data[0].data["geometry"]["location"]["lat"]
end

#lngObject



15
16
17
# File 'lib/sunweather/geo.rb', line 15

def lng
	@data[0].data["geometry"]["location"]["lng"]
end