Class: Weather
- Inherits:
-
EDI::Service
- Object
- EDI::Service
- Weather
- Defined in:
- lib/edi/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 EDI::Service
Instance Method Summary collapse
Methods inherited from EDI::Service
Methods included from EDI::Environment
included, #validate_environment
Methods included from EDI::DSL
Constructor Details
This class inherits a constructor from EDI::Service
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class EDI::Service
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
7 8 9 |
# File 'lib/edi/services/weather.rb', line 7 def location @location end |
#parsed_response ⇒ Object
Returns the value of attribute parsed_response.
7 8 9 |
# File 'lib/edi/services/weather.rb', line 7 def parsed_response @parsed_response end |
#temperature ⇒ Object
Returns the value of attribute temperature.
7 8 9 |
# File 'lib/edi/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/edi/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/edi/services/weather.rb', line 9 def run self.response = EDI.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 |