Add Global Profile API support - #101
Draft
tholovina-sift wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds client support for the new Global Profile API, which surfaces cross-tenant
identity, decision, chargeback, order, transaction, and location signals for a
user.
Two new endpoints are wired up under the existing account-scoped
/v3/accountsAPI surface, following the same conventions as
get_user_decisions,get_a_psp_merchant_profile, etc. (HTTP Basic auth viaapi_client, aSift::Responsewrapper,account_id/api_key/timeoutoverrides viaopts).Changes
lib/sift.rb: Addedglobal_profile_api_path(account_id, user_id)andglobal_profile_lookup_api_path(account_id)path helpers.lib/sift/client.rb:get_global_profile(user_id, opts = {})— GET/v3/accounts/{account_id}/global_profile/users/{user_id}. Supports:global_onlyand:include_own_dataoptional query params. Raises ifuser_id,api_key, oraccount_idis empty.get_global_profile_by_attributes(params = {}, opts = {})— POST/v3/accounts/{account_id}/global_profile/lookupwith a JSON body of{email, phone}. Raises"email or phone must be provided"if neither:emailnor:phoneis present inparams, mirroring existingclient-side validation patterns (e.g.
properties cannot be empty).spec/unit/client_global_profile_spec.rb(new): webmock-based specs forboth endpoints — happy path, optional query params,
identity_found: falseresponse shape (all fields null except
profile_summary), and the twovalidation error cases.
README.md: New "Global Profile API" usage section, in the same styleas the existing PSP Merchant Management API section.
HISTORY: New4.7.0entry — "Global Profile API support".lib/sift/version.rb: BumpedVERSIONto4.7.0.Testing
Unit specs added in
spec/unit/client_global_profile_spec.rb. All new/modifiedRuby files pass
ruby -csyntax checks. I was unable to run the full RSpecsuite in this environment (no network access to install missing gems via
bundle install—rspec,webmock,httparty, etc. were not preinstalled),so please run
bundle exec rspecin CI/locally to confirm before merging.Not included
test_integration_apporexamples/— happy to add an exampleif desired.