Class: Sunweather::Geo
- Inherits:
-
Object
- Object
- Sunweather::Geo
- Defined in:
- lib/sunweather/geo.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(request = ENV["FREEFORM_ADDRESS_QUERY"]) ⇒ Geo
constructor
A new instance of Geo.
- #lat ⇒ Object
- #lng ⇒ Object
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/sunweather/geo.rb', line 5 def data @data end |
Instance Method Details
#lat ⇒ Object
11 12 13 |
# File 'lib/sunweather/geo.rb', line 11 def lat @data[0].data["geometry"]["location"]["lat"] end |
#lng ⇒ Object
15 16 17 |
# File 'lib/sunweather/geo.rb', line 15 def lng @data[0].data["geometry"]["location"]["lng"] end |