Repository navigation
Add ExcludedCustomer resource and exclude option on customer delete - #203
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ya-petrov-evgeniy
requested review from
keith-chartmogul and
tudorpavel
and removed request for
tudorpavel
November 25, 2026 08:24
ya-petrov-evgeniy
marked this pull request as ready for review
November 25, 2026 08:24
tudorpavel
reviewed
Nov 25, 2026
| readonly_attr :name | ||
| readonly_attr :email | ||
| readonly_attr :excluded_at, type: :time | ||
| readonly_attr :status |
Contributor
There was a problem hiding this comment.
May be deliberate to keep things simple, but leaving this here just in case we want to be more explicit in some of the SDKs.
Ruby, Python and PHP put the re-include result in the same class as a list entry. status exists only on the re-include response, and that response lacks the other fields. In Python, reading .name on a re-include result raises AttributeError. Go avoids this with a separate ReincludedCustomer type.
Contributor
Author
There was a problem hiding this comment.
Done, reinclude! now returns a separate ReincludedCustomer with only customer_uuid and status.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
tudorpavel
approved these changes
Nov 25, 2026
keith-chartmogul
approved these changes
Nov 29, 2026
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.
Adds client support for the exclude customers API (PIP-585), shipped in chartmogul/platform#33735 and chartmogul/platform#33795.
Added
Customer.destroy!(uuid:, exclude: true)andCustomer#destroy!(exclude: true)sendexclude=trueonDELETE /v1/customers/:uuid, which also puts the customer on the account's exclude list so it is not re-imported. Withoutexcludethe request is unchanged, with no query params.ChartMogul::ExcludedCustomer/ChartMogul::ExcludedCustomersfor/v1/excluded_customers:ExcludedCustomer.all(cursor:, per_page:)lists excluded customers with cursor pagination (cursor,has_more,#next). Entries exposecustomer_uuid,data_source_uuid,external_id,name,emailandexcluded_at(parsed toTime).ExcludedCustomer.reinclude!(customer_uuid)andExcludedCustomer#reinclude!callDELETE /v1/excluded_customers/:customer_uuidand return aChartMogul::ReincludedCustomerwith onlycustomer_uuidandstatus(reimportingormanual_reimport_required). The instance form leaves the list entry unchanged. A customer that is not excluded raisesChartMogul::NotFoundError.ChartMogul::ReincludedCustomer: the re-include result. It is kept separate from the list entry type because the response has none of the entry's other fields, and list entries have nostatus.The re-include method is named
reinclude!rather thandestroy!because it returns a status instead oftrue, and so it can't be mistaken for deleting the customer. The name and the separateReincludedCustomertype match the other ChartMogul SDKs.Tests
exclude=truesent from the class and instance delete; no query params without it; list query params, entry parsing,cursor/has_moreand#next; aReincludedCustomerwith the status from both forms (the instance form leaves the entry unchanged); list entries having nostatus; and 404 on re-include.exclude, dropping it on the instance path, the wrong HTTP verb, returningtruefrom#reinclude!, returning anExcludedCustomerinstead of aReincludedCustomer, addingstatusback to list entries, removingstatusfrom the result, removing cursor pagination and leavingexcluded_atuntyped each break at least one spec.bundle exec rake: 423 examples, 0 failures. Rubocop shows no new kinds of offense: the new files only have theStyle/Documentationand specMetrics/BlockLengthoffenses that existing resources also have.ChartMogul.api_basepointed at it. Created two customers, then deleted A withexclude: trueand B without it. FollowedExcludedCustomer.all(per_page: 1)through every page: A was listed with all fields correct andexcluded_atparsed to aTime, and B was not listed.reinclude!on A returned aReincludedCustomerwithmanual_reimport_required, a secondreinclude!raisedNotFoundError(404), and A was gone from the list afterwards.🤖 Generated with Claude Code