Slide 38
Slide 38 text
def emit_car_location(car_id, color, lat, lon)
current_timestamp = Time.now.utc
bucket = $client.bucket(current_timestamp.strftime($timestamp_format))
!
puts "%s[%s]: %s is at [ %s, %s ]" % [
color,
current_timestamp.strftime($timestamp_format),
car_id,
lat,
lon
]
!
cars = GSet.new
cars.add(car_id)
!
object = bucket.new("%s_%s" % [ lat, lon ])
object.content_type = "application/json"
object.data = cars.to_json
!
object.store(returnbody: false)
end