           throw new Error("Missing required query param: #{key}")
 
       if authorization
-        credential = resource.authorize(authorization, name)
-        request.headers["Authorization"] = "#{authorization} #{credential}"
+        if resource.authorize
+          credential = resource.authorize(authorization, name)
+          request.headers["Authorization"] = "#{authorization} #{credential}"
 
       # copy default headers
       for key, value of default_headers

      command.push "  #{url}"
      command.join(" \\\n")

    authorize: (type, action) ->
      @patchboard_client.authorizer.call(@, type, action)


  # Returns a function intended to be used as a method on a
  # Resource instance.




  constructor: (@api, options={}) ->
    {@authorizer} = options
    @shred = new Shred()

    # Validate API specification
    required_fields = ["schemas", "resources", "directory"]
    missing_fields = []
    for field in required_fields
      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(@api.schemas...)

    @resource_constructors = @create_resource_constructors(@api.resources)

    @resources = {}
    @create_directory(@api.directory, @resource_constructors)


  # Create resource instances using the URLs supplied in the service
