-'use strict'
-
 # The modelize main function
 # Returns a modelize object
 #
 # @param [Object] options The main configuration object for modelize
 #
 Modelize = (options) ->
-  api.add options.api unless api[options.api]?
-  mapi = api[options.api]
+  'use strict'
+
+  unless options.connector?
+    console.error 'No connector given for api: ' + options.api
+    return
+
+  options.connector.init options.api
+
+  options.connector.add_apis_to options.has_one, options.api if options.has_one?
   
-  add_apis_to options.has_one, options.api if options.has_one?
-
-  add_apis_to options.has_many, options.api if options.has_many?
+  options.connector.add_apis_to options.has_many, options.api if options.has_many?
+
+  connector = options.connector.get options.api
 
   # Provide the constructor function for the model object.
   # Enriches the optionally provided object with model functions.

      return

    if params? && params.id?
      mapi.read(params.id, params).done callback
    else
      mapi.read(params).done callback

  # Shorthand for model.get, just provide a single ID
  #
  model.getOne = (id, observable) ->
    model.get { id: id }, observable

  # Create new object with given params


    # Export all model data as an array
    #
    self.export = (id = false) =>
      data = {}

      if id == true
        data['id'] = self['id']

      if options.editable?
        for index, name of options.editable
          data[name] = self[name]()
