Class: Weather
- Inherits:
-
Jarvis::Service
- Object
- Jarvis::Service
- Weather
- Defined in:
- lib/jarvis/services/weather.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#parsed_response ⇒ Object
Returns the value of attribute parsed_response.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#zip_api_response ⇒ Object
Returns the value of attribute zip_api_response.
Attributes inherited from Jarvis::Service
Instance Method Summary collapse
Methods inherited from Jarvis::Service
environment, #initialize, interpreter_pattern, invoke_with, #method_missing, phrases, #validate_environment
Constructor Details
This class inherits a constructor from Jarvis::Service
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Jarvis::Service
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
7 8 9 |
# File 'lib/jarvis/services/weather.rb', line 7 def location @location end |
#parsed_response ⇒ Object
Returns the value of attribute parsed_response.
7 8 9 |
# File 'lib/jarvis/services/weather.rb', line 7 def parsed_response @parsed_response end |
#temperature ⇒ Object
Returns the value of attribute temperature.
7 8 9 |
# File 'lib/jarvis/services/weather.rb', line 7 def temperature @temperature end |
#zip_api_response ⇒ Object
Returns the value of attribute zip_api_response.
7 8 9 |
# File 'lib/jarvis/services/weather.rb', line 7 def zip_api_response @zip_api_response end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 |
# File 'lib/jarvis/services/weather.rb', line 9 def run self.response = Jarvis.get("http://api.openweathermap.org/data/2.5/weather?q=#{encoded_location}").response calculate_temperature self.response = "#{weather_description}. The temperature is currently #{temperature}" end |