Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template a general constructor that can recreate object out of the GoogleSheets4 API response #4

Closed
StatisMike opened this issue Sep 15, 2022 · 1 comment

Comments

@StatisMike
Copy link
Owner

StatisMike commented Sep 15, 2022

  • Very important for testing: validity of every request needs to be measured, and the best way to do it is by getting the object back from the google sheet and comparing it to the requested object specification
  • Could be useful when trying to insert similar object into googlesheets
@StatisMike
Copy link
Owner Author

General constructor system is currently embedded in deepgs4. System is currently used in few systems:

  • gen_dgs4Obj() function is general constructor. It handles most of the logic used during creation of dgs4Obj objects, being most of the items received from GoogleSheet API:
    • takes the nested list received object inside obj argument
    • takes the specific object class name
    • optionally intakes sheetId argument
    • invokes either specific object generator (which needs to be added into pkg_env$generators). These generators need to be used when an underlying class needs another dgs4Obj in any of their arguments
    • if the object is base dgs4Obj, meaning that its constructor intakes in their arguments only atomic values, it passes values available in obj into arguments of ClassName() generator. For such objects, it also can pass sheetId argument, if the underlying function intakes it AND sheetId is not available in the received obj
  • try_to_gen() invokes gen_dgs4Obj() function internally. It will try to construct an object unless the argument passed into it is NULL - many objects intaked as arguments are optional!
  • try_to_gen_inplace() works similarly like try_to_gen(), but it intakes a list and name of the field where the object should be generated in. It is preferred to use this one, as it generates cleaner syntax in costructor.

This information needs to be added into contributor guidelines #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant