Skip to content

Commit 55166ce

Browse files
Fixed Click API second example (#117)
* updated code example * update tests * remove blank lines --------- Co-authored-by: Paige Rossi <[email protected]>
1 parent d5539d6 commit 55166ce

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

app/click/examples/eg002_activate_clickwrap.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def get_args():
1313
"account_id": session.get("ds_account_id"), # Represents your {ACCOUNT_ID}
1414
"access_token": session.get("ds_access_token"), # Represents your {ACCESS_TOKEN}
1515
"clickwrap": request.form.get("clickwrap"),
16+
"statuses": ["inactive", "draft"]
1617
}
1718

1819
@staticmethod
@@ -28,12 +29,16 @@ def get_inactive_clickwraps(args):
2829

2930
# Step 2. Get a list of inactive clickwraps
3031
accounts_api = AccountsApi(api_client)
31-
response = accounts_api.get_clickwraps(
32-
account_id=args["account_id"],
33-
status="inactive"
34-
)
35-
36-
return response
32+
clickwraps = []
33+
34+
for status in args["statuses"]:
35+
response = accounts_api.get_clickwraps(
36+
account_id=args["account_id"],
37+
status=status
38+
)
39+
clickwraps += response.clickwraps
40+
41+
return {"clickwraps": clickwraps}
3742

3843
@staticmethod
3944
def worker(args):

app/rooms/examples/eg007_create_form_group.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ def worker(args):
2020
2. Create FormGroupForCreate object
2121
3. POST the form using SDK
2222
"""
23+
2324
# Create an API with headers
2425
#ds-snippet-start:Rooms7Step2
2526
api_client = create_rooms_api_client(access_token=args["access_token"])
2627
#ds-snippet-end:Rooms7Step2
28+
2729
# Create FormGroupForCreate object
2830
#ds-snippet-start:Rooms7Step3
2931
form = FormGroupForCreate(name=args["form_group_name"])
3032
#ds-snippet-end:Rooms7Step3
33+
3134
# Post the form object using SDK
3235
#ds-snippet-start:Rooms7Step4
3336
form_groups_api = FormGroupsApi(api_client)

app/tests/click_tests.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ def test_activate_clickwrap_worker(self):
3131
args = {
3232
"account_id": self.account_id,
3333
"base_path": self.base_path,
34-
"access_token": self.access_token
34+
"access_token": self.access_token,
35+
"statuses": ["inactive", "draft"]
3536
}
3637
results = Eg002ActivateClickwrapController.get_inactive_clickwraps(args)
37-
clickwrap = results.clickwraps[0]
38+
clickwrap = results["clickwraps"][0]
3839

3940
clickwrap_args = f"{{\"clickwrap_id\": \"{clickwrap.clickwrap_id}\",\"version_number\": \"{clickwrap.version_number}\"}}"
4041
args["clickwrap"] = clickwrap_args
@@ -48,7 +49,8 @@ def test_activate_clickwrap_get_inactive_clickwraps(self):
4849
args = {
4950
"account_id": self.account_id,
5051
"base_path": self.base_path,
51-
"access_token": self.access_token
52+
"access_token": self.access_token,
53+
"statuses": ["inactive", "draft"]
5254
}
5355

5456
results = Eg002ActivateClickwrapController.get_inactive_clickwraps(args)

0 commit comments

Comments
 (0)