You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's possible to combine the Resource and Resources classes into a single class by refactoring all existing Resources methods as @classmethod implementations. This change requires defining session and url as class variables, which impacts the architecture of the Client class. Currently, these are instance variables, which are set on object initialization. This ensures that multiple clients can be defined for different Connect servers. Class variables, on the other hand, are scoped to the class, not the instance. Therefore, each client must define separate classes at runtime to ensure that the resources used by the client are scoped to the proper Connect server. Here is a simple example showing how to define classes at runtime with different instance variables: https://gist.github.com/tdstein/f8326a7f63562652a98ca7958c31f813
The text was updated successfully, but these errors were encountered:
After further exploration, we discovered that this pattern introduces too many oddities. Foremost is handling multiple Client instances correctly. Using class variables to manage the url and session instances becomes overly complex.
It's possible to combine the
Resource
andResources
classes into a single class by refactoring all existingResources
methods as@classmethod
implementations. This change requires definingsession
andurl
as class variables, which impacts the architecture of theClient
class. Currently, these are instance variables, which are set on object initialization. This ensures that multiple clients can be defined for different Connect servers. Class variables, on the other hand, are scoped to the class, not the instance. Therefore, each client must define separate classes at runtime to ensure that the resources used by the client are scoped to the proper Connect server. Here is a simple example showing how to define classes at runtime with different instance variables: https://gist.github.com/tdstein/f8326a7f63562652a98ca7958c31f813The text was updated successfully, but these errors were encountered: