     user: String
     vendor: {type: String, default: 'Withings'}
 
-for model in [Weight, BloodPressure, HeartBeat]
-    model.all = (callback) ->
-        model.request 'byDate', callback
-
-    model.destroyAll = (callback) ->
-        model.requestDestroy 'byDate', callback
+Weight.all = (callback) ->
+    Weight.request 'byDate', callback
+
+HeartBeat.all = (callback) ->
+    HeartBeat.request 'byDate', callback
+
+BloodPressure.all = (callback) ->
+    BloodPressure.request 'byDate', callback
+
+
+# Konnector
+
+module.exports =
+
+    name: "Withings"
+    slug: "withings"
+    description: "Download all your measures from your Withings account."
+    vendorLink: "https://www.withings.com/"
+
+    fields:
+        email: "text"
+        password: "password"
+    models:
+        scalemeasure: Weight
+        heartbeat: HeartBeat
+        bloodpressure: BloodPressure
+
+
+    # Define model requests.
+    init: (callback) ->
+        map = (doc) -> emit doc.date, doc
+        Weight.defineRequest 'byDate', map, (err) ->
+            callback err if err
+            HeartBeat.defineRequest 'byDate', map, (err) ->
+                callback err
+                BloodPressure.defineRequest 'byDate', map, (err) ->
+
+
+# Konnector
+
+module.exports =
+
+    name: "Withings"
+    slug: "withings"
+    description: "Download all your measures from your Withings account."
+    vendorLink: "https://www.withings.com/"
+
+    fields:
+        email: "text"
+        password: "password"
+    models:
+        scalemeasure: Weight
+        heartbeat: HeartBeat
+        bloodpressure: BloodPressure
+
+
+    # Define model requests.
+    init: (callback) ->
+        map = (doc) -> emit doc.date, doc
+        Weight.defineRequest 'byDate', map, (err) ->
+            callback err if err
+            HeartBeat.defineRequest 'byDate', map, (err) ->
+                callback err
+                BloodPressure.defineRequest 'byDate', map, (err) ->
 
 
 # Konnector

request = require 'request'
moment = require 'moment'
crypto = require 'crypto'

# helpers


    log.debug 'fetch old measures'
    Weight.all (err, scaleMeasures) ->
        return callback err if err
        console.log scaleMeasures
        HeartBeat.all (err, heartBeats) ->
            return callback err if err
            BloodPressure.all (err, bloodPressures) ->
