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

Parse responses in googleplay service, rather than returning raw data #214

Open
mitchhentges opened this issue Jul 12, 2019 · 2 comments
Open

Comments

@mitchhentges
Copy link
Contributor

Currently, when calling functions like get_track_status() the raw Google Play response is returned to the caller. For example, check_rollout() is closely coupled with the result of the Google Play API.
This has two costs:

  1. When the API changes, we need to update a lot of our code, rather than just the interface layer between our code and Google Play
  2. When contact_google_play is False, the mock connection is really complicated, since it needs to carefully mock out the Google Play response in a way that's compatible with the rest of the codebase

Instead, perhaps we should structure the data returned by the googleplay layer. For example, for get_track_status(), return a list of Release:

class Release:
    # name
    # is_in_progress
    # user_fraction

@JohanLorenzo what do you think?

@JohanLorenzo
Copy link
Contributor

Thanks for filing and documenting this issue. I agree, because we want to support Amazon, the need for the adapter pattern comes up. I agree to stop returning the raw response. Although, defining classes might be overkill for now. Returning a simple dict should be enough, the current data fits in this type of structure.

What do you think of it?

@mitchhentges
Copy link
Contributor Author

Although, defining classes might be overkill for now. Returning a simple dict should be enough, the current data fits in this type of structure.

Hmm, I've always considered that if a data structure is known up front, then it usually makes sense to represent it in a class - it provides the IDE/runtime additional information about the properties in the object, and even readies the data structure to be typed.

Is there a case in which a non-dynamic data structure makes more sense as a dict rather than a class?

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

2 participants