-
Notifications
You must be signed in to change notification settings - Fork 14
Update retrieve to accept query params #182
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
Update retrieve to accept query params #182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the retrieve method to accept query parameters for DataSource and Invoice resources, enabling more flexible data retrieval with optional filtering parameters.
Key Changes:
- Refactored the
retrievemethod in theRetrieveaction module to support query parameters by separating path parameters from query parameters and properly encoding them in the URL - Removed the custom
retrieveimplementation fromDataSourceclass to use the updated generic implementation - Added comprehensive test coverage for the new query parameter functionality
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/chartmogul/api/actions/retrieve.rb | Updated retrieve method to parse and append query parameters to the request path |
| lib/chartmogul/data_source.rb | Removed custom retrieve method to use the updated generic implementation |
| spec/chartmogul/data_source_spec.rb | Added test cases for query parameters including with_processing_status, with_auto_churn_subscription_setting, and with_invoice_handling_setting |
| spec/chartmogul/invoice_spec.rb | Added test cases for validation_type query parameter in both all and retrieve methods |
| spec/chartmogul/customer_invoices_spec.rb | Added test case for validation_type query parameter in the all method |
Comments suppressed due to low confidence (1)
lib/chartmogul/api/actions/retrieve.rb:32
- Removed blank line reduces code readability. The blank line before the JSON parsing section helps visually separate the HTTP request logic from the response processing logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| path = "#{resource_path.apply(options)}/#{uuid}" | ||
| path_param_keys = resource_path.named_params.values | ||
| query_params = options.reject { |key| path_param_keys.include?(key) } | ||
| path = "#{path}?#{URI.encode_www_form(query_params)}" if query_params.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[refactor] Instead use the faraday library to pass params.
https://rubydoc.info/gems/faraday/Faraday/Request
…o-invoices-line-items-and
It only applies to the
DataSourceandInvoiceat the moment, but will also apply toLineItemandTransactiononce their implemented.