Class: CoffeeOutside::JsonDispatcher

Inherits:
DispatcherBase show all
Defined in:
lib/coffeeoutside/dispatchers/json.rb

Instance Attribute Summary

Attributes inherited from DispatcherBase

#end_time, #forecast, #location, #start_time

Instance Method Summary collapse

Methods inherited from DispatcherBase

#debug_method, #initialize, #notify, #production?

Constructor Details

This class inherits a constructor from CoffeeOutside::DispatcherBase

Instance Method Details

#generate_json_blobObject



8
9
10
11
12
13
14
# File 'lib/coffeeoutside/dispatchers/json.rb', line 8

def generate_json_blob
  location = {
    name: @location.name,
    url: @location.url
  }
  ::JSON.dump({ location: location })
end

#notify_debugObject



21
22
23
# File 'lib/coffeeoutside/dispatchers/json.rb', line 21

def notify_debug
  puts generate_json_blob
end

#notify_productionObject



16
17
18
19
# File 'lib/coffeeoutside/dispatchers/json.rb', line 16

def notify_production
  i = File.open("yyc.json", "w")
  i.write(generate_json_blob)
end