Skip to content

Commit 27e8dc3

Browse files
humitosagjohnson
authored andcommitted
Remove /api/v1/version/{}/highest endpoint (#2862)
This endpoint was used by an old Javascript file to check if the documentation shown was old and show a NOTE in the html. Now, that is included in the footer of the the page at rendering time.
1 parent 277457c commit 27e8dc3

File tree

4 files changed

+0
-200
lines changed

4 files changed

+0
-200
lines changed

docs/api.rst

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ Alternatively you can try with the following value::
4444
#val = api.version('pip').get()
4545
#val = api.version('pip').get(slug='1.0.1')
4646

47-
#val = api.version('pip').highest.get()
48-
#val = api.version('pip').highest('0.8').get()
49-
5047

5148
API Endpoints
5249
-------------
@@ -484,59 +481,6 @@ Version
484481
Filtering Examples
485482
------------------
486483

487-
Find Highest Version
488-
~~~~~~~~~~~~~~~~~~~~
489-
::
490-
491-
http://readthedocs.org/api/v1/version/pip/highest/?format=json
492-
493-
.. http:get:: /api/v1/version/{id}/highest/
494-
495-
:arg id: A Version id.
496-
497-
Retrieve highest version.
498-
499-
.. sourcecode:: js
500-
501-
{
502-
"is_highest": true,
503-
"project": "Version 1.0.1 of pip (5476)",
504-
"slug": [
505-
"1.0.1"
506-
],
507-
"url": "/docs/pip/en/1.0.1/",
508-
"version": "1.0.1"
509-
}
510-
511-
512-
Compare Highest Version
513-
~~~~~~~~~~~~~~~~~~~~~~~
514-
515-
This will allow you to compare whether a certain version is the highest version of a specific project. The below query should return a `'is_highest': false` in the returned dictionary.
516-
517-
::
518-
519-
http://readthedocs.org/api/v1/version/pip/highest/0.8/?format=json
520-
521-
.. http:get:: /api/v1/version/{id}/highest/{version}
522-
523-
:arg id: A Version id.
524-
:arg version: A Version number or string.
525-
526-
Retrieve highest version.
527-
528-
.. sourcecode:: js
529-
530-
{
531-
"is_highest": false,
532-
"project": "Version 1.0.1 of pip (5476)",
533-
"slug": [
534-
"1.0.1"
535-
],
536-
"url": "/docs/pip/en/1.0.1/",
537-
"version": "1.0.1"
538-
}
539-
540484

541485
File Search
542486
~~~~~~~~~~~

media/javascript/rtd.js

Lines changed: 0 additions & 95 deletions
This file was deleted.

readthedocs/api/base.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from readthedocs.builds.models import Version
2020
from readthedocs.core.utils import trigger_build
2121
from readthedocs.projects.models import Project, ImportedFile
22-
from readthedocs.restapi.views.footer_views import get_version_compare_data
2322

2423
from .utils import SearchMixin, PostAuthentication
2524

@@ -139,18 +138,6 @@ def get_object_list(self, request):
139138
self._meta.queryset = Version.objects.api(user=request.user)
140139
return super(VersionResource, self).get_object_list(request)
141140

142-
def version_compare(self, request, project_slug, base=None, **__):
143-
project = get_object_or_404(Project, slug=project_slug)
144-
if base and base != LATEST:
145-
try:
146-
base_version = project.versions.get(slug=base)
147-
except (Version.DoesNotExist, TypeError):
148-
base_version = None
149-
else:
150-
base_version = None
151-
ret_val = get_version_compare_data(project, base_version)
152-
return self.create_response(request, ret_val)
153-
154141
def build_version(self, request, **kwargs):
155142
project = get_object_or_404(Project, slug=kwargs['project_slug'])
156143
version = kwargs.get('version_slug', LATEST)
@@ -164,15 +151,6 @@ def override_urls(self):
164151
% self._meta.resource_name,
165152
self.wrap_view('get_schema'),
166153
name="api_get_schema"),
167-
url((r"^(?P<resource_name>%s)/(?P<project_slug>[a-z-_]+)/highest/"
168-
r"(?P<base>.+)/$")
169-
% self._meta.resource_name,
170-
self.wrap_view('version_compare'),
171-
name="version_compare"),
172-
url(r"^(?P<resource_name>%s)/(?P<project_slug>[a-z-_]+)/highest/$"
173-
% self._meta.resource_name,
174-
self.wrap_view('version_compare'),
175-
name="version_compare"),
176154
url(r"^(?P<resource_name>%s)/(?P<project__slug>[a-z-_]+[a-z0-9-_]+)/$" # noqa
177155
% self._meta.resource_name,
178156
self.wrap_view('dispatch_list'),

readthedocs/rtd_tests/tests/test_api.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -207,33 +207,6 @@ def test_ensure_get_unauth(self):
207207
resp = self.client.get("/api/v1/project/", data={"format": "json"})
208208
self.assertEqual(resp.status_code, 200)
209209

210-
def test_not_highest(self):
211-
resp = self.client.get(
212-
"http://testserver/api/v1/version/read-the-docs/highest/0.2.1/",
213-
data={"format": "json"}
214-
)
215-
self.assertEqual(resp.status_code, 200)
216-
obj = json.loads(resp.content)
217-
self.assertEqual(obj['is_highest'], False)
218-
219-
def test_latest_version_highest(self):
220-
resp = self.client.get(
221-
"http://testserver/api/v1/version/read-the-docs/highest/latest/",
222-
data={"format": "json"}
223-
)
224-
self.assertEqual(resp.status_code, 200)
225-
obj = json.loads(resp.content)
226-
self.assertEqual(obj['is_highest'], True)
227-
228-
def test_real_highest(self):
229-
resp = self.client.get(
230-
"http://testserver/api/v1/version/read-the-docs/highest/0.2.2/",
231-
data={"format": "json"}
232-
)
233-
self.assertEqual(resp.status_code, 200)
234-
obj = json.loads(resp.content)
235-
self.assertEqual(obj['is_highest'], True)
236-
237210

238211
class APIImportTests(TestCase):
239212

0 commit comments

Comments
 (0)