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

feat: Add identity overrides to client #50

Merged
merged 4 commits into from
Mar 13, 2024
Merged

Conversation

zachaysan
Copy link
Contributor

Changes

Fixes #42

This change introduces identity overrides to the ruby Flagsmith client. The identity overrides are placed on to the environment model and as an optimization for lookup an identity identifier keyed hash lookup was also added to the client as requested by the linked issue.

Testing

Created a new spec file for local evaluation as there were none present in the repo initially. The spec has to work around some limitations of the local evaluation boot cycle so the shared mocks were only partially used since we need to mock the class, not just an instance, which on boot pulls an initial request from the API.

Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a minor comment.

def update_identity_overrides
return unless @environment

@identity_overrides_by_identifier = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need to instantiate this here, and in initialize ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In initialize to ensure that it's present even if it's accessed before update_identity_overrides is called and then again in update_identity_overrides to wipe out the stale data on successive runs.

@zachaysan zachaysan merged commit 9bc9d75 into main Mar 13, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

Identity overrides in local evaluation mode
3 participants