class JSONThermostat
The JSONThermostat
class will take in a JSON format and start the heating or cooling. It'll also return the result in a JSON format.
Attributes
settings[R]
Public Class Methods
new(settings)
click to toggle source
# File lib/json_thermostat.rb, line 9 def initialize(settings) @settings = JSON.parse(settings) end
Public Instance Methods
update(temperature)
click to toggle source
The update method will parse the @param [temperature] to a JSON format.
# File lib/json_thermostat.rb, line 14 def update(temperature) thermostat = Thermostat.new thermostat.setTemperature(JSON.parse(temperature)['temperature']) end