 
 
 
-  constructor: (options) ->
-    @api = options
+  constructor: (@api, options={}) ->
+    {@authorizer} = options
     @shred = new Shred()
 
     # Validate API specification
     required_fields = ["schemas", "resources", "directory"]
     missing_fields = []
     for field in required_fields
-      unless options[field]
+      unless @api[field]
         missing_fields.push(field)
 
     if missing_fields.length != 0
       throw new Error("API specification is missing fields: #{missing_fields.join(', ')}")
 
-    @schema_manager = new SchemaManager(options.schemas...)
-    @authorizer = options.authorizer
-
-    @resource_constructors = @create_resource_constructors(options.resources)
+    @schema_manager = new SchemaManager(@api.schemas...)
+
+    @resource_constructors = @create_resource_constructors(@api.resources)
 
     @resources = {}
-    @create_directory(options.directory, @resource_constructors)
+    @create_directory(@api.directory, @resource_constructors)
 
 
   # Create resource instances using the URLs supplied in the service

          success_handler(response, decorated)
        delete options.on[definition.status]

      # never silently die on request errors.
      # TODO: allow a default request_error handler on Client construction
      request.on.request_error ||= (err) ->
        throw err

          throw new Error("Missing required query param: #{key}")

      if authorization
        if resource.authorize
          credential = resource.authorize(authorization, name)
          request.headers["Authorization"] = "#{authorization} #{credential}"

      # copy default headers
      for key, value of default_headers
