Class: TiltHydrometer::Brewfather

Inherits:
Object
  • Object
show all
Includes:
ThrotteledExecution
Defined in:
lib/tilt_hydrometer/brewfather.rb

Instance Method Summary collapse

Methods included from ThrotteledExecution

#execution_allowed?, #reset_timer, #throtteled_execution, #timers

Constructor Details

#initialize(url, interval) ⇒ Brewfather

Returns a new instance of Brewfather.



7
8
9
10
# File 'lib/tilt_hydrometer/brewfather.rb', line 7

def initialize(url, interval)
  @url = url
  @interval = interval
end

Instance Method Details

#post(beacon) ⇒ Object



12
13
14
15
16
# 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