             else if dweet.this is 'failed'
                 return robot.logger.error dweet.because
             else
-                content = decodeChildren dweet.with[0].content
+                content = DecodeChildren dweet.with[0].content
                 robot.brain.mergeData content
                 robot.logger.info 'Data for brain retrieved from Dweet.io.'
                 status.lastSaved = dweet.with[0].created

#   Dweet.io and MsgPack powered Hubot Brain
#
# Dependencies:
#   "moment": "^2.6.0"
#   "msgpack": "^0.2.3"
#
# Commands:

DWEET_KEY = process.env.DWEET_KEY
DWEET_AUTOSAVE = process.env.DWEET_AUTOSAVE or 1800

Serialize = (object) ->
    msgpack.pack(object).toString('base64')

Unserialize = (encodedObject) ->
    msgpack.unpack new Buffer(encodedObject, 'base64')

EncodeChildren = (object, ignoreUsers = false) ->
    encodedObject = {}
    for key, value of object
        continue if ignoreUsers and key is 'users'
        encodedObject[key] = Serialize value
    encodedObject

DecodeChildren = (object) ->
    decodedObject = {}
    for key, value of object
        decodedObject[key] = Unserialize value
    decodedObject

module.exports = (robot) ->
