Skip to content

Conversation

@wscourge
Copy link
Contributor

It only applies to the DataSource and Invoice at the moment, but will also apply to LineItem and Transaction once their implemented.

@wscourge wscourge requested a review from Copilot December 29, 2025 14:10
Copy link
Contributor

Copilot AI left a 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 retrieve method in the Retrieve action module to support query parameters by separating path parameters from query parameters and properly encoding them in the URL
  • Removed the custom retrieve implementation from DataSource class 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.

@wscourge wscourge marked this pull request as ready for review December 30, 2025 13:23
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?
Copy link
Contributor

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

@wscourge wscourge requested review from J-ad and swember January 2, 2026 14:30
@wscourge wscourge requested review from J-ad and pkopac January 6, 2026 12:10
@wscourge wscourge merged commit 0107fa7 into main Jan 6, 2026
4 checks passed
@wscourge wscourge deleted the wiktor/ome-418-add-validation_type-support-to-invoices-line-items-and branch January 6, 2026 13:26
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.

3 participants