class TiltHydrometer::Brewfather
Public Class Methods
new(url, interval)
click to toggle source
# File lib/tilt_hydrometer/brewfather.rb, line 7 def initialize(url, interval) @url = url @interval = interval end
Public Instance Methods
post(beacon)
click to toggle source
# File lib/tilt_hydrometer/brewfather.rb, line 12 def post(beacon) throtteled_execution(beacon.uuid) do Faraday.post(@url, beacon_json(beacon), 'Content-Type' => 'application/json') end end
Private Instance Methods
beacon_json(beacon)
click to toggle source
# File lib/tilt_hydrometer/brewfather.rb, line 20 def beacon_json(beacon) { name: "Tilt-#{beacon.color}", temp: beacon.temp.to_s, temp_unit: 'F', gravity: beacon.gravity.to_s, gravity_unit: 'G' }.to_json end