Skip to content

Commit 1d32363

Browse files
MartiONEamotl
authored andcommitted
Adding the legal service endpoint support
1 parent 6040928 commit 1d32363

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

epo_ops/api.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Client(object):
2828

2929
__family_path__ = "family"
3030
__images_path__ = "published-data/images"
31+
__legal_path__ = "legal"
3132
__number_path__ = "number-service"
3233
__published_data_path__ = "published-data"
3334
__published_data_search_path__ = "published-data/search"
@@ -119,6 +120,29 @@ def image(
119120
"""
120121
return self._image_request(path, range, document_format)
121122

123+
def legal(
124+
self,
125+
reference_type: str,
126+
input: Union[Original, Docdb, Epodoc],
127+
) -> requests.Response:
128+
"""
129+
Retrieval service for legal data.
130+
131+
Args:
132+
reference_type (str): Any of "publication", "application", or "priority".
133+
input (Original, Epodoc, or Docdb): The document number as an Original, Epodoc, or Docdb data object.
134+
Returns:
135+
requests.Response: a requests.Response object.
136+
137+
"""
138+
139+
return self._service_request(
140+
dict(
141+
service=self.__legal_path__,
142+
reference_type=reference_type,
143+
input=input,
144+
)
145+
)
122146
def number(
123147
self,
124148
reference_type: str,

tests/helpers/api_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def assert_image_success(client):
4848
assert_request_success(response)
4949
return response
5050

51+
def assert_legal_success(client):
52+
response = client.legal(*data)
53+
assert_request_success(response)
54+
assert "ops:legal" in response.text
55+
return response
5156

5257
def assert_published_data_success(client):
5358
response = client.published_data(*data)

tests/test_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
assert_family_legal_success,
1313
assert_family_success,
1414
assert_image_success,
15+
assert_legal_success,
1516
assert_number_service_success,
1617
assert_published_data_search_success,
1718
assert_published_data_search_with_range_success,
@@ -44,6 +45,8 @@ def test_family_legal(all_clients):
4445
def test_image(all_clients):
4546
assert_image_success(all_clients)
4647

48+
def test_legal(all_clients):
49+
assert_legal_success(all_clients)
4750

4851
def test_published_data(all_clients):
4952
assert_published_data_success(all_clients)

0 commit comments

Comments
 (0)