Module: Duststorm::Utils::ResponseMapper
- Included in:
- WeatherApi::Base
- Defined in:
- lib/duststorm/utils/response_mapper.rb
Instance Method Summary collapse
- #high_temperature_key ⇒ Object
- #low_temperature_key ⇒ Object
- #mapped_response_body ⇒ Object
- #precipitation_key ⇒ Object
- #summary_key ⇒ Object
- #sunrise_key ⇒ Object
- #sunset_key ⇒ Object
- #temperature_key ⇒ Object
- #time_key ⇒ Object
- #wind_speed_key ⇒ Object
Instance Method Details
#high_temperature_key ⇒ Object
68 69 70 |
# File 'lib/duststorm/utils/response_mapper.rb', line 68 def high_temperature_key :high_temperature end |
#low_temperature_key ⇒ Object
64 65 66 |
# File 'lib/duststorm/utils/response_mapper.rb', line 64 def low_temperature_key :low_temperature end |
#mapped_response_body ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/duststorm/utils/response_mapper.rb', line 4 def mapped_response_body response = parsed_response_body.dup response[:currently] = currently_response(response).tap do |currently| currently[:summary] = currently[summary_key] currently[:temperature] = currently[temperature_key] currently[:precipitation] = currently[precipitation_key] currently[:wind_speed] = currently[wind_speed_key] end response[:hourly] = hourly_response(response).each do |hourly| hourly[:time] = hourly[time_key] hourly[:summary] = hourly[summary_key] hourly[:temperature] = hourly[temperature_key] hourly[:precipitation] = hourly[precipitation_key] hourly[:wind_speed] = hourly[wind_speed_key] end response[:daily] = daily_response(response).each do |daily| daily[:time] = daily[time_key] daily[:summary] = daily[summary_key] daily[:low_temperature] = daily[low_temperature_key] daily[:high_temperature] = daily[high_temperature_key] daily[:precipitation] = daily[precipitation_key] daily[:wind_speed] = daily[wind_speed_key] daily[:sunrise] = daily[sunrise_key] daily[:sunset] = daily[sunset_key] end response end |
#precipitation_key ⇒ Object
52 53 54 |
# File 'lib/duststorm/utils/response_mapper.rb', line 52 def precipitation_key :precipitation end |
#summary_key ⇒ Object
40 41 42 |
# File 'lib/duststorm/utils/response_mapper.rb', line 40 def summary_key :summary end |
#sunrise_key ⇒ Object
44 45 46 |
# File 'lib/duststorm/utils/response_mapper.rb', line 44 def sunrise_key :sunrise end |
#sunset_key ⇒ Object
48 49 50 |
# File 'lib/duststorm/utils/response_mapper.rb', line 48 def sunset_key :sunset end |
#temperature_key ⇒ Object
60 61 62 |
# File 'lib/duststorm/utils/response_mapper.rb', line 60 def temperature_key :temperature end |
#time_key ⇒ Object
36 37 38 |
# File 'lib/duststorm/utils/response_mapper.rb', line 36 def time_key :time end |
#wind_speed_key ⇒ Object
56 57 58 |
# File 'lib/duststorm/utils/response_mapper.rb', line 56 def wind_speed_key :wind_speed end |