Class: Barometer::WeatherService::Noaa::ForecastQuery
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Barometer::WeatherService::Noaa::ForecastQuery
- Defined in:
- lib/barometer/weather_services/noaa/forecast_query.rb
Instance Attribute Summary collapse
-
#converted_query ⇒ Object
readonly
Returns the value of attribute converted_query.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(query) ⇒ ForecastQuery
constructor
A new instance of ForecastQuery.
- #to_param ⇒ Object
Constructor Details
#initialize(query) ⇒ ForecastQuery
Returns a new instance of ForecastQuery.
13 14 15 16 |
# File 'lib/barometer/weather_services/noaa/forecast_query.rb', line 13 def initialize(query) super @converted_query = convert_query end |
Instance Attribute Details
#converted_query ⇒ Object (readonly)
Returns the value of attribute converted_query.
7 8 9 |
# File 'lib/barometer/weather_services/noaa/forecast_query.rb', line 7 def converted_query @converted_query end |
Class Method Details
.accepted_formats ⇒ Object
9 10 11 |
# File 'lib/barometer/weather_services/noaa/forecast_query.rb', line 9 def self.accepted_formats [:zipcode, :coordinates] end |
Instance Method Details
#to_param ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/barometer/weather_services/noaa/forecast_query.rb', line 18 def to_param case converted_query.format.to_sym when :short_zipcode {zipCodeList: converted_query.q} when :zipcode {zipCodeList: converted_query.q} when :coordinates {lat: converted_query.q.split(',')[0], lon: converted_query.q.split(',')[1]} else {} end end |