v4.13.0: New resources, external-id operations, and disable toggles#184
Open
jessicahearn wants to merge 12 commits intomainfrom
Open
v4.13.0: New resources, external-id operations, and disable toggles#184jessicahearn wants to merge 12 commits intomainfrom
jessicahearn wants to merge 12 commits intomainfrom
Conversation
- Add Account `include` parameter for optional settings (churn_recognition, churn_when_zero_mrr, auto_churn_subscription, refund_handling, proximate_movement_reclassification) - Add DataSource `empty!` and `soft_purge!` methods for data management - Add Invoice `update!`, `toggle_disabled!`, `update_status!` methods - Add SubscriptionEvent `toggle_disabled!` method - Add standalone Transaction resource with CRUD and `toggle_disabled!` - Add standalone LineItem resource with CRUD and `toggle_disabled!` - Add external ID lookup methods (`*_by_external_id`) for Invoice, Transaction, LineItem, and SubscriptionEvent - Add JsonImport resource for bulk JSON imports - Add Upload resource for CSV file uploads (requires faraday-multipart) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added optional handle_as_user_edit parameter to: - Invoice: toggle_disabled!, update_by_external_id!, destroy_by_external_id!, toggle_disabled_by_external_id! - Transaction: toggle_disabled!, update_by_external_id!, destroy_by_external_id!, toggle_disabled_by_external_id! - LineItem: create!, toggle_disabled!, update_by_external_id!, destroy_by_external_id!, toggle_disabled_by_external_id! - SubscriptionEvent: toggle_disabled!, update_by_external_id!, destroy_by_external_id!, toggle_disabled_by_external_id! This allows API consumers to indicate when changes should be treated as user edits for edit history tracking purposes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a class-level destroy! method that accepts both flat params and envelope-wrapped params for full backwards compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1414f52 to
1bb31e2
Compare
Tests cover new_from_json (including errors/edit_history_summary fields), CRUD operations, toggle_disabled, by_external_id methods, and handle_as_user_edit query parameter support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…_id methods Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…thods Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
@claude review |
Contributor
|
@claude review |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the ChartMogul Ruby SDK with new v4.13.0 resources and convenience endpoints (uploads/imports, external-id lookups, disable toggles), and bumps the gem version + changelog accordingly.
Changes:
- Add new resources:
Transaction,LineItem,JsonImport, andUpload(CSV multipart). - Add new operations to existing resources: Account
include, DataSourceempty!/soft_purge!, Invoice toggle/update-by-external-id/status, SubscriptionEvent disable toggle + external-id ops. - Add/extend specs for the newly added endpoints and behaviors, and update version/changelog.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/chartmogul/upload_spec.rb | Adds tests for CSV upload creation (multipart) and attribute parsing |
| spec/chartmogul/transaction_spec.rb | Adds tests for Transaction external-id operations and disable toggling |
| spec/chartmogul/subscription_event_spec.rb | Adds tests for SubscriptionEvent destroy variants, disable toggling, and external-id operations |
| spec/chartmogul/line_item_spec.rb | Adds tests for LineItem CRUD-like endpoints + external-id ops + disable toggling |
| spec/chartmogul/json_import_spec.rb | Adds tests for JsonImport create/retrieve endpoints |
| spec/chartmogul/invoice_spec.rb | Adds tests for new Invoice disable toggling + external-id ops + status update |
| spec/chartmogul/data_source_spec.rb | Adds tests for DataSource empty! and soft_purge! |
| spec/chartmogul/account_spec.rb | Adds tests for Account .retrieve(include: ...) behavior |
| lib/chartmogul/version.rb | Bumps gem version to 4.13.0 |
| lib/chartmogul/upload.rb | Implements Upload resource + multipart CSV upload |
| lib/chartmogul/transaction.rb | Implements standalone Transaction resource + external-id ops + disable toggles |
| lib/chartmogul/subscription_event.rb | Adds disabled fields, toggle APIs, and external-id update/destroy/toggle methods |
| lib/chartmogul/line_item.rb | Implements standalone LineItem resource + external-id ops + disable toggles |
| lib/chartmogul/json_import.rb | Implements JsonImport create/retrieve for bulk JSON import |
| lib/chartmogul/invoice.rb | Adds Invoice update support + disable toggles + external-id ops + status update |
| lib/chartmogul/data_source.rb | Adds DataSource empty! and soft_purge! methods |
| lib/chartmogul/account.rb | Adds include parameter support and optional account settings attributes |
| lib/chartmogul.rb | Requires the newly added resource files |
| chartmogul-ruby.gemspec | Removes the post-install message |
| changelog.md | Adds 4.13.0 changelog entry describing new SDK features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Contributor
|
I've opened a draft PR with fixes: #186 |
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
TransactionandLineItemresources with CRUD,toggle_disabled!, and external-id operationsJsonImportresource for bulk JSON imports (create + retrieve)Uploadresource for CSV file uploads via multipart (requiresfaraday-multipart)toggle_disabled!,update_status!,update_by_external_id!,destroy_by_external_id!,toggle_disabled_by_external_id!toggle_disabled!,update_by_external_id!,destroy_by_external_id!,toggle_disabled_by_external_id!destroy!accepting both flat and envelope-wrapped params for backwards compatibilityincludeparameter support andidreadonly attributeempty!andsoft_purge!methodserrorsreadonly attribute to LineItem and Transaction (PIP-304)handle_as_user_editquery parameter to all write methodsAutomated test plan
handle_as_user_editquery parameter across all resourcesManual testing instructions
Prerequisites for all tests:
You'll need a data source UUID and some existing resources. Create a test data source first:
PIP-304: LineItem and Transaction errors field
Verify that
errorsis exposed as a readonly attribute on LineItem and Transaction when validation errors are present.Expected:
errorsattribute is accessible and returns the error hash (or nil if no errors).PIP-76: Account include parameter
Verify that
retrievesupports theincludeparameter for optional account settings.Expected: Optional fields are populated only when requested via
include.PIP-120: Account ID in retrieve response
Expected:
idis present and returns a string UUID.Invoice update_status!
Update the status of an invoice by data source UUID and invoice external ID.
Expected: Returns the updated invoice object with the new status.
Invoice toggle_disabled!
Disable/enable an invoice by UUID.
Expected: Invoice
disabledstate toggles correctly.Invoice by_external_id operations
Expected: Each operation succeeds. Retrieve returns the invoice, update/toggle return updated objects, destroy returns true.
SubscriptionEvent toggle_disabled!
Expected: Returns updated subscription event with
disabledtoggled.SubscriptionEvent by_external_id operations
Expected: Each operation succeeds without errors.
SubscriptionEvent destroy! backwards compatibility
Verify both flat params and envelope-wrapped params work.
Expected: Both forms succeed and delete the subscription event.
Standalone LineItem resource
Expected: Full CRUD lifecycle completes without errors.
Standalone Transaction resource
Expected: Full CRUD lifecycle completes without errors.
handle_as_user_edit parameter
Verify the
handle_as_user_editquery param is appended to write requests across all resources.Expected: Requests succeed with
?handle_as_user_edit=trueappended to the URL. The API should treat these as user-initiated edits.JsonImport resource
Expected: Import is created, returns an ID and status. Retrieve shows progress.
Upload resource (CSV)
Expected: Upload succeeds, returns upload object with
id. Both file path strings andFileobjects are accepted.DataSource empty! and soft_purge!
Expected: Both methods return successfully.
empty!deletes all data (data source remains).soft_purge!clears data for reimport.🤖 Generated with Claude Code