def show
if @object
- render json: @object.as_api_response(:superuser)
+ render json: @object.as_api_response
else
render_not_found("object not found")
end
end
def update
- attrs_to_update = resource_attrs.reject { |k,v| [:kind,:etag].index k }
+ attrs_to_update = resource_attrs.reject { |k,v|
+ [:kind, :etag, :href].index k
+ }
if @object.update_attributes attrs_to_update
show
else
:with => :render_not_found
rescue_from ActionController::UnknownController,
:with => :render_not_found
- rescue_from ActionController::UnknownAction,
+ rescue_from AbstractController::ActionNotFound,
:with => :render_not_found
rescue_from ArvadosModel::PermissionDeniedError,
:with => :render_error
else
errors = [e.inspect]
end
- render json: { errors: errors }, status: 422
+ status = e.respond_to?(:http_status) ? e.http_status : 422
+ render json: { errors: errors }, status: status
end
def render_not_found(e=ActionController::RoutingError.new("Path not found"))
end
def thread_with_auth_info
+ Thread.current[:api_url_base] = root_url.sub(/\/$/,'') + '/arvados/v1'
begin
user = nil
api_client = nil
:self_link => "",
:next_page_token => "",
:next_link => "",
- :items => @objects.as_api_response(:superuser)
+ :items => @objects.as_api_response(nil)
}
render json: @object_list
end
order: { type: 'string', required: false }
}
end
+
+ def client_accepts_plain_text_stream
+ (request.headers['Accept'].split(' ') &
+ ['text/plain', '*/*']).count > 0
+ end
end