Class: MilkMaid::GoogleSheetNotifier
- Inherits:
-
ConsoleNotifier
- Object
- ConsoleNotifier
- MilkMaid::GoogleSheetNotifier
- Defined in:
- lib/milk_maid/google_sheet_notifier.rb
Instance Attribute Summary collapse
-
#batch_record ⇒ Object
Returns the value of attribute batch_record.
Instance Method Summary collapse
- #batch_completed ⇒ Object
- #batch_started(batch_data = {}) ⇒ Object
- #log_temperature(temperature) ⇒ Object
- #post_warning(current_temperature, base_temperature) ⇒ Object
- #temperature_reached ⇒ Object
Instance Attribute Details
#batch_record ⇒ Object
Returns the value of attribute batch_record.
3 4 5 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 3 def batch_record @batch_record end |
Instance Method Details
#batch_completed ⇒ Object
5 6 7 8 9 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 5 def batch_completed super batch_record.complete! ::MilkMaid::SpreadsheetWriter.write_spreadsheet("./session.json", "Pasteurization Batch #{Time.now}", batch_record) end |
#batch_started(batch_data = {}) ⇒ Object
11 12 13 14 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 11 def batch_started(batch_data = {}) super(batch_data) @batch_record = ::MilkMaid::BatchRecord.new(batch_data) end |
#log_temperature(temperature) ⇒ Object
16 17 18 19 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 16 def log_temperature(temperature) super(temperature) batch_record.add_event(:temperature, temperature) end |
#post_warning(current_temperature, base_temperature) ⇒ Object
21 22 23 24 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 21 def post_warning(current_temperature, base_temperature) super(current_temperature, base_temperature) batch_record.add_event(:temperature_warning, current_temperature) end |
#temperature_reached ⇒ Object
26 27 28 29 |
# File 'lib/milk_maid/google_sheet_notifier.rb', line 26 def temperature_reached super batch_record.add_event(:threshold_reached) end |