Skip to content

Commit

Permalink
Docs: add http requests
Browse files Browse the repository at this point in the history
Create tranfer for qualifications complaint
Get used contract transfer
  • Loading branch information
Andrew Leitsius committed Nov 1, 2016
1 parent 822be24 commit 7abcd72
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 27 deletions.
2 changes: 2 additions & 0 deletions docs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ eggs = httpie

[versions]
sphinx-intl = 0.9.5
Pygments = 2.1.3
requests = 2.11.0
14 changes: 10 additions & 4 deletions docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ def test_docs(self):
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['description'], 'broker3 now can change the contract')

with open('docs/source/tutorial/get-used-contract-transfer.http', 'w') as self.app.file_obj:
response = self.app.get('/transfers/{}'.format(transfer['id']))

class EuTransferDocsTest(OpenEUOwnershipWebTest):

def setUp(self):
Expand Down Expand Up @@ -334,10 +337,13 @@ def test_eu_procedure(self):

# broker4 create Transfer
self.app.authorization = ('Basic', ('broker4', ''))
response = self.app.post_json('/transfers', {"data": test_transfer_data})
self.assertEqual(response.status, '201 Created')
transfer = response.json['data']
transfer_tokens = response.json['access']
with open('docs/source/tutorial/create-qualification-complaint-transfer.http', 'w') as self.app.file_obj:
response = self.app.post_json('/transfers', {"data": test_transfer_data})
self.assertEqual(response.status, '201 Created')
transfer = response.json['data']
self.assertIn('date', transfer)
transfer = response.json['data']
transfer_tokens = response.json['access']

with open('docs/source/tutorial/change-qualification-complaint-owner.http', 'w') as self.app.file_obj:
response = self.app.post_json('/tenders/{}/qualifications/{}/complaints/{}/ownership'.format(self.tender_id, qualification_id, complaint_id),
Expand Down
10 changes: 7 additions & 3 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ Let's submit a bid for qualification:

Response contains `access` section with a ``token`` key that can be used to create bid qualification complaint.

Create Transfer as in the previous examples.

`Transfer` object contains new access ``token`` and new ``transfer`` key for the object that will be transferred to new broker.

Submit a Complaint
^^^^^^^^^^^^^^^^^^
Expand All @@ -288,6 +285,13 @@ From response we take complaint ``id`` from `data` section and complaint ``trans
Changing complaint's owner
^^^^^^^^^^^^^^^^^^^^^^^^^^

Broker that is going to become new qualification complaint owner should create a `Transfer`.

.. include:: tutorial/create-qualification-complaint-transfer.http
:code:

`Transfer` object contains new access ``token`` and new ``transfer`` key for the object that will be transferred to new broker.

New broker should send POST request to the appropriate `/tenders/id/qualifications/id/complaints/id` with `data` section containing ``id`` of `Transfer` and ``transfer`` key for the complaint received from customer:

.. include:: tutorial/change-qualification-complaint-owner.http
Expand Down
12 changes: 6 additions & 6 deletions docs/source/tutorial/change-contract-ownership.http
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
POST /api/2.3/contracts/0bbe02412aa1409da48c1ff1c9998515/ownership HTTP/1.0
POST /api/2.3/contracts/4dedddab60c44e2aaff6da444cb81e03/ownership HTTP/1.0
Authorization: Basic YnJva2VyMzo=
Content-Length: 100
Content-Type: application/json
Host: api-sandbox.openprocurement.org
DATA:
{
"data": {
"transfer": "6a8d3890c44041d8ba6351763efa9ef2",
"id": "142974ce839c4b6cfd836abd79002f87"
"transfer": "ee075261c94343a399962acce973ed90",
"id": "413ef5e46cf4d07822bb1bb7ae06bd38"
}
}

Expand Down Expand Up @@ -82,7 +82,7 @@ Content-Type: application/json; charset=UTF-8
"amount": 238.0,
"valueAddedTaxIncluded": true
},
"id": "0bbe02412aa1409da48c1ff1c9998515",
"id": "4dedddab60c44e2aaff6da444cb81e03",
"owner": "broker3",
"procuringEntity": {
"contactPoint": {
Expand All @@ -106,8 +106,8 @@ Content-Type: application/json; charset=UTF-8
"contractID": "UA-2016-03-18-000001-1",
"dateSigned": "2016-03-18T18:48:05.762961+02:00",
"awardID": "8481d7eb01694c25b18658036c236c5d",
"dateModified": "2016-09-14T18:22:39.266014+03:00",
"tender_id": "3fc5b26b56484df985b02d812b9c590b"
"dateModified": "2016-11-01T11:01:31.716601+02:00",
"tender_id": "3773b35dabde487dbe1e04aa4bdae8bd"
}
}

8 changes: 4 additions & 4 deletions docs/source/tutorial/create-contract-transfer.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Response: 201 Created
Content-Type: application/json; charset=UTF-8
{
"access": {
"transfer": "a6afa28816874e53bbc3fde11eec0028",
"token": "2bed73f61da14db9abb074b234c00c69"
"transfer": "0007e50a98d44411965920763762438c",
"token": "727bd251cda34ae6a12603a330fc530c"
},
"data": {
"date": "2016-09-14T18:22:39.222959+03:00",
"id": "142974ce839c4b6cfd836abd79002f87"
"date": "2016-11-01T11:01:31.684041+02:00",
"id": "413ef5e46cf4d07822bb1bb7ae06bd38"
}
}

23 changes: 23 additions & 0 deletions docs/source/tutorial/create-qualification-complaint-transfer.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
POST /api/2.3/transfers HTTP/1.0
Authorization: Basic YnJva2VyNDo=
Content-Length: 12
Content-Type: application/json
Host: api-sandbox.openprocurement.org
DATA:
{
"data": {}
}

Response: 201 Created
Content-Type: application/json; charset=UTF-8
{
"access": {
"transfer": "76539baec6414b02a2d7cf2bec55870d",
"token": "e91eb2c19fc244b5a78e7b6c5bdfa81c"
},
"data": {
"date": "2016-11-01T11:01:23.877124+02:00",
"id": "413ef5e46cf4d07822bb1bb7ae0690d7"
}
}

12 changes: 6 additions & 6 deletions docs/source/tutorial/get-contract-transfer.http
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PATCH /api/2.3/contracts/0bbe02412aa1409da48c1ff1c9998515/credentials?acc_token=17a87853499c4b1c95e65e0178855cd3 HTTP/1.0
PATCH /api/2.3/contracts/4dedddab60c44e2aaff6da444cb81e03/credentials?acc_token=7b052a3255cf494e93369e25646a4336 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 12
Content-Type: application/json
Expand All @@ -12,8 +12,8 @@ Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
"access": {
"transfer": "6a8d3890c44041d8ba6351763efa9ef2",
"token": "12fe420d7b4f445486071e3d9d53e027"
"transfer": "ee075261c94343a399962acce973ed90",
"token": "96e09341fb914b08891bcde6d6e2390b"
},
"data": {
"status": "active",
Expand Down Expand Up @@ -83,7 +83,7 @@ Content-Type: application/json; charset=UTF-8
"amount": 238.0,
"valueAddedTaxIncluded": true
},
"id": "0bbe02412aa1409da48c1ff1c9998515",
"id": "4dedddab60c44e2aaff6da444cb81e03",
"owner": "broker",
"procuringEntity": {
"contactPoint": {
Expand All @@ -107,8 +107,8 @@ Content-Type: application/json; charset=UTF-8
"contractID": "UA-2016-03-18-000001-1",
"dateSigned": "2016-03-18T18:48:05.762961+02:00",
"awardID": "8481d7eb01694c25b18658036c236c5d",
"dateModified": "2016-09-14T18:22:39.187620+03:00",
"tender_id": "3fc5b26b56484df985b02d812b9c590b"
"dateModified": "2016-11-01T11:01:31.661141+02:00",
"tender_id": "3773b35dabde487dbe1e04aa4bdae8bd"
}
}

14 changes: 14 additions & 0 deletions docs/source/tutorial/get-used-contract-transfer.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GET /api/2.3/transfers/413ef5e46cf4d07822bb1bb7ae06bd38 HTTP/1.0
Authorization: Basic YnJva2VyMzo=
Host: api-sandbox.openprocurement.org

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
"data": {
"date": "2016-11-01T11:01:31.707899+02:00",
"id": "413ef5e46cf4d07822bb1bb7ae06bd38",
"usedFor": "/contracts/4dedddab60c44e2aaff6da444cb81e03"
}
}

8 changes: 4 additions & 4 deletions docs/source/tutorial/modify-contract.http
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PATCH /api/2.3/contracts/0bbe02412aa1409da48c1ff1c9998515?acc_token=2bed73f61da14db9abb074b234c00c69 HTTP/1.0
PATCH /api/2.3/contracts/4dedddab60c44e2aaff6da444cb81e03?acc_token=727bd251cda34ae6a12603a330fc530c HTTP/1.0
Authorization: Basic YnJva2VyMzo=
Content-Length: 64
Content-Type: application/json
Expand Down Expand Up @@ -82,7 +82,7 @@ Content-Type: application/json; charset=UTF-8
"amount": 238.0,
"valueAddedTaxIncluded": true
},
"id": "0bbe02412aa1409da48c1ff1c9998515",
"id": "4dedddab60c44e2aaff6da444cb81e03",
"owner": "broker3",
"procuringEntity": {
"contactPoint": {
Expand All @@ -106,8 +106,8 @@ Content-Type: application/json; charset=UTF-8
"contractID": "UA-2016-03-18-000001-1",
"dateSigned": "2016-03-18T18:48:05.762961+02:00",
"awardID": "8481d7eb01694c25b18658036c236c5d",
"dateModified": "2016-09-14T18:22:39.370530+03:00",
"tender_id": "3fc5b26b56484df985b02d812b9c590b"
"dateModified": "2016-11-01T11:01:31.801106+02:00",
"tender_id": "3773b35dabde487dbe1e04aa4bdae8bd"
}
}

0 comments on commit 7abcd72

Please sign in to comment.