Closed LadaRudnitckaia closed 3 years ago
Hey, cool work! (as always! :blush: )
A remark: as I tested the function, it seems that the country and sector still do not get written as intended! (However it is really great that it works for the other elements, such as title and description).
What I tried (similar to the test example):
kobo <- Kobo$new(
base_url_v2 = Sys.getenv("KBTBR_BASE_URL"),
kobo_token = Sys.getenv("KBTBR_TOKEN")
)
asset_create <- kobo$create_asset(
name = "test malte 2021-07-27",
sector = "Environment",
country = "Angola",
asset_type = "survey",
share_metadata = FALSE,
description = "This is the description. It is empty."
)
And yet, both sector and country fields were blank afterwards in the web interface.
Hypothesis Possible the value for those fields has to be more complex, for example compare the following example from the Kobotoolbox KPI test files.
'settings': {
'sector': {
'label': 'Other',
'value': 'Other',
},
'country': {
'label': 'United States',
'value': 'USA',
},
Changing the values for sector
and coutry
to lists (with elements value
and label
) should do the trick :tada:
We need also to reflect this in the tests already written.
Additionally, I introduced some assertions on the input arguments, using checkmate
. Is this okay? We could think about whether we would need more of them.
Passes style guide :heavy_check_mark:
High level
Kobo$create_asset
. The input parameters are: