Create InquiryResponseAPI instance from model Allows skipping the BaseAPI._from_model function if you already have a properly formed dict and just need to prune it :param skip_db: Skip the parent class' _from_model function call :rtype: InquiryResponseAPI
(cls, model, mask_secrets=False, skip_db=False)
| 158 | |
| 159 | @classmethod |
| 160 | def from_model(cls, model, mask_secrets=False, skip_db=False): |
| 161 | """Create InquiryResponseAPI instance from model |
| 162 | |
| 163 | Allows skipping the BaseAPI._from_model function if you already |
| 164 | have a properly formed dict and just need to prune it |
| 165 | |
| 166 | :param skip_db: Skip the parent class' _from_model function call |
| 167 | :rtype: InquiryResponseAPI |
| 168 | """ |
| 169 | |
| 170 | if not skip_db: |
| 171 | doc = cls._from_model(model, mask_secrets=mask_secrets) |
| 172 | else: |
| 173 | doc = model |
| 174 | |
| 175 | newdoc = {"id": doc["id"]} |
| 176 | for field in ["route", "ttl", "users", "roles", "schema"]: |
| 177 | newdoc[field] = doc["result"].get(field) |
| 178 | |
| 179 | return cls(**newdoc) |
| 180 | |
| 181 | @classmethod |
| 182 | def from_inquiry_api(cls, inquiry_api, mask_secrets=False): |
nothing calls this directly
no test coverage detected